title: Best VIM Tips tags: vim This is a quickly reformatted version of [this fandom page](https://vim.fandom.com/wiki/Best_Vim_Tips). That site uses Mediawiki, whereas this uses essentially markdown. The fandom content is available under the *Creative Commons Attribution-Share Alike License 3.0 (Unported) (CC BY-SA)* license, and so the content of this page should be considered as being under the same license, separately from anything else on this wiki. # Best Vim Tips Here is a necessarily cryptic list of the Best Vim Tips. ### Basic use ``` is the escape key or use [ sometimes written as vimtutor : starts vim editing a copy of a tutorial file -- very good. i : insert mode. Next keys typed are inserted into the file. : Escape from insert mode so you can navigate and use edit commands (stop selecting) h j k l : move cursor ( h: ← j: ↓ k: ↑ l: → ) A : Append at end of line o : Insert at new line below u : undo last command, again and again x : delete character under cursor dw : delete everything right from the cursor to the start of next word (and put it into the default register) dd : delete line (and put it into the default register) p : paste the default register /myname : search forward for myname :wq : write and quit :x : write and quit :w filename : write a copy of the file you are editing as filename :q! : quit without saving even if changes were made! :help : display help : use tab completion to scroll through commands that start with what you typed ``` ### Still basic ``` COPY PASTE (for CUTting lines use dd as described above) v : visual mode -- use to select text with cursor movement or mouse y : use to yank (copy) what was selected : esc gets you back to the main mode ^ w e $ : bigger movements: beginning of line, word, end of word, end of line Modes: normal, insert and visual, there are others too takes you back to normal Enter a number before a command to repeat it, examples: 10w : skip forward 10 words 10dd : delete 10 lines Commands are case sensitive: c : starts a change command C : change to end of line (same as c$) ce : change to end of word (a complete change command) ``` ### Really useful ``` www.vim.org : Visit frequently comp.editors : Vim dominated newsgroup * # g* g# : find word under cursor (forwards/backwards) % : match brackets {}[]() matchit.vim : % now matches tags