How do I use the location list for per-window navigation?
:lnext and :lprev
The location list is a per-window alternative to the quickfix list.
:lnext and :lprev
The location list is a per-window alternative to the quickfix list.
:cnext and :cprev
The quickfix list holds a set of file positions, typically from compiler errors, grep results, or other tools.
gF
The gF command opens the file under the cursor and jumps to the line number that appears after the filename.
let g:netrw_liststyle=3 and let g:netrw_banner=0
How it works Vim ships with a built-in file explorer called netrw that you can access with :Explore (or :Ex).
:set backupdir=~/.vim/backup// directory=~/.vim/swap//
How it works By default, Vim creates backup files (ending in ~) and swap files (ending in .
:set autowriteall and autocmd FocusLost * silent! wa
How it works Vim can be configured to automatically save your files when you switch to another window or application.
:'<,'>w filename
How it works Vim's :w command can take a range, and when used with a visual selection, it writes only the selected lines to a file.
:nnoremap <buffer> <leader>r :!python %<CR>
How it works By adding to a mapping command, the mapping only applies to the current buffer.
:!ls -la
Vim lets you execute any shell command directly from within the editor using the :! (bang) command.
:%bd | e#
How it works Vim does not have a built-in single command to close all buffers except the current one, but you can achieve this with a two-part command: :%bd e#.
:tab sb N
How it works The :tab sb N command opens buffer number N in a brand new tab page.
<C-w>f
How it works You may already know that gf opens the file path under the cursor in the current window.
:DB sqlite:mydb.sqlite SELECT * FROM users
vim-dadbod by Tim Pope is a plugin that lets you interact with databases directly from Vim.
:b N
How it works Every buffer in Vim is assigned a unique number when it is opened.
:bdelete
How it works The :bdelete command (often abbreviated :bd) removes the current buffer from Vim's buffer list and closes it.
:windo / :bufdo / :tabdo {command}
Vim's do commands iterate over collections and execute a command in each context.
buffers-windows #buffers #windows #tabs #batch-editing #ex-commands
:find filename
The :find command searches for a file by name across all directories in your path setting and opens it.
buffers-windows #buffers #file-management #navigation #workflow
:colder / :cnewer
Vim remembers up to 10 previous quickfix lists.
:b partial<Tab>
The :b (buffer) command accepts partial filename matching with tab completion.
"#p or <C-r># in insert mode
The # register always contains the name of the alternate file — typically the file you were editing just before the current one.