My very basic vim setup and a cheatsheet to go with it. Trying to keep customizations to a minimum.
Read through setup.sh, it's only 3 lines. After you understand what it's doing, just run:
curl -s https://raw.githubusercontent.com/tadaspaplauskas/vimrc/master/setup.sh | bash
- Undo: u
- Redo: ctrl r
- Insert before the cursor: i
- Insert after the cursor: a
- Insert at the end of the line: A
- Insert at the beginning of the line: I
- Next autocomplete option: ctrl n
- Previous autocomplete option: ctrl p
- Suspend vim process: ctrl z
- Resume suspended vim process from console: fg (foreground)
- Go to the beginning of the current or previous word: b
- Go to the beginning of next word: w
- Go to the end of current or next word: e
- Go to the end of the previous word: ge
- Select current word: viw
- Select current line: V
- Open new buffer: command :e filepath
- Open existing buffer: command :b1, :b filename (or part of it)
- Previous buffer: command :bp
- Next buffer: command :bn
- Close buffer: command :bd [number]
- Toggle previous buffer: command :b#
- List all buffers: command :ls
- Turn off search highlight: :noh
- Find and replace: %s/search/replace[/regex flag]
- Converts tabs to spaces in document: retab
- Tab navigation commands: :tabnew :tabclose :tabp :tabn 1-9gt (go to tab)
- Find a file: :find filename[tab]
- Explore files: :E[xlore]
- Create a new file from explorer: %
- Copy a file from explorer: mf (mark files), mt (select target folder), mc (copy)
- Rename file from explorer: R
- Create a new file from explorer: %
- Show full current path: ctrl + g
- Move line up or down: command :m-+123
- Duplicate line: yy or Y and then p or P
- Indent or unindent a line: << or >>
- Indent or unindent a block of text: select in visual mode and < or >
- Jump to paragraph: { and }
- Jump to block: [[ and ]]
- Browse old file list: command :bro[wse] ol[dfiles][!]
- Navigate functions in this file: :CtrlPFunky or f
- Navigate to the definition of the function under the cursor: tf
- Find symbol in current line: f{char}
- Find symbol in current line (backwards): F{char}
- Remove line without cutting (blackhole registry): d
- Display current line in the center: zz
- Search in all files: :grep "Keyword" . -RI --color
- Jump to the last cursor position: `.