Re: vim indent file question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Yohann,

On Mon, 2004-02-09 at 17:09, Yohann Desquerre wrote:
> hi all,
> 
> 
> I 'd to configure vim to work well with python,

To answer your question more generally...

You might try installing python.vim in your path:
http://vim.sourceforge.net/scripts/download_script.php?src_id=2187

and using a ~/.vimrc along the lines of:
====================================================================
" Set options for python files
autocmd FileType python set autoindent smartindent
   \ cinwords=class,def,elif,else,except,finally,for,if,try,while
   \ makeprg=compyle4vim.py
   \ errorformat=%E\ \ File\ \"%f\"\\,\ line\ %l\\,\ column\ %c,%C%m |
   \ execute "autocmd BufWritePost " . expand("%") . " call DoPython()"
                                                                                                                                                        
" Compile (clearing *.cgi[co] files after compilation)
" and if it is script, make it executable
function DoPython()
   !compyle %
   if expand("%:e") != "py"
      !rm -f %[co]
   endif
   if getline(1) =~ "^#!"
      !chmod +x %
   endif
endfunction

set nu
set tabstop=8
set softtabstop=4
set expandtab
set sw=4
set ai
set nowrap
set sidescroll=60
set sidescrolloff=5
set ch=2
set sb
set ffs=unix,dos,mac
set bk
set ar
set foldmethod=indent
set foldminlines=4
source your_path_to/python.vim
set et
"ascii-187==»
set lcs=tab:»\
set popt=paper:letter
set showmatch
===============================================================

Can't remember who to credit this setup to (I also took from a mailing
list message) but it works well for me.

Cheers, C.
-- 
Cymon J. Cox <cymon@xxxxxxxx>




[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux