How do I find invalid UTF-8 byte sequences in a file in Vim?
8g8
The 8g8 command searches forward from the cursor for the first byte that belongs to an invalid UTF-8 sequence.
8g8
The 8g8 command searches forward from the cursor for the first byte that belongs to an invalid UTF-8 sequence.
% (in netrw)
Vim's built-in file explorer netrw (opened with :Explore or :Ex) is more capable than it looks.
:let g:netrw_liststyle=3
Vim ships with a built-in file browser called netrw, opened with :Explore (or :Ex).
:set number relativenumber
Enabling both number and relativenumber simultaneously activates hybrid line numbering: the current line displays its true absolute line number while every othe
:keepjumps {command}
The :keepjumps modifier lets you run any movement or command without recording a new entry in the jump list.
navigation #navigation #ex-commands #jump-list #normal-mode #vimscript
:lua require('flash').jump()
flash.
:lua require('harpoon.mark').add_file()
Harpoon by ThePrimeagen is a Neovim plugin that maintains a small, numbered list of the files you're actively working on.
<Up>
In Vim's command line, and navigate history in prefix-filtered mode — they only cycle through past commands that begin with whatever you have already typed.
:set cursorlineopt=number
When cursorline is enabled, Vim highlights the entire line the cursor is on.
z.
Vim has two flavors of each screen-repositioning command: one that only moves the view and one that also repositions the cursor.
<C-d> (in command mode)
Pressing in Vim's command line displays the full list of matching completions below the command prompt, without cycling through them one at a time.
command-line #command-line #completion #ex-commands #navigation
zH and zL
zH and zL scroll the viewport horizontally by half a screen width, letting you navigate wide content efficiently when wrap is disabled.
navigation #navigation #scrolling #horizontal #nowrap #motions
:set scrolljump=5
When scrolloff is 0 and the cursor moves just past the screen boundary, Vim scrolls by exactly one line, which can feel abrupt during rapid navigation.
z{N}<CR>
The z{N} command sets the current window's height to exactly N lines and simultaneously positions the current line at the top of the window.
z<CR> and zt
Both zt and z scroll the view so that the current line lands at the top of the screen, but they differ in one small but important way: z also moves the cursor t
:set cursorcolumn
:set cursorcolumn (or the short form set cuc) highlights the entire vertical column where the cursor sits, painting a visible strip from top to bottom of the wi
nzz
Typing nzz chains two normal-mode commands: n jumps to the next match of the last search, and zz immediately redraws the screen so the cursor line is vertically
<C-w>H and <C-w>K
After opening a split you can dynamically reposition windows using H, J, K, and L.
buffers-windows #windows #buffers-windows #navigation #normal-mode
zO and zC
zO and zC are the recursive counterparts to zo and zc.
:e %:h/
Vim expands % to the current file's path in Ex commands, and the :h modifier strips the last filename component to give you just the directory.