Skip to content

Instantly share code, notes, and snippets.

@ijt
Created October 27, 2010 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ijt/650222 to your computer and use it in GitHub Desktop.
Save ijt/650222 to your computer and use it in GitHub Desktop.
vimrc
syntax on
" Indentation
"
filetype indent on
function! Spaces()
set expandtab
set shiftwidth=4
set softtabstop=4 " Backspace deletes 4 spaces
set tabstop=4
endfunction
function! Tabs()
set noexpandtab
set shiftwidth=8
set tabstop=8
endfunction
:map \tabs :call Tabs()<CR>
:map \s :call Spaces()<CR>
call Spaces()
" Don't leave junk files around.
"
set nobackup
set nowritebackup
set noswapfile
" Open files in the same directory.
"
set autochdir
" Don't show pyc files in NERDTree.
"
let NERDTreeIgnore=['\.vim$', '\~$', '.pyc$']
" Ignore case in searches.
"
set ignorecase
" vimrc
"
map \ev :e ~/.vimrc<CR>
map \so :so ~/.vimrc<CR>
" Notes
"
" New Note
map \nn 0Go<ESC>:r!date<CR>o<ESC>
" edit Today's Notes
map \tn :e ~/todays-notes<CR>
" Vsplit Today's Notes
map \vtn :vsplit<CR>:e ~/todays-notes<CR>
" Tags
"
set tags=./tags,../tags,../../tags,../../../tags,../../../../tags
map \l :TlistToggle<CR>
" rope
let $PYTHONPATH .= ":/home/ijt/.vim/ropevim"
let ropevim_vim_completion=1
let ropevim_extended_complete=1
" Omnicompletion for Python
"
autocmd FileType python set omnifunc=pythoncomplete#Complete
" Python
"
" Make test
map \mt :!make_test.py %<CR>
" Jump between test and tested
function! EditTest()
let testname = substitute(bufname("%"), ".py$", "_test.py", "")
execute ":edit " . testname
endfunction
function! EditTested()
let testedname = substitute(bufname("%"), "_test.py$", ".py", "")
execute ":edit " . testedname
endfunction
function! EditOther()
if bufname("%") =~ "_test.py$"
:call EditTested()
else
:call EditTest()
endif
endfunction
map \\ :call EditOther()<CR>
" Additions to Vim's filetype plugin for Python, to set up PyUnit as
" the 'compiler' for Python files.
" Set the errorformat.
compiler pyunit
" Set 'makeprg': this allows you to call :make on any .py file and
" run all of the unit tests in the current working directory.
" Ensure you have this file.
set makeprg=${HOME}/bin/alltests.py
" VCS
map \vd :VCSDiff<CR>
map \vc :VCSCommit<CR>
" Buffers
"
set hidden " Allow leaving unmodified buffers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment