How do you create a custom key mapping in Vim?
nnoremap <leader>s :w<CR>
Use nnoremap for non-recursive normal mode mappings.
nnoremap <leader>s :w<CR>
Use nnoremap for non-recursive normal mode mappings.
set noswapfile
Use set noswapfile to disable creating .
augroup MyGroup | autocmd! | autocmd BufWrite *.py :!black % | augroup END
Wrap autocommands in an augroup with autocmd! to clear previous entries.
autocmd FileType python setlocal tabstop=4 expandtab
Use autocmd FileType to set buffer-local options for specific filetypes.
vim-which-key plugin
vim-which-key displays a popup showing available key bindings as you type a prefix key.
Plug 'vim-airline/vim-airline'
vim-airline provides a beautiful, feature-rich status line that shows file info, git branch, diagnostics, and more with minimal configuration.
:set shortmess-=S
The shortmess option controls which messages are shortened.
:set updatetime=250
The updatetime option controls how long Vim waits after you stop typing before triggering certain events (like swap file writes and CursorHold autocommands).
:set termguicolors
The termguicolors option enables 24-bit RGB color support, allowing color schemes to use millions of colors instead of the terminal's 256-color palette.
:set belloff=all
The belloff=all option disables all error bells and visual bells in Vim.
Create plugin/myplugin.vim
A basic Vim plugin is just a .
Plug 'sheerun/vim-polyglot'
vim-polyglot is a collection of language packs for Vim.
:TSInstall language
nvim-treesitter provides Tree-sitter integration for Neovim, offering faster and more accurate syntax highlighting, indentation, and text objects.
vim.lsp.buf.definition()
Neovim has a built-in LSP (Language Server Protocol) client that provides IDE-like features without plugins.
let mapleader = " "
The leader key is a prefix for custom mappings.
:set textwidth=80
The textwidth option sets the maximum width for text.
:command Name action
The :command command defines a new user Ex command.
autocmd FileType python setlocal ...
Using autocmd FileType with setlocal, you can configure settings that only apply when editing files of a specific type.
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
vim-plug is a minimalist plugin manager for Vim.
:set nobackup noswapfile
Disabling backup and swap files prevents Vim from creating extra files alongside your source code.