How do I write a simple Vim plugin?
Create plugin/myplugin.vim
A basic Vim plugin is just a .
Create plugin/myplugin.vim
A basic Vim plugin is just a .
cs"' (change), ds" (delete), ys iw" (add)
The vim-surround plugin by Tim Pope adds commands for working with surrounding characters like quotes, brackets, and tags.
:TestNearest (vim-test)
vim-test provides commands to run tests from within Vim.
Plug 'sheerun/vim-polyglot'
vim-polyglot is a collection of language packs for Vim.
Plug 'tpope/vim-repeat'
vim-repeat by Tim Pope extends the .
<leader><leader>w
vim-easymotion lets you jump to any visible position by highlighting targets with unique letters.
:Git command (e.g., :Git status)
vim-fugitive by Tim Pope is a comprehensive Git wrapper for Vim.
vim-gitgutter plugin
vim-gitgutter shows git diff markers in the sign column next to line numbers.
:%S/old/new/g (vim-abolish)
vim-abolish by Tim Pope provides :%S (Subvert), a substitute command that preserves the case pattern of the original text.
gcc (toggle line), gc{motion} (toggle range)
vim-commentary by Tim Pope provides a simple way to toggle comments.
:Make (vim-dispatch)
vim-dispatch by Tim Pope provides asynchronous build commands in Vim.
:Telescope find_files
Telescope is a highly extensible fuzzy finder for Neovim.
: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.