PSU uses emacs?
Roland Schlenker
rol9999 at attglobal.net
Mon Jan 29 10:43:04 EST 2001
Ray Drew wrote:
>
> On Wed, 24 Jan 2001 07:18:19 -0800, Neil Schemenauer <nas at arctrix.com>
> wrote:
>
> >really necessary. Here is the Python line from my .vimrc:
> >
> > au BufEnter *.py set sw=4 sts=4 et ai cindent cino=(0 cinkeys=!^F,o,O tw=74
> >
> >The cindent options make Vim indent similarly to python-mode in
> >Emacs.
> >
> > Neil
> >
>
> I'm now running with au BufEnter *.py set sw=4 sts=4 et ai cindent
> cino=(0 cinkeys=!^F,o,O tw=74 in my _vmrc file, but this is the
> behaviour I'm getting...
>
> def fun(x): (1)
> if x: (2)
> y (3)
> else (4)
>
> after line 1, cursor is in leftmost position, I have to tab to indent
> the if block.
> after line 2, cursor under the i of if, I have to tab again for the
> next line.
> after line 3 , cursor is under the y. I now need to backtab for the
> else but can't use the backspace key to do it, I either have to hit
> the 'home' key to get to the start of the line and then tab my way
> back or switch to command mode and hit the 'h' key 4 times (or hit the
> left arrow key 4 times in 'insert' mode).
>
> The behaviour I'd like is for the cursor to autoindent for lines 2 and
> 3 and for the backspace key to move me back a tab in line 4. Can I get
> gvim to work like this?
>
> I've tried using si instead of ci and I've tried setting cinw to the
> python keywords that require indenting on the following line.
>
> I've got syntax on.
>
> Thanks for any help,
>
> Ray
set autoindent
set smartindent
set cinwords=class,def,elif,else,except,finally,for,if,try,while
syntax on
Ray, this should handle indents for Python correctly.
It does have a nasty habit of moving a line starting with a # to the
first cloumn. I have not figured how to stop that yet.
I believe if you set both expandtabs and backspace=2, the backspce key
will not remove the indent. Since the indent now is a number of spaces.
Roland Schlenker
More information about the Python-list
mailing list