Created
August 30, 2011 17:24
-
-
Save billyvg/1181419 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
set tabstop=4 | |
set shiftwidth=4 | |
set softtabstop=4 | |
set expandtab | |
set history=1000 | |
set foldmethod=marker | |
set hidden | |
set backspace=indent,eol,start " Allow backspacing over everything in insert mode | |
set showcmd " Show (partial) command in status line | |
set autowrite " Automatically save before commands like :next and :make | |
set background=dark | |
" Undo in Insert mode (Ctrl+z) | |
map <c-z> <c-o>u | |
" remap omni-complete to ctrl+space | |
inoremap <C-space> <C-x><C-o> | |
" ** Functions ** | |
" Function for cleaning up tabs and spaces | |
function! RemoveTrailingSpaces() | |
%s/\s\+$//e | |
%s/ | |
//ge | |
endfunction | |
function! ConvertTabsToSpaces() | |
%retab | |
endfunction | |
function! CleanFile() | |
call ConvertTabsToSpaces() | |
call RemoveTrailingSpaces() | |
endfunction | |
" Key binding \f to clean up file | |
nmap <silent> <leader>F <Esc>:call CleanFile()<CR> | |
" Python-specific settings | |
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class | |
autocmd BufWritePre *.py normal m`:%s/\s\+$//e `` | |
autocmd BufRead *.py set makeprg=python\ -c\ \"import\ py_compile,sys;\ sys.stderr=sys.stdout;\ py_compile.compile(r'%')\" | |
autocmd BufRead *.py set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m | |
autocmd FileType python set omnifunc=pythoncomplete#Complete " Code completion | |
au BufRead,BufNewFile *.json set filetype=json | |
nnoremap <esc> :noh<return><esc> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment