Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »

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

 

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 {{ Plugin 'edx/edx-platform' }}

To install or update plugins, run the command {{ :PluginUpdate }}

vim-plug

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

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 above commands can be added to your .vimrc as is, or run in ex mode (escape from insert mode, and type `:` followed by the command.)

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

Use the scrooloose/syntastic plugin.  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

Use the neomake 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.

  • No labels