# [[Vim]] Plugins
### [[surround.vim]]
### vim-commentary
Comment stuff out.
- Use `gcc` to comment out a line (takes a count)
- `gc` to comment out the target of a motion (for example, `gcap` to comment out a paragraph)
- `gc` in visual mode to comment out the selection
- `gc` in operator pending mode to target a comment.
You can also use it as a command:
- either with a range like `:7,17Commentary`, or
- as part of a `:global` invocation like with `:g/TODO/Commentary`.
Oh, and it uncomments, too. The above maps actually toggle, and `gcgc` uncomments a set of adjacent commented lines.
### [[sensible.vim]]: "Defaults everyone can agree on"
https://github.com/tpope/vim-sensible
See the [source](https://github.com/tpope/vim-sensible/tree/master/plugin/sensible.vim) for the authoritative list of features. (Don't worry, it's mostly `:set` calls.) Here's a taste:
- `'backspace'`: Backspace through anything in insert mode.
- `'incsearch'`: Start searching before pressing enter.
- `'listchars'`: Makes `:set list` (visible whitespace) prettier.
- `'scrolloff'`: Always show at least one line above/below the cursor.
- `'autoread'`: Autoload file changes. You can undo by pressing `u`.
- `runtime! macros/matchit.vim`: Load the version of matchit.vim that ships with Vim.
### fugitive.vim: "The premier [[Vim]] plugin for [[Git]]"
The crown jewel of Fugitive is `:Git` (or just `:G`), which calls any arbitrary Git command. If you know how to use Git at the command line
https://github.com/tpope/vim-fugitive
### [[rust-tools.vim]]
See notes
### NerdTree
`:help NERDTree` (note capitalization)
https://medium.com/usevim/nerd-tree-guide-bb22c803dcd2
- Navigate with arrow keys (NOT ht, as those are unmapped)
Type `:help NERDTreeMappings` to read through all of the default keyboard shortcuts. These are the ones I use the most frequently:
- `t`: Open the selected file in a new tab
- `i`: Open the selected file in a horizontal split window
- `s`: Open the selected file in a vertical split window
- `I`: Toggle hidden files
- `m`: Show the NERD Tree menu
- `R`: Refresh the tree, useful if files change outside of Vim
- `?`: Toggle NERD Tree's quick help
Remapping
https://vi.stackexchange.com/a/19668
- "It wasn't working when I tried to set let NERDTreeMenuDown = "e" and the reason was that the key e has been bound to something else, so by setting the NERDTreeMapOpenExpl to some other key solved the issue."
### [[Vim]] auto-closers compared
https://aftnn.org/post/75730734352/vim-auto-closers-compared
- Winner: Auto-pairs
- https://github.com/jiangmiao/auto-pairs