Skip to content

Instantly share code, notes, and snippets.

@rohitkode
Created January 20, 2015 07:51
Show Gist options
  • Save rohitkode/8fca580b77b84e8826ad to your computer and use it in GitHub Desktop.
Save rohitkode/8fca580b77b84e8826ad to your computer and use it in GitHub Desktop.
My Vimrc
filetype plugin indent on " Automatically detect file types and indent
autocmd FileType python runtime! autoload/pythoncomplete.vim
" Toggle Line numbers and fold column for easy copying
nnoremap <F1> :set nonumber!<CR>:set foldcolumn=0<CR>
map <F2> :NERDTreeToggle<CR>
" tab navigation like Firefox , does not work with a terminal emulator
:nmap <C-S-tab> :tabprevious<CR>
:nmap <C-tab> :tabnext<CR>
:map <C-S-tab> :tabprevious<CR>
:map <C-tab> :tabnext<CR>
:imap <C-S-tab> <Esc>:tabprevious<CR>i
:imap <C-tab> <Esc>:tabnext<CR>i
:nmap <C-t> :tabnew<CR>
:imap <C-t> <Esc>:tabnew<CR>
" set comments=sl:/*,mb:*,elx:*/
" auto format comment blocks
" Remove trailing whitespaces and ^M chars
autocmd FileType c,cpp,java,php,js,python,twig,xml,yml autocmd BufWritePre <buffer> :call setline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")'))
" If you prefer the Omni-Completion tip window to close when a selection is
" " made, these lines close it on movement in insert mode or when leaving
" " insert mode
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
" Settings for solarized (http://ethanschoonover.com/solarized)
syntax on
se t_Co=16
let g:solarized_termcolors=256
set background=dark
colorscheme solarized
set expandtab " tabs are spaces, not tabs
set tabstop=8 " let backspace delete indent
set softtabstop=4 " let backspace delete indent
set shiftwidth=4 " use indents of 4 spaces
set autoindent " indent at the same level of the previous line
set textwidth=79
set spell " spell checking on
set tabpagemax=8 " Max number of tabs allowed
set number " Turn on line numbers
set colorcolumn=80 " Highlight lines longer than 80 characters
set modeline " Permanently display filename at the bottom
set ls=2
" Persistent undo
set undofile
set undodir=~/.vim/undo
" Supertab settings
let g:SuperTabDefaultCompletionType = "context"
" Fugitive (vim git plugin) settings
silent! call fugitive#statusline()
if exists("*fugitive#statusline")
set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
endif
" Taglist variables {
" Display function name in status bar:
let g:ctags_statusline=1
" Automatically start script
let generate_tags=1
" Display Taglist results in a vertical window
let Tlist_use_Horiz_window=0
" Shorter commands to toggle Taglist display
nnoremap TT :TlistToggle<CR>
map <F4> :TlistToggle<CR>
" various Taglist display config:
let Tlist_Use_Right_Window = 1
let Tlist_Compact_Format = 1
let Tlist_Exit_OnlyWindow = 1
let Tlist_Exit_OnlyWindow = 1
let Tlist_GainFocus_On_ToggleOpen = 1
let Tlist_File_Fold_Auto_Close = 1
let Tlist_Auto_Highlight_Tag = 1
let Tlist_Auto_Update = 1
let Tlist_Highlight_Tag_On_BufEnter = 0
let Tlist_Use_SingleClick = 1
"}
" Configure vim to run pyflakes on saving a .py file
command Pyflakes :call Pyflakes()
function! Pyflakes()
let tmpfile = tempname()
execute "w" tmpfile
execute "set makeprg=(pyflakes\\ " . tmpfile . "\\\\\\|sed\\ s@" . tmpfile ."@%@)"
make
cw
endfunction
autocmd BufWrite *.{py} :call Pyflakes()
" Configure vim to run pylint on saving a .py file
command Pylint :call Pylint()
function! Pylint()
setlocal makeprg=(echo\ '[%]';\ pylint\ %)
setlocal efm=%+P[%f],%t:\ %#%l:%m
silent make
cwindow
endfunction
set clipboard+=unnamed
set mouse=a
set guioptions+=a
set ttymouse=xterm2
@rohitkode
Copy link
Author

For the plugins support, you'll need to copy/download these plugins to your .vim directory:

  • colors
  • doc
  • ftplugin
  • nerdtree
  • pydiction-1.2
  • supertab
  • taglist
  • vim-fugitive
  • VimPdb

In .vim/plugin, have these .vim files copied:

  • fugitive.vim-
  • NERD_tree.vim
  • supertab.vim
  • taglist.vim
  • tasklist.vim
  • togglebg.vim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment