Cool Vim Tricks for Python (was: Webdev: the times, they are a changin'_

Andrew McNabb amcnabb at mcnabbs.org
Fri Apr 20 11:58:50 MDT 2012


On Fri, Apr 20, 2012 at 11:32:53AM -0600, Dave Smith wrote:
> As long as we're talking about cool vim tricks for Python, why not start a new thread.

1) Folding

I have found jpythonfold to be the best python fold script out there:

http://www.vim.org/scripts/script.php?script_id=2527

I use the following settings with folding:

set foldlevelstart=0
set foldopen=block,hor,jump,mark,percent,quickfix,search,tag,undo
autocmd FileType python setlocal foldlevel=1


2) Detecting indentation automatically

I also like to use detectindent:

http://github.com/ciaranm/detectindent

I use the following settings:

let g:detectindent_preferred_expandtab = 1
let g:detectindent_preferred_indent = 4

It doesn't work perfectly, but it's quite good.


3) IDE-like features

For the record, I tried ropevim and was disappointed.  So in my opinion,
ropevim is not a cool vim trick.  I'd be happy to hear from anyone who
has good experiences with it because it's likely I was just using it
wrong.

--
Andrew McNabb
http://www.mcnabbs.org/andrew/
PGP Fingerprint: 8A17 B57C 6879 1863 DE55  8012 AB4D 6098 8826 6868


More information about the PLUG mailing list