How do I make Vim sessions save global variables?
:set sessionoptions+=globals
By default, :mksession restores windows, buffers, and many editor states, but it skips most global variables.
:set sessionoptions+=globals
By default, :mksession restores windows, buffers, and many editor states, but it skips most global variables.
:set jumpoptions=stack,view
By default, jump navigation can feel lossy in long files: you jump back, but folds, topline, and viewport context do not always match what you were looking at b
:set switchbuf=useopen,usetab,newtab
When jump commands open files (:tag, quickfix navigation, location list jumps), Vim may split your layout in ways that break flow.
:set grepprg=rg\ --vimgrep\ --smart-case\ --hidden\ --glob\ !.git
Vim's :grep becomes much more useful when grepprg is tuned for ripgrep and quickfix-compatible output.
:set shada='200,<1000,s100,h
Default ShaDa settings are conservative, which can make long-running workflows lose useful context between sessions.
:set shada
Neovim's ShaDa (Shared Data) file replaces Vim's viminfo and persists session state across restarts — marks, registers, command history, search history, jump
:set listchars=
The listchars option controls exactly which invisible characters Vim highlights when list mode is active.
:set makeprg=
The makeprg option defines the command that :make runs.
let {var} =<< {marker}
Vim 8.
:try / :catch / :endtry
Vimscript has a structured exception handling system using :try, :catch, :finally, and :endtry.
function! {name}#{funcname}() in autoload/{name}.vim
Vim's autoload mechanism lets you place functions in autoload/*.
:set viewoptions=cursor,folds,slash,unix
The viewoptions setting is a comma-separated list that determines exactly what :mkview (and the auto-save view pattern) stores in a view file.
: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.
:set wildmode=longest:full,full
The wildmode option controls what happens when you press in the command line.
:set nowritebackup
By default, Vim saves files using a "write-then-rename" strategy: it writes to a temporary backup file and then renames it over the original.
:set virtualedit=onemore
By default, Vim's cursor cannot go past the last character of a line in normal mode — pressing $ lands on the final character, not after it.
luaeval('lua_expression')
When you have existing Vimscript code that needs to reach into Neovim's Lua ecosystem, luaeval() is the bridge.
:set breakindentopt=shift:2
When breakindent is enabled, wrapped continuation lines are indented to match the start of their logical line.
vim.wo.number = true / vim.bo.tabstop = 2
Neovim's Lua API exposes three namespaces for setting options with the correct scope: vim.
vim.tbl_deep_extend('force', defaults, overrides)
vim.