Installing plugins
There are several plugin managers for vim. They all work slightly differently, but generally allow you to specify the github repository for a plugin, and have the tools load the code into your vim configuration directory (~/.vim). Directions for a couple plugin managers are included here, so that advice on specific plugins can be given in a manager-neutral way.
Vundle
To use Vundle, manually install vundle in your .vim/bundle directory:
$ mkdir -p ~/.vim/bundle $ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
Then add the following to your .vimrc file:
""""""""""""""""""""""""" " Vundle configuration filetype off set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() " let Vundle manage Vundle (required) Plugin 'gmarik/Vundle.vim' call vundle#end() filetype plugin indent on
Then to register a new plugin, add a Plugin directive under Plugin 'gmarik/Vundle.vim'
with the owner/repository of the github repo for the plugin. For instance to add edx-platform as a vim plugin (this won't work), you would add a line with Plugin 'edx/edx-platform'
To install or update plugins, run the command from within vim
:PluginUpdate
Or from the command line:
$ vim +PluginUpdate +qa
vim-plug
Calen Pennington (Deactivated): care to fill this out?
Python
Editing
Syntax Highlighting
Add the following to your .vimrc
filetype plugin indent on
Show Hidden Characters
To show invisible characters inline, add the following to your .vimrc
set listchars=tab:→ ,trail:·,nbsp:¤,precedes:«,extends:»,eol:↲ " specify which characters to use. If you don't have unicode support in your terminal, adjust these accordingly set list " turn on display of listchars set nolist " turn off display of listchars
The list and nolist settings can be added to your .vimrc as is, or run in ex mode (escape from insert mode, and type :set list
or :set nolist
)
Jump to File (fuzzy search)
Use the https://github.com/ctrlpvim/ctrlp.vim plugin
# Using https://github.com/junegunn/vim-plug call plug#begin('~/.config/nvim/plugged') Plug 'ctrlpvim/ctrlp.vim' call plug#end()
Quality
Install the following plugin using your preferred plugin manager:
Configure it to use pylint and pep8 in your .vimrc:
set statusline+=%#warningmsg# set statusline+=%{SyntasticStatuslineFlag()} set statusline+=%* let g:syntastic_always_populate_loc_list = 1 let g:syntastic_auto_loc_list = 1 let g:syntastic_check_on_open = 1 let g:syntastic_check_on_wq = 0 let g:syntastic_python_checkers = ['pylint', 'pep8']
You can navigate to the Syntastic report split using ^ww
and then hit enter on any issue to jump to that line in the main split, or you can navigate through them from the main split using :lnext
and :lprevious
.
For more details check out the excellent in-editor documentation using :help syntastic
.
Note: Improvements to the statusline would be welcome. The one above doesn't show the usual line/column number information unless all lint errors are resolved.
For NeoVim
Install the following plugin:
Configure it thusly:
call plug#begin('~/.config/nvim/plugged') Plug 'benekastah/neomake' call plug#end() " Neomake let g:neomake_python_enabled_makers = ['pylint', 'pep8'] autocmd! BufWritePost * Neomake
Note that this only works if you run vim from within the virtualenv that has pylint and pep8 installed.
JavaScript
Linting
Install https://github.com/vim-syntastic/syntastic follow README instructions, then add this to your .vimrc:
let g:syntastic_javascript_checkers=['eslint']
Also, install: https://github.com/mtscout6/syntastic-local-eslint.vim so that it lints based on each individual project's configuration.
You can also use https://github.com/sbdchd/neoformat to run an auto-formatter like prettier or prettier-eslint.
If you're feeling extra lazy, just clone my vim setup and run the included script: https://github.com/efischer19/personal_vim