Vim Folding and Python

Automatic Folding for python files: http://vim.sourceforge.net/scripts/script.php?script_id=515

Not so easy to get working I think. Need the following in the .vimrc file:

  1. autocmd FileType python so ~/.vim/ftplugin/python_fold.vim
  2. filetype plugin on
  3. set tabstop=4
  4. set shiftwidth=4
  5. set expandtab
  6. set smarttab

Lines 3 to 6 should be used anyway when coding in python. Any tabs in the code needs to be replaced with spaces so that the plugin can work.

Leave a Reply