How do I set a minimum number of lines to keep visible above and below the cursor?
:set scrolloff=5
The scrolloff option keeps a minimum number of lines visible above and below the cursor when scrolling.
870 results for "it at"
:set scrolloff=5
The scrolloff option keeps a minimum number of lines visible above and below the cursor when scrolling.
J
The J command joins the current line with the line below it, replacing the newline with a space.
^ vs 0
Vim has two distinct motions for moving to the start of a line: 0 goes to column 1 (the absolute start), while ^ goes to the first non-blank character.
navigation #navigation #motions #line-navigation #indentation
vim: set ts=2 sw=2 :
A modeline is a special comment embedded in a file that Vim reads to apply file-specific settings automatically.
gJ
The gJ command joins the current line with the line below it without inserting any space between them.
:mksession / :source Session.vim
Vim's session feature saves a snapshot of your entire workspace — open buffers, window layout, tab pages, current directory, and more — to a file that you c
buffers-windows #buffers #windows #config #productivity #workflow #session
visual select + d, move, P
To swap two pieces of text, delete the first selection, navigate to the second, select it, and paste.
:g/pattern/yank A
The :g command combined with yank A (uppercase A to append) lets you collect every line matching a pattern into a single register without overwriting previous c
command-line #editing #ex-commands #global-command #registers #filtering
[m and ]m
The [m and ]m motions jump to the start of method/function definitions in languages with brace-delimited blocks.
autocmd BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
Vim remembers the last cursor position for every file you edit (stored in the viminfo or shada file), but by default it opens files at line 1.
:set wildmenu
The wildmenu option enhances Vim's command-line completion by showing a horizontal menu of matches above the command line when you press .
config #config #command-line #completion #productivity #vimrc
:cabbrev tn tabnew
Command-line abbreviations with cabbrev let you create short aliases for frequently used Ex commands.
command-line #command-line #abbreviation #shortcuts #productivity
:keeppatterns %s/\s\+$//e
Bulk cleanup commands often damage your navigation flow by overwriting the last search pattern (@/).
command-line #command-line #search #substitution #whitespace
<C-o>{cmd}
Pressing in insert mode lets you execute one normal mode command and then automatically returns you to insert mode.
) and (
The ) and ( motions move by sentence boundaries.
:cd -
The :cd - command switches Vim's global working directory back to the previous one, just like cd - in the shell.
v3aw
In visual mode, repeating text object motions progressively expands the selection.
:/start/,/end/command
Vim allows pattern-based ranges in Ex commands, letting you operate on lines between two search matches.
vim: set ts=2 sw=2 et:
Modelines are special comments at the top or bottom of a file that Vim reads to apply file-specific settings.
:nnoremap <leader>d "=strftime('%Y-%m-%d')<CR>p
The expression register (=) evaluates Vimscript expressions and uses the result as register content.