How do I browse the full commit history of the current file using vim-fugitive?
:G log -- %
vim-fugitive's :G log -- % loads the git commit history for the current file into a quickfix-style log buffer.
:G log -- %
vim-fugitive's :G log -- % loads the git commit history for the current file into a quickfix-style log buffer.
:windo {cmd}
:windo {cmd} executes an Ex command in every window in the current tab page, cycling through each one and applying the command before returning focus to the ori
buffers-windows #windows #buffers #ex-commands #buffers-windows
:e +{line} {file}
The :edit command accepts a +{cmd} prefix that executes an Ex command immediately after the file is loaded.
command-line #buffers #ex-commands #navigation #command-line
:e %:r.html
In Vim's command line, % expands to the current buffer's filename.
command-line #ex-commands #command-line #buffers #navigation
:lcd
:cd changes the global working directory, affecting every window and tab in the session.
:botright split
When you split a window with :split or :vsplit, Vim subdivides only the current window.
buffers-windows #buffers #windows #ex-commands #command-line
:oldfiles
:oldfiles displays a numbered list of every file Vim has recorded in its viminfo (or shada in Neovim) file.
:e #
:e # opens the alternate file — the file you were editing just before the current one.
:cdo
:cdo {cmd} executes {cmd} on each entry in the quickfix list — one by one, jumping to each location in turn.
command-line #ex-commands #quickfix #search #editing #buffers
mA to set, 'A to jump
Uppercase marks (A–Z) are global marks — they persist across files and Vim sessions.
:find
The :find command searches for a file by name across all directories listed in Vim's path option, so you can open files without typing full paths.
:tab split
:tab split opens the current buffer in a brand new tab page, giving you a second independent view of the same file.
:argdo norm @a | update
Combining :argdo with :norm @a lets you apply a recorded macro to every file in Vim's argument list — a powerful pattern for bulk refactoring across a project
dp / do
When reviewing differences between files in Vim's built-in diff mode, dp and do let you selectively apply individual hunks without leaving the editor.
:wall
When working across multiple files, you often have unsaved changes in several buffers.
:set suffixesadd+=.js,.ts,.jsx,.tsx
The gf (go to file) command opens the file under the cursor, but it fails when the path lacks an extension — common in JavaScript/TypeScript imports like impo
navigation #navigation #config #editing #buffers #file-management
:bufdo
When you need to apply the same change to every file you have open in Vim, switching to each buffer manually is tedious and error-prone.
:topleft split {file}
By default, Vim places horizontal splits below and vertical splits to the right (controlled by splitbelow and splitright).
:setlocal statusline=%f\ %m\ %y\ [%l/%L]
The :setlocal statusline command lets you override the global statusline for a specific window.
:cexpr system('grep -rn TODO .')
The :cexpr command evaluates an expression and parses the result as quickfix entries using the current errorformat.