Updated: 28 October 2024
Move active window to a new tab
:tab split
Move to next tab
gt
Move to previous tab
gT
Start vim with files in horizontal splits
vim -o fileA fileB
Start vim with files in vertical splits
vim -O file1 file2
Freelance software engineer United Kingdom
Updated: 28 October 2024
Move active window to a new tab
:tab split
Move to next tab
gt
Move to previous tab
gT
Start vim with files in horizontal splits
vim -o fileA fileB
Start vim with files in vertical splits
vim -O file1 file2
Updated: 02 January 2023
Goto halfway through a long file (no colon required)
50%
Move current line to middle of screen
zz
Updated: 10 December 2022
Restore default statusline
set statusline=
Show value of character under cursor in decimal and hex
set statusline=%b\ 0x%B
Updated: 11 September 2022
Spellcheck
:set spell spelllang=en_gb
Place cursor on word and show suggestions
z=
Updated: 10 September 2022
Updated: 01 March 2025
Current Directory is where vim was started, :pwd
and :cd
apply. “Directory of current file” could be different to Current Directory.
When setting the path
.
and ,,
refer to the current directory and directory of current file.
Vim supports per tab working directories.
Neovim supports per tab working directories.
LazyVim, with no modifications, does not support per tab working directories.
Updated: 10 September 2022
Start :term
Insert mode i
Normal mode CTRL+\ CTRL+n
Updated: 30 June 2023
The quickfix list is global.
The location list is local to the current window.
Open a window to show the current list.
:cope[n]
Go to an older list
:col[der]
Go to a newer list
:cnew[er]
Go to the next error in the window
:cn
Go to the previous error in the window
:cp
Updated: 12 May 2023
Make word below cursor the top of tree listing
gn
Toggle dot files
gh
Rename a file
R
Delete a file
D
Create a new file
%
Open file in new horizontal split
o
Open file in new vertical split
v
Open file in new tab
t
Create a new directory
d
Refresh directory listing
Ctrl+l
Reverse sort order
r
open
p
close
:pc
Updated: 18 November 2023
Toggle fold
za
Close all
zM
Open all
zR
Eliminate all folds in window (foldmethod “manual” or “marker”)
zE
For html
:set foldmethod=indent
Disable folding
:set nofoldenable
Remove foldtext
:set foldtext=''
Default foldtext
:set foldtext=foldtext()