Oct 11, 2011

My Vim plugins and config for comfortable Python / Django scripting

Generate ctags:
ctags --languages=Python -R --exclude=IPython --exclude=test --exclude=tests

Plugins:
python-mode
ctrlp.vim
django_template_textobjects
nerdtree
patchreview-vim
tagbar
ultisnips
vim-commentary
vim-repeat
vim-sparkup
vim-surround
vim-textobj-user
vim-unimpaired
vim-visual-star-search


Config:
set nocompatible

" Command line history size 
set history=1000
set undolevels=1000

" Set to auto read when a file is changed from the outside
set autoread

" Turn backup off, since most stuff is in SVN, git et.c anyway...
set nobackup
set nowb
set noswapfile

" Return to last edit position when opening files (You want this!)
autocmd BufReadPost *
     \ if line("'\"") > 0 && line("'\"") <= line("$") |
     \   exe "normal! g`\"" |
     \ endif

syntax enable
set autoindent

set t_Co=256
let g:solarized_termcolors=16
colorscheme jellybeans


" Tab completion like bash
set wildmode=longest,list
" Tab completion like zch
"set wildmenu
"set wildmode=full

set shiftwidth=4 softtabstop=4 expandtab

" Jump between special words
filetype plugin on
runtime macros/matchit.vim

" Disable arrow keys
noremap  
noremap  
noremap  
noremap  

" Pathogen load
filetype off
call pathogen#infect()
call pathogen#helptags()

filetype plugin indent on
syntax on
let g:pymode_folding = 0
"let g:pymode_rope_vim_completion = 0
"let g:pymode_rope = 0
"let g:pymode_lint_write = 0
"let g:pymode_lint_onfly = 1
"let g:pymode_lint_cwindow = 0
let g:ropevim_extended_complete=1

nmap  :set number!
nmap  :PyLintAuto
set pastetoggle=

nnoremap  :!ctags -R

nmap  :NERDTreeToggle
nmap  :TagbarToggle

noremap   :cal VimCommanderToggle()

" SEARCH

" enable ack
set grepprg=ack\ --nogroup\ --column\ $*
set grepformat=%f:%l:%c:%m

" mutes search highlight and redraws screen
nnoremap   :nohlsearch

set hls

" show search matches as you type
set incsearch
set ignorecase
set smartcase

" NETRW

let s:split_width=24

"let g:netrw_menu=0
let g:netrw_liststyle='tree'

let NERDTreeIgnore = ['\.pyc$', '^tags$', 'nohup.out']
let NERDTreeChDirMode=2
let NERDTreeMinimalUI=1
let NERDTreeDirArrows=1

" EX MODE

" %% instead %:h
cnoremap  %% getcmdtype() == ':' ? expand('%:h').'/' : '%%'

" Fixing the & Command
nnoremap & :&&
xnoremap & :&&

" set path+=apps/
"set path+gtemplates/
"set path+=/usr/local/lib/python2.7/dist-packages/

" SPELL

" syn spell toplevel
set spell
" autocmd BufNewFile,BufRead * setlocal spell spelllang=en 
autocmd BufNewFile,BufRead * syn spell toplevel

set mouse=a

let g:clipbrdDefaultReg = '+'

" When I close a tab, remove the buffer
set nohidden


if filereadable(".vimrc")
    so .vimrc
endif

No comments: