Skip to content

Instantly share code, notes, and snippets.

@anabarasan
Last active October 17, 2017 06:22
Show Gist options
  • Save anabarasan/c8f296c054991a87913d230defc5d022 to your computer and use it in GitHub Desktop.
Save anabarasan/c8f296c054991a87913d230defc5d022 to your computer and use it in GitHub Desktop.
set nocompatible
filetype off
" include vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let vundle manage vundle
Plugin 'gmarik/Vundle.vim' " Vundle
Plugin 'tmhedberg/SimpylFold' " Code Folding
Plugin 'vim-scripts/indentpython.vim' " Indentation with PEP8
Plugin 'scrooloose/syntastic' " syntax checking / highlighting
Plugin 'nvie/vim-flake8' " PEP8 checking
Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'} " statusbar
Plugin 'Valloric/YouCompleteMe' " autocomplete #requires build-essential cmake python-dev python3-dev
Plugin 'majutsushi/tagbar' " class / module browser #requires ctags
" all vundle plugins must be added before this line
call vundle#end()
filetype plugin indent on
" preview doc for folded code
let g:SimpylFold_docstring_preview=1
" close autocomplete after completion.
" set short cut as space g
let g:ycm_server_python_interpreter = '/usr/bin/python'
let g:ycm_autoclose_preview_window_after_completion=1
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
" Python syntax highlighting
let python_highlight_all=1
syntax on
set number " (nu) show line numbers
set autoindent " (ai) turn on auto-indenting (great for programers)
set copyindent " (ci) when auto-indenting, use the indenting format of the previous line
set tabstop=4 " (ts) width (in spaces) that a <tab> is displayed as
set shiftwidth=4 " (sw) width (in spaces) used in each step of autoindent (aswell as << and >>)
set incsearch " (is) highlights what you are searching for as you type
set ignorecase " (ic) ignores case in search patterns
set smartcase " (scs) don't ignore case when the search pattern has uppercase
set infercase " (inf) during keyword completion, fix case of new word (when ignore case is on)
set smarttab " (sta) 'shiftwidth' used in front of a line, but 'tabstop' used otherwise
set expandtab " always uses spaces instead of tab characters
set colorcolumn=80,120 " (cc) show column margin at 80 chars
set foldmethod=indent " enable code folding use 'za' to fold / unfold
set foldlevel=99
set encoding=utf-8 " use utf-8 encoding always
" navigation between split screens
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>
nnoremap <space> za
nmap <F8> :TagbarToggle<CR>
" flag unnecessary whitespace
autocmd FileType javascript,html,css,python autocmd BufWritePre <buffer> :%s/\s\+$//e
" if diff mode switch off syntax highlighting
if &diff
syntax off
colorscheme evening
endif
" javascript
autocmd FileType javascript,html,ruby setlocal tabstop=2
autocmd FileType javascript,html,ruby setlocal softtabstop=2
autocmd FileType javascript,html,ruby setlocal shiftwidth=2
" python
autocmd FileType python setlocal
\ tabstop=4
\ softtabstop=4
\ shiftwidth=4
\ textwidth=79
\ fileformat=unix
" autocomplete
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment