Some Notes on Vim

13 December, 2020 tools 2 Mins

Some notes on Vim window management, Tab Management and Other Stuffsa..

Window Management

a window in Vim is the viewport for a buffer. following are a few useful window management command:

Key BindingActionCommand
<C-w> oclose all windows except the current one:on, :only
<C-w qclose focused window
ZZclose focused window after saving changes
ZQclose focused window without saving changes
<C-w vsplit window vertically:vsplit
<C-w ssplit window horizentally:split
<C-w H/J/K/Lmove window to a direction
<C-w h/j/k/lswitch between windows
<C-W> fsplit the window and edit filepath under cursor
  • a/file/path.md 20: when the cursor is on filepath, pressing <C-W F would open the filepath in a split window and jump to line number(20 in this case)

Tab Management

a Tab in Vim holds one or more windows. multiple Tabs can be open to holds windows. In other words, windows can be grouped together by their relevance.

Key BindingActionCommand
open a Tab:tabe[dit], :tabnew
close a Tab:tabc[lose]
open a filepath in new tab:tabe FILEPATH
close all tabs except for the focused one:tabo[nly]
gtgo to next tab page
gTgo to previous tab page
<C-W> gfopen the filepath under cursor into a new tab
go to previous tab:tabp
go to next tab:tabN
[count]gTgo to [count] tab
go to first tab:tabfir[st]
go to last tab:tabl
list open tabs:tabs
  • :tabnew and tabe command can be prefixed with +, -, 0, $ to open Tabs at desired locations
  • a/file/path.md 20: when the cursor is on filepath, pressing <C-W gF would open the filepath in a new tab window and jump to line number(20 in this case)
#vim #neovim #editor

Contact