Created
May 24, 2019 08:00
-
-
Save sbatururimi/0f08a70abbbf32c511697b313c3786e2 to your computer and use it in GitHub Desktop.
Vim as Python IDE, source https://realpython.com/vim-and-python-a-match-made-in-heaven/#verifying-your-vim-install
This file contains hidden or 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
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' | |
Plugin 'tmhedberg/SimpylFold' | |
Plugin 'vim-scripts/indentpython.vim' | |
Bundle 'Valloric/YouCompleteMe' | |
Plugin 'vim-syntastic/syntastic' | |
Plugin 'nvie/vim-flake8' | |
Plugin 'jnurmine/Zenburn' | |
Plugin 'altercation/vim-colors-solarized' | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'} | |
" add all your plugins here (note older versions of Vundle | |
" used Bundle instead of Plugin) | |
" ... | |
" All of your Plugins must be added before the following line | |
call vundle#end() " required | |
filetype plugin indent on " required | |
"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 with the spacebar | |
nnoremap <space> za | |
" Enable folding | |
set foldmethod=indent | |
set foldlevel=99 | |
"Pep 8 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 | |
"Flagging Unnecessary Whitespace | |
highlight BadWhitespace ctermbg=red guibg=darkred | |
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/ | |
"Flagging Unnecessary Whitespace | |
"au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/ | |
"utf-8 support | |
set encoding=utf-8 | |
let g:ycm_autoclose_preview_window_after_completion=1 | |
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR> | |
"python with virtualenv support | |
py3 << 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') | |
exec(compile(open(activate_this, "rb").read(),activate_this, "exec"), dict(__file__=activate_this)) | |
EOF | |
"make your code look pretty: | |
let python_highlight_all=1 | |
syntax on | |
if has('gui_running') | |
set background=dark | |
colorscheme solarized | |
else | |
colorscheme zenburn | |
endif | |
call togglebg#map("<F5>") | |
set nu |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment