Skip to content

Instantly share code, notes, and snippets.

@ceolson01
Created August 23, 2016 13:52
Show Gist options
  • Save ceolson01/bfa0b89180b9161dd821b988ea4bba15 to your computer and use it in GitHub Desktop.
Save ceolson01/bfa0b89180b9161dd821b988ea4bba15 to your computer and use it in GitHub Desktop.
Python .vimrc
set nocompatible " required
filetype off " required
" split layouts
set splitbelow
set splitright
" split navigations
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Enable folding
set foldmethod=indent
set foldlevel=99
" Enable folding with the spacebar
nnoremap <space> za
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
set encoding=utf-8
" Show docstrings for folded code
let g:SimpylFold_docstring_preview=1
" Python indentation
au BufNewFile,BufRead *.py
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set textwidth=0 |
\ set wrapmargin=0 |
\ set expandtab |
\ set autoindent |
\ set fileformat=unix
" Full-stack indentation
au BufNewFile,BufRead *.js, *.html, *.css
\ set tabstop=2 |
\ set softtabstop=2 |
\ set shiftwidth=2
:set textwidth=0
:set wrapmargin=0
" Flag unnecessary whitespace
"au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
" YouCompleteMe config
let g:ycm_autoclose_preview_window_after_completion=1
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
" Python syntax pretty-fier (highlighting)
let python_highlight_all=1
syntax on
" VirtualEnv support
py << EOF
import os
import sys
if 'VIRTUAL_ENV' in os.environ:
project_base_dir = os.environ['VIRTUAL_ENV']
activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
EOF
" Color schemes
set background=dark
colorscheme solarized
" Hide those damn .pyc files
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree
" Automatically load NERDTree on start
au VimEnter * NERDTree
" Line numbering
set nu
" Use system clipboard so I can steal code from StackOverflow
set clipboard=unnamed
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" Add all your plugins here (note older versions of Vundle used Bundle instead of Plugin)
Plugin 'vim-scripts/indentpython.vim'
Plugin 'tmhedberg/SimpylFold'
Bundle 'Valloric/YouCompleteMe'
Plugin 'scrooloose/syntastic'
Plugin 'nvie/vim-flake8'
Bundle 'altercation/vim-colors-solarized'
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'kien/ctrlp.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment