Skip to content

Instantly share code, notes, and snippets.

@neotrinity
Last active December 31, 2015 22:39
Show Gist options
  • Save neotrinity/8054549 to your computer and use it in GitHub Desktop.
Save neotrinity/8054549 to your computer and use it in GitHub Desktop.
My vimrc for python
syntax on
set nocompatible
set clipboard=unnamed " yank and paste with the system clipboard
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
" The bundles you install will be listed here
filetype plugin indent on
" The rest of your config follows here
augroup vimrc_autocmds
autocmd!
" highlight characters past column 120
autocmd FileType python highlight Excess ctermbg=DarkGrey guibg=Black
autocmd FileType python match Excess /\%120v.*/
autocmd FileType python set nowrap
augroup END
Bundle 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
" Powerline setup
set guifont=Monaco
set laststatus=2
Bundle 'tpope/vim-fugitive'
Bundle 'scrooloose/nerdtree'
map <F2> :NERDTreeToggle<CR>
let NERDTreeIgnore = ['\.pyc$']
" Using Jedi Now
Bundle 'davidhalter/jedi-vim'
let g:jedi#popup_on_dot = 0
"Other Settings
" Use l to toggle display of whitespace
nmap l :set list!
" And set some nice chars to do it with
set listchars=tab:»\ ,eol:¬
" automatically change window's cwd to file's dir
set autochdir
" I'm prefer spaces to tabs
set tabstop=4
set shiftwidth=4
set expandtab
Bundle 'altercation/vim-colors-solarized'
syntax enable
set background=light
" If you want it dark
"set background=dark
colorscheme solarized
Bundle 'ervandew/supertab'
let g:SuperTabDefaultCompletionType = "context"
" Mouse settings for VIM
" Send more characters for redraws
set ttyfast
" Enable mouse use in all modes
set mouse=a
" Set this to the name of your terminal that supports mouse codes.
" Must be one of: xterm, xterm2, netterm, dec, jsbterm, pterm
set ttymouse=xterm2
" Syntastic
Bundle 'scrooloose/syntastic'
"let g:syntastic_python_checkers=['pylint']
let g:syntastic_python_checkers=['flake8']
" let g:syntastic_python_flake8_args = "--ignore=E501 --max-complexity=10"
let g:syntastic_python_flake8_args = "--max-complexity=10 --max-line-length=120"
" Better :sign interface symbols
let g:syntastic_error_symbol = '✗'
let g:syntastic_warning_symbol = '!'
" Gundo
Bundle 'sjl/gundo.vim'
nnoremap <F5> :GundoToggle<CR>
" Silver Searcher !!
Bundle 'rking/ag.vim'
Bundle 'taiansu/nerdtree-ag'

Setup Instructions

Setup iTerm2

  1. Download and install iTerm2 - http://www.iterm2.com/#/section/home
  2. git clone https://github.com/altercation/solarized ~/solarized
  3. open iterm2 -> Preferences -> Profiles -> Colors -> Load Presets -> Import -> Naviagte to ~/solarized/iterm2-colors-solarized->Solari...ItemColors ( and the dark if needed )
  4. Click Load Presets AGAIN and set to Solarized Dark / Light
  5. open iterm2 -> Preferences -> Profiles -> Terminal -> Report Terminal Type - xterm-256 color

Setup vim

  1. copy .vimrc to ~/
  2. Open vi
  3. :BundleInstall - Installs all the vim packages
  4. :BundleList - Lists them again for you

Setup additonal/external exe/programs

  1. Install brew
  2. brew install the_silver_surfer
  3. pip install flake8
  4. pip install pylint
  5. Install git

Features

  • Auto completion by pressing the TAB key
  • goto definition - \d (<leader>d)
  • goto assignment - \g (<leader>g)
  • Pydoc lookup - K
  • If the code length exceeds 120 chars then those Excess chars will appear blackened
  • On saving a python file the flake8 will check for pep8 violations/errors/suggestions( you can change it to pylint in the .vimrc if you want to )
  • Syntax checker for many/many languages via syntastic
  • NerdTree toggling - F2
  • NerdTree silver searcher context - Press F2 -> sm -> type search term and then press enter
  • Powerful silver searcher - :Ag <search_term>
  • Gundo - Press F5 on while editing to lookup the tree of the undos you have done. Really powerful and very useful!
  • Use mouse on your terminal vim
  • Powerline which shows the file name, git branch and other information
  • Deep git integration via fugitive. - check out Gdiff, Gstatus, Gread - http://vimcasts.org/episodes/fugitive-vim---a-complement-to-command-line-git/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment