-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
" The following is from | ||
" https://realpython.com/blog/python/vim-and-python-a-match-made-in-heaven | ||
|
||
" Vundle(VIM plugin manager) related. | ||
" Must before anything else | ||
" $ git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim | ||
set nocompatible " required | ||
filetype off " required | ||
|
||
" set the runtime path to include Vundle and initialize | ||
set rtp+=~/.vim/bundle/Vundle.vim | ||
call vundle#begin() | ||
|
||
" alternatively, pass a path where Vundle should install plugins | ||
"call vundle#begin('~/some/path/here') | ||
|
||
" let Vundle manage Vundle, required | ||
Plugin 'gmarik/Vundle.vim' | ||
" Add all your plugins here (note older versions of Vundle used Bundle | ||
" instead of Plugin) | ||
Plugin 'tmhedberg/SimpylFold' | ||
Plugin 'vim-scripts/indentpython.vim' | ||
Plugin 'Valloric/YouCompleteMe' | ||
Plugin 'scrooloose/syntastic' | ||
Plugin 'nvie/vim-flake8' | ||
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 | ||
|
||
" Split window below & right | ||
set splitbelow | ||
set splitright | ||
" Split navigation | ||
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> | ||
" Turn on spelling check | ||
setlocal spell spelllang=en | ||
hi SpellBad term=underline cterm=underline ctermfg=0 ctermbg=7 gui=underline guibg=LightGrey | ||
|
||
|
||
" Enable code folding with spacebar | ||
set foldmethod=indent | ||
set foldlevel=99 | ||
nnoremap <space> za | ||
" See docstrings for folded code | ||
let g:SimpylFold_docstring_preview=1 | ||
|
||
" PEP8 indentation for python | ||
au BufNewFile,BufRead *.py | ||
\ set tabstop=4 | | ||
\ set softtabstop=4 | | ||
\ set shiftwidth=4 | | ||
\ set textwidth=79 | | ||
\ set expandtab | | ||
\ set autoindent | | ||
\ set fileformat=unix | | ||
|
||
" Other indentation | ||
au BufNewFile,BufRead *.js, *.html, *.css | ||
\ set tabstop=2 | | ||
\ set softtabstop=2 | | ||
\ set shiftwidth=2 | | ||
|
||
highlight BadWhitespace ctermbg=red guibg=darkred | ||
" Display tabs at the beginning of a line in Python mode as bad. | ||
au BufRead,BufNewFile *.py,*.pyw match BadWhitespace /^\t\+/ | ||
" Flagging unnecessary whitespace | ||
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/ | ||
|
||
" UTF8 support | ||
set encoding=utf-8 | ||
|
||
" Auto-Completion & goto defintion | ||
let g:ycm_autoclose_preview_window_after_completion=1 | ||
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR> | ||
" Python with 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 | ||
|
||
" Make code looks more pretty | ||
let python_highlight_all=1 | ||
" Turn on syntax coloring & automatically indentation | ||
syntax on | ||
filetype plugin on | ||
filetype indent plugin on |