Home Vim Plugins
Post
Cancel

Vim Plugins

While you can manually install, remove and update Vim Plugins, it is a tedious process. There are two well known plugin managers for Vim, Github: Vundle and Github: Vim-Plug. After short reading one both, it seems to me that Vundle is no longer maintained in one hand and Vim-Plug has more appealing features on the other. So, I will for now try Vim-Plug.

Installing Vim-Plug

Installation instructions are in Github: Vim-Plug README file, you can install it on macOS using

1
2
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

Please, make sure not to copy this, instead consult the Vim-Plug repo for the updated version.

Enabling Vim-Plug

We can Enable Vim-Plug by adding the following code snippet on the top of .vimrc file

1
2
3
4
5
6
7
8
9
" Plugins will be downloaded under the specified directory.
call plug#begin('~/.vim/plugged')

" Declare the list of plugins.
" Plug 'gitHubRepo/plugin-name'
" Plug 'gitHubRepo/plugin-name.vim'

" List ends here. Plugins become visible to Vim after this call.
call plug#end()

Note that Vim Plugins are qualified by GiHub repository name. In the example above the Plug instructions are commented out. When you find a plugin you like, just prefix it with Plug reload .vimrc and you are good to go.

Plugin Management

After adding or removing a Plug line from the plugins list, reload .vimrc using :source $MYVIMRC or by restarting vim. Use one of Vim-Plug commands to manage your plugins.

  • :PlugInstall: Install plugins
  • :PlugUpdate : Update plugins
  • :PlugClean : Delete Plugins

Useful Plugins

  • ctrlp/ctrlp.vim : Fuzzy finder for Vim, allows you to fuzzy search for a file in current directory. Use ^+p to initiate fuzzy search. Once fuzzy search is open, you can use:
    • ^+j or ^+k: Move up and down in the result list. Use return for selection.
    • ^+p or ^+n: Move back and forward on previous searches
  • tpope/vim-surround: Give vim awareness of things that surround text, such as quotes, braces, brackets and xml tags. It adds a vocabulary s which represents surrounding
    • cs"': change surrounding " to '
  • tpope/vim-repeat : Expand repeating actions via . to other plugins such as vim-surround
  • tpope/vim-commentary: comment stuff out using gc

Resources

This post is licensed under CC BY 4.0 by the author.
Contents

Vim Configuration

Managing Cross Concerns using Proxy Pattern

Comments powered by Disqus.