1
edit
No edit summary |
(Add navigation section) |
||
| Line 8: | Line 8: | ||
to start vim and edit a file (new or existing) | to start vim and edit a file (new or existing) | ||
vim file_name | vim file_name | ||
to start vim | to start vim in NetRW (file tree) | ||
vim . | |||
vim | |||
to | to write your changes | ||
:w | |||
to quit vim | |||
:q | |||
you can also combine these | |||
:wq | :wq | ||
to | to write to a file | ||
: | :w <file> | ||
to | to quit without saving | ||
:q! | :q! | ||
to enter NetRW | |||
:Ex | |||
===''' | ==='''Normal Mode'''=== | ||
Normal mode is the default mode you are in when you enter Vim. This is the mode you will spend most of your time in, as it's used to navigate around your file. To go back to normal mode hit 'ESC' on your keyboard. | |||
1. move the cursor to the character | ===='''Navigation'''==== | ||
To navigate in Vim you primarily use the | |||
'''I''' '''J''' '''K''' '''L''' | |||
keys, to navigate to the | |||
'''left''' '''down''' '''up''' '''right''' | |||
directions respectively. | |||
For example, | |||
'''J''' | |||
will bring your cursor 1 line down! | |||
You can also add a number to vim commands to do them that number of times. | |||
For example, | |||
'''5J''' | |||
will bring your cursor 5 lines down! | |||
There are also other keys to move your cursor such as: | |||
'''W''' | |||
which moves your cursor forward one word, | |||
'''B''' | |||
which moves your cursor back one word, | |||
'''G''' | |||
which moves your cursor to the final line of the file, | |||
'''gg''' | |||
which moves your cursor to the first line of the file, and | |||
'''f<character>''' | |||
which moves your cursor to the next instance of <character> on the current line! | |||
==='''Searching for Words'''=== | ==='''Searching for Words'''=== | ||
edit