How do I open the file under the cursor and jump to a specific line?
gF
The gF command opens the file under the cursor and jumps to the line number that appears after the filename.
gF
The gF command opens the file under the cursor and jumps to the line number that appears after the filename.
M
The M command moves the cursor to the line in the middle of the current window.
L
The L command moves the cursor to the last line visible in the current window.
}
The } motion moves the cursor forward to the next blank line, effectively jumping to the next paragraph.
)
The ) motion moves the cursor to the beginning of the next sentence.
:<line-number>
When you know the exact line number you want to navigate to, the colon command is the quickest way to get there.
m{a-z} then '{a-z}
Vim marks let you bookmark positions in a file and jump back to them instantly.
{
The { motion moves the cursor backward to the previous blank line, jumping to the beginning of the current or previous paragraph.
ge
The ge motion moves the cursor backward to the end of the previous word.
<C-o> and <C-i>
Vim maintains a jump list of positions you have visited.
F{char}
The F command moves the cursor backward to the previous occurrence of a specified character on the current line.
highlight TrailingWhitespace ctermbg=red and match TrailingWhitespace /\s\+$/
How it works Vim's highlight and match commands let you create custom visual indicators.
set statusline=%{MyCustomFunc()}
How it works Vim's statusline supports the %{expr} syntax which evaluates a Vimscript expression and displays the result.
<C-v>jj"ay then "ap
How it works Vim registers remember not just the text content but also the type of selection that was used to yank it: characterwise, linewise, or blockwise.
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).
:call setreg('a', @a . 'text', 'l')
How it works Vim provides two functions for advanced register manipulation: setreg() and getreg().
:%s/pattern/\=@a/g
How it works In Vim's substitute command, the replacement string can be a Vimscript expression when prefixed with \=.
:set splitbelow splitright
How it works By default, Vim opens horizontal splits (:split or :sp) above the current window and vertical splits (:vsplit or :vsp) to the left.
:@a
How it works The command :@a executes the contents of register a as an Ex command.
try | colorscheme gruvbox | catch | colorscheme default | endtry
How it works When you share your vimrc across multiple machines, a colorscheme you have installed on one system may not exist on another.