Created
September 17, 2011 07:53
-
-
Save mdeous/1223737 to your computer and use it in GitHub Desktop.
My .vimrc
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
"""""""""""""""""""""""""""""" | |
" VIM CONFIGURATION FILE " | |
"""""""""""""""""""""""""""""" | |
" pathogen plugin | |
filetype off | |
call pathogen#runtime_append_all_bundles() | |
call pathogen#helptags() | |
" basic settings | |
set nocompatible | |
if has('autocmd') | |
filetype on | |
filetype plugin on | |
filetype plugin indent on | |
endif | |
if has('mouse') | |
set mouse=a | |
endif | |
set ruler | |
set showmode | |
set showcmd | |
set number | |
set nospell | |
set hidden | |
set title | |
set cursorline | |
set wildmenu | |
set wildmode=list:longest,full | |
set scrolloff=5 | |
set showmode | |
set encoding=utf-8 | |
let mapleader = "," | |
map <C-t> :tabnew<CR> | |
" text search and replace | |
set hlsearch | |
set incsearch | |
set ignorecase | |
set showmatch | |
set gdefault | |
nmap <silent> <leader>n :silent :nohlsearch<CR> | |
" automatically strip spaces at end of lines | |
autocmd BufWrite *.py silent! %s/[\r \t]\+$// | |
" paste mode | |
nnoremap <F2> :set invpaste paste?<CR> | |
set pastetoggle=<F2> | |
" code folding and indentation | |
set foldmethod=indent | |
set foldlevel=99 | |
set backspace=indent,eol,start | |
set expandtab | |
set autoindent | |
set tabstop=8 | |
set shiftwidth=4 | |
set softtabstop=4 | |
" window splitting | |
" vertical split: Ctrl+w v | |
" horizontal split: Ctrl+w s | |
" close current windows: Ctrl+w q | |
" go to window at bottom: Ctrl+w j | |
" '' '' '' '' top: Ctrl+w k | |
" '' '' '' '' right: Ctrl+w l | |
" '' '' '' '' left: Ctrl+w h | |
map <c-j> <c-w>j | |
map <c-k> <c-w>k | |
map <c-l> <c-w>l | |
map <c-h> <c-w>h | |
" tasks list | |
map <leader>td <Plug>TaskList | |
" revision history | |
map <leader>g :GundoToggle<CR> | |
" syntax highlighting | |
syntax on | |
colorscheme delek | |
" pyflakes | |
let g:pyflakes_use_quickfix = 0 | |
" PEP8 | |
let g:pep8_map='<leader>8' | |
" code completion | |
au FileType python set omnifunc=pythoncomplete#Complete | |
let g:SuperTabDefaultCompletionType = "context" | |
" code documentation | |
set completeopt=menuone,longest,preview | |
" file browser | |
map <leader>n :NERDTreeToggle<CR> | |
" refactoring (rename and go to definition) | |
map <leader>j :RopeGotoDefinition<CR> | |
map <leader>r :RopeRename<CR> | |
" searching with ack | |
nmap <leader>a <Esc>:Ack! | |
" statusline | |
set laststatus=2 | |
set statusline=%F%m%r\ %y\ %=[%02l/%02L,%02v]\ %{fugitive#statusline()} | |
" add virtualenv to path | |
py << EOF | |
import os.path | |
import sys | |
import vim | |
prj_base_dir = os.environ.get('VIRTUAL_ENV', None) | |
if prj_base_dir is not None: | |
sys.path.insert(0, prj_base_dir) | |
activate_this = os.path.join(prj_base_dir, 'bin', 'activate_this.py') | |
execfile(activate_this, dict(__file__=activate_this)) | |
EOF | |
" add modeline by pressing <leader>ml | |
function! AppendModeline() | |
let l:modeline = printf(" vim: set ts=%d sw=%d ft=%s :", &ts, &sw, &ft) | |
let l:modeline = substitute(&commentstring, "%s", l:modeline, "") | |
call append(line("$"), l:modeline) | |
endfunction | |
nnoremap <silent> <leader>ml :call AppendModeline()<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment