How do I open netrw in a left sidebar rooted at the current file's directory?
:Lexplore %:p:h
When you are editing deep in a project, opening netrw from the working directory often puts you in the wrong place.
:Lexplore %:p:h
When you are editing deep in a project, opening netrw from the working directory often puts you in the wrong place.
:bufdo if &buftype ==# '' | update | endif
bufdo is powerful for multi-buffer automation, but a naive write pass can error on special buffers (help, terminal, quickfix, prompts).
buffers-windows #buffers #windows #ex-commands #automation #workflow
:wn
:wn (short for :wnext) writes the current buffer to disk and immediately advances to the next file in the argument list.
:windo lcd %:p:h<CR>
When multiple splits point at files from different projects, relative-path commands can become inconsistent and error-prone.
[b and ]b
The vim-unimpaired plugin by Tim Pope adds symmetric [ and ] bracket mappings for navigating common Vim lists.
plugins #navigation #buffers #quickfix #plugins #normal-mode
:set winheight=999 winminheight=5
Setting winheight to a very large number forces Vim to always try to make the focused window as tall as possible.
:find {filename}
:find searches for a file in all directories listed in the path option and opens it in the current window.
<C-w>d
Neovim 0.
buffers-windows #diagnostics #lsp #floating-window #neovim #buffers #windows
stevearc/oil.nvim
oil.
folke/snacks.nvim
snacks.
:saveas {newname}
:saveas saves the buffer to a new file and redirects all future :w commands to write to that new filename — making it the true "Save As" command in Vim.
:args {pattern}
The :args command sets Vim's argument list to all files matching a glob pattern.
:e %:h
The command :e %:h opens netrw (Vim's built-in file browser) in the directory that contains the current file.
command-line #command-line #navigation #buffers #netrw #editing
`"
The " mark is an automatic mark Vim sets whenever you leave a buffer — switching to another file, hiding the buffer, or quitting Vim (with viminfo/shada enabl
##
The ## special token expands to the names of all files currently in Vim's argument list.
:e ++enc={encoding}
When Vim auto-detects the wrong character encoding — mojibake where é shows as é is a classic symptom — you can reload the current buffer with a specifi
:set winfixbuf
Neovim's winfixbuf option (added in Neovim 0.
vim.api.nvim_buf_call()
vim.
<C-w>z
Pressing z closes the preview window from any window in the current tab page.
do
The do command (diff obtain) is shorthand for :diffget.