Skip to content

Instantly share code, notes, and snippets.

@jordanorelli
Created August 31, 2011 05:59
Show Gist options
  • Save jordanorelli/1182910 to your computer and use it in GitHub Desktop.
Save jordanorelli/1182910 to your computer and use it in GitHub Desktop.
ftplugin/python.vim - python-specific vim settings.
" Python specific settings.
setlocal tabstop=4
setlocal shiftwidth=4
setlocal expandtab
setlocal autoindent
setlocal formatoptions=croql
nmap <F5> :w <CR> :!clear; python % <CR>
nmap <F6> :w <CR> :!python %
" set foldmethod=indent
let python_highlight_all=1
" Use the below highlight group when displaying bad whitespace is desired.
highlight BadWhitespace ctermbg=red guibg=red
" Display tabs at the beginning of a line in Python mode as bad.
au BufRead,BufNewFile *.py,*.pyw match BadWhitespace /^\t\+/
" Make trailing whitespace be flagged as bad.
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
@jordanorelli
Copy link
Author

put this in ~/.vim/ftplugin/python.vim and you're all set. (really it's $VIM/ftplugin/python.vim to be accurate)

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