Vim είναι ένας από τους ισχυρότερους και δημοφιλείς συντάκτες κειμένων γραμμών εντολής γύρω. Ήταν αρχικά μόνο διαθέσιμο για τις πλατφόρμες Linux και Unix, αλλά ήταν έπειτα στα παράθυρα επίσης. Η διεπαφή είναι καθαρή και απλή, και χρησιμοποιείτε έναν συνδυασμό κλειδιών για να εκτελέσετε τους στόχους όπως η αντίγραφο-κόλλα, αναζήτηση και να αντικαταστήσετε, να διαγράψετε μια δέσμη των γραμμών, και πολύ περισσότερο.
Vim έρχεται προ-εγκατεστημένος με τις περισσότερες διανομές Linux και στη MAC OS. Σε περίπτωση που δεν το έχετε ή να θελήσει να το εγκαταστήσετε σε μια άλλη πλατφόρμα μπορείτε να πάρετε τον εφαρμοστή από;εδώ. Για τους χρήστες παραθύρων πρέπει να πάτε;εδώ;και μεταφορτώστε την πιό πρόσφατη απελευθέρωση Vim. Μεταφορτώστε το αρχείο Zip για την έκδοση παραθύρων σας και εξάγετε το. Κατόπιν τρέξτε τον εφαρμοστή. Το μόνο πράγμα διαφορετικό μεταξύ του Linux/της έκδοσης της MAC Vim και της έκδοσης παραθύρων είναι ότι τα τρεξίματα έκδοσης παραθύρων στο γραφικό παράθυρό του. Ρίξτε μια πιό στενή ματιά στη χρήση του.
Προτού να φτάσουμε στην πραγματική χρήση Vim με επιτρέψτε να εξηγήσω εν συντομία σε σας τους δύο τρόπους ότι Vim τρεξίματα μέσα - εντολή και ένθετο τρόπος. εντολή ο τρόπος εσείς δίνει τις οδηγίες σε Vim για να λάβει κάποια μέτρα, όπως η διαγραφή μια γραμμή, ή την αναζήτηση μιας λέξης. Όταν είστε ένθετο ο τρόπος τι δακτυλογραφείτε πηγαίνει μέσα ως κείμενο στο έγγραφο που εκδίδετε. Όταν έναρξη Vim εσείς είστε εντολή τρόπος. Στο διακόπτη ένθετο ο τρόπος χτύπησε» κλειδί το `ι στο πληκτρολόγιό σας. Θα δείτε μια ανακοίνωση στο κατώτατο σημείο που αφήνεται της οθόνης σας όπως αυτό:
- ΕΝΘΕΤΟ -
Αυτό σημαίνει ότι μπορείτε τώρα να αρχίσετε το αρχείο. Στο διακόπτη πίσω εντολή ο τρόπος χτύπησε ακριβώς το κλειδί διαφυγών. Θα διαπιστώσετε ότι η «- ΕΝΘΕΤΟ -» ανακοίνωση στο κατώτατο σημείο θα εξαφανιστεί. Είστε τώρα εντολή ο τρόπος και μπορεί να καθοδηγήσει Vim για να διαγράψει μια γραμμή, ή για να σώσει το αρχείο, ή οποιου δήποτε μπορείτε να θελήσετε να κάνετε με το έγγραφο.
Για να ανοίξει ένα υπάρχον αρχείο ή ένα α για να δημιουργήσει ένα νέο με Vim χρήση η ακόλουθη σύνταξη:
# vim helloworld.txt
Εάν ανοίξατε ένα υπάρχον αρχείο πρέπει να δείτε το περιεχόμενό της, ή μια κενή σελίδα εάν δημιουργήσατε μια νέα. Τώρα προτού να συνεχίσουμε με τη χρησιμοποίηση Vim, δείτε πώς να βγεί Vim. This is important because, unlike your standard graphical text editor, you cannot close the window to shut the application. To exit Vim and return to the command line you need to enter the following key combination:
ESC :q ENTER
In plain English the above command goes something like this, “Escape key, then a colon, followed immediately by a ‘q’, and then the Enter key to finish”. The “q” here stands for “quit”. What Vim does here is that it exits without saving any changes you may have made to the file. To save the file and quit add the ‘w’ or “write” option:
ESC :wq ENTER
You can also use the ‘w’ option without the ‘q’, if you just want to save the file while editing it and not quit Vim.
Now that we know how to get in an out of Vim let’s see how to use it. Let’s create a new document with Vim and begin writing:
# vim newdocument.txt
Now hit ‘i’ on your keyboard to get into the insert mode. Write a few lines of text in the file. Once you are done hit the Escape key to go into the command mode, and then “:wq” to save and exit the file. Now let’s see if the file was written correctly. Windows users can open the document we created using Notepad. If you are using Linux or a Mac run the following command to check out the contents of the file:
# cat newdocument.txt
You should see the contents of the file you just created. Now open the same file using Vim and let’s see what more Vim do do. Let’s delete a few words and lines. While in command mode navigate you cursor to he beginning of a word and hit the key combination “dw” followed by Enter. This should delete the word. Now let’s delete a whole line. Pick a line you want to delete and take the cursor to any location in that line and hit the key combination “dd” followed by Enter. Line deleted.
Sometimes you make a mistake that you want to undo, say you want to bring back the line you just deleted. To undo your last action go to the command mode and hit the key “u”. You can continue hitting “u” to undo more changes.
These commands will get you started with Vim. Practice what you learned here. I will return with more cool stuff such as finding and replacing words, searching a text, and more.
A quick recap of the commands you learned here:
1. Save file - “:w”
2. Quit file without saving - “:q”
3. Save and quit file - “:wq”
4. Go into insert mode - “i”
5. Go into command mode - ESC
6. Delete word - “dw”
7. Delete line - “dd”
8. Undo change - “u”






























{ 1 comment… read it below or add one }
Come on ! Is there someone who still use vi (& its clones) ? There’s hundred of editors out there who can ease much more the work for a writer…!!!
Yeah, I know you can do more with Vi than any other editor, but believe me you still have to memorize a bunch of keyboard keys…
Leave a Comment