An alternative to the EMACs/Nano (my favourite), due to the usage of GIT, (a CVS program), i have to start learning VIM, here are some useful commands to remember.
1. There are different modes in this editor. To get into editing mode, we need to hit "i", (which is the equivalent of insertion. To escape from editing mode after we are done, we need to hit the 'ESC" key which will then bring us to the main prompt.
2. It allows us to do stuffs faster here in he main prompt, for example, by typing "d" on a line, it allows us to remove the entire line.
3. To save, type, "ZZ" (Shift + Z + Z) or use ":x" (Colon + x + ENTER), this qill automatically save and quit. To quit, go outside insertion mode (press ESC), and then type "ZQ" (Shift + Z + Q) or ":q!" (Colon + q + ! + ENTER). The program will quit without saving.
4. To do more complete stuffs like after being able to recover from a lost SSH connection, look under the area of a swap file. When we try to access the file, it will say something like the file already exist. do you want to edit, recover, delete, quit or abort.
Try the following steps to recover the files or do side by side comparion of iles
1. hit "r" when it asked what you want to do (to recover)
2. :sav! /tmp/%
3. :vs
4. :diffthis
5, CTRL + W + I
6. :bp
7. e (to edit anyway)
8. :diffthis (finds the difference between the two files side by side)
Right that should be all you ever need to know about VIM for basic usage.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment