How do you enable persistent undo across sessions?
set undofile undodir=~/.vim/undo//
Enable undofile and set undodir to persist undo history to disk.
set undofile undodir=~/.vim/undo//
Enable undofile and set undodir to persist undo history to disk.
set wrap linebreak breakindent
Use wrap to wrap long lines, linebreak to break at word boundaries (not mid-word), and breakindent to preserve indentation on wrapped lines.
set directory=~/.vim/swap//
Set directory to control where swap files are stored.
set tabstop=4 shiftwidth=4
Set tabstop for display width of tabs and shiftwidth for indent operations.
set textwidth=80
Set textwidth (or tw) to automatically insert line breaks when typing past the specified column.
set scrolloff=8
Set scrolloff (or so) to keep at least 8 lines visible above and below the cursor when scrolling.
set sidescrolloff=5
Set sidescrolloff to keep at least 5 columns visible on each side of the cursor during horizontal scrolling.
set statusline=%f\ %m%r%h\ %=%l,%c\ %P
Configure statusline with format items: %f (filename), %m (modified flag), %= (right-align), %l,%c (line,column), %P (percentage).
set foldmethod=syntax
Set foldmethod to syntax for language-aware folding, indent for indentation-based, or manual for manual control.
let mapleader = ' '
Set mapleader to space (or any key) to use as a prefix for custom mappings.
set mouse=a
Setting mouse=a enables mouse support in all modes.
set cursorline
Enable cursorline to highlight the entire line where the cursor is positioned.
set encoding=utf-8 fileencoding=utf-8
Set encoding for internal representation and fileencoding for the file on disk.
set backupdir=~/.vim/backup//
Set backupdir to a specific directory to avoid cluttering your project.
:colorscheme desert
Use :colorscheme name to change the color scheme.
set completeopt=menu,menuone,noselect
Configure completeopt to control the completion popup: menu shows popup, menuone shows even for single match, noselect doesn't auto-select.
nnoremap <F5> :!python %<CR>
Map function keys with their notation.
// vim: set ts=2 sw=2 et:
Add a modeline comment at the beginning or end of a file.
set hlsearch
Use set hlsearch to highlight all matches of the last search pattern.
set ignorecase smartcase
Use ignorecase for case-insensitive search.