Personal tools
You are here: Home Storage vim setup for python programmers / developers

vim setup for python programmers / developers

Posted by Rafal Zawadzki at Jun 24, 2010 06:30 PM |

some tips for python and vim users

Coloured syntax, proper indentation, replace tab with four spaces:

autocmd BufRead,BufNewFile *.py set syntax=python
autocmd BufRead,BufNewFile *.py set smartindent tabstop=4|set shiftwidth=4|set expandtab
autocmd FileType python set tabstop=4|set shiftwidth=4|set expandtab smartindent

Some tips about navigation (http://python.about.com/b/2007/09/26/vi-tips-for-python-programmers.htm):

  • [[: Go to the beginning of block
  • ]]: Go to the end of block
  • ]v: Select the current block
  • ]<: Shift the block to left
  • ]>: Shift the block to right
  • ]#: Comment the selection
  • ]u: Uncomment the selection
  • ]c: Select the current/previous class
  • ]f: Select the current/previous function
  • ]: Jump to the previous line with the same/lower indentation
  • ]: Jump to the next line with the same/lower indentation

Above navigations needs python plugin to work: http://www.vim.org/scripts/script.php?script_id=30

Comments (0)