Jan 30, 2009

VIM some commands

vi testing.txt
will open a testing.txt text file in the current directory.

press i
It will cause vim to go to insert mode.

press escape
This will cause you to come into command mode out of writing inside the text file.

:wq
This will help you to exit vi with saving on the file lines i have written.

:wq filename.extension
this will save the file with the name filename and with extension.

vi +36 foo.c
Start at line number 36 in foo.c

If you are already in the vi
:14
G to go to the end of file

(updated 2020)
Search a variable, for example, TH_INDEX_BASE
  • highlight on the first letter of the variable then press COMMAND+* to find the next occurrence and COMMAND+# previous occurrence.

No comments:

Carlo Cipolla's Laws of Stupidity

    "By creating a graph of Cipolla's two factors, we obtain four groups of people. Helpless people contribute to society but are...