Note: Work-In-Progress - I will be updating this as I learn my way around vi. I'll add new entries as and when I find that I'm using them frequently
:e . - edit file, show list to choose from
:e filename - edit a specific file
:q! - quit without saving
:x - save and exit
:w - save and continue editing
:buffers
- list buffers
:b N
- switch to buffer N
C-^
or
C-6
- switch to last buffer
:bn[ext][!]
- switch to next buffer
:bp[revious][!]
- switch to previous buffer
Useful mapping for :bn
and :bp
:
:nnoremap <C-n> :bnext<CR>
:nnoremap <C-p> :bprevious<CR>
:[N]bd[elete][!]
- delete buffer [(current) | N]
:[N]bun[load][!]
- unload buffer [(current) | N]
:[N]bw[ipeout][!]
- wipeout buffer [(current) | N]
(2 backticks)
- jump to last edit position
''
- (2 single quotes) jump to last edit position ^
w
- jump to start of next word
b
- jump to start of previous word
0
- jump to start of line
^
- jump to first non-blank char of line
$
- jump to end of current line
gg
- jump to start of first line
G
- jump to start of last line
)
- jump forward one sentence
(
- jump backward one sentence
}
- jump forward one paragraph
{
- jump backward one paragraph
das
- delete around a sentence
:noh
- turn off highlights until next search
:set tw=N
- hard text wrap at column N
:set tw=0
- turn text wrap off
gqq
- wraps the current line (inserts hard break)
gqip
- wraps the current paragraph (inserts hard breaks)
(From vim.wikia) Wrap text visually but only insert linebreak when ENTER is pressed
:set wrap
:set linebreak
:set nolist " list disables linebreak
C-]
- jump to |topic| at cursor
:q
- exit from help