Vim autoindenting broken?

Does anyone else find gVim 6.4 a bit unstable on Windows XP? It’s
become my editor of choice since learning it recently but I’m noticing
some peculiar behavior. Last night I spontaneously lost the “Edit in
vim” context-menu option, at the same time as its autoindenting feature
changed on its own.

So I can confirm what’s going on, what options control the
autoindenting?

The behavior I want is for it to indent two spaces after I type
something like

x = Fred.new(
indent like this.

and hit Enter.

What I’m seeing is that it indents to the point of the open parenthesis.

x = Fred.new(
indent like this.

I’m not sure what options govern this or why it changed, because it was
behaving properly yesterday and I haven’t altered the _vimrc options.

Thanks,
Jeff

Jeff C.man wrote:

something like

I’m not sure what options govern this or why it changed, because it was
behaving properly yesterday and I haven’t altered the _vimrc options.

Thanks,
Jeff

I have not tried 6.4, but I can say 6.3 is fine on XP. There hasn’t
really been a new feature that I use in vim since 5.0, so I don’t care
about having the latest.

~S

Jeff C.man wrote:

something like

I’m not sure what options govern this or why it changed, because it was
behaving properly yesterday and I haven’t altered the _vimrc options.

Thanks,
Jeff

I don’t know about your situation, but the latter is what it does for me
in both vim 6.2 and 6.4, on osx and linux respectively. I didn’t realize
it was doing this, I seem to remember the former behavior, however I
prefer the latter behavior so I’m not complaining. I’ve in fact wondered
how to get it in the past. Not sure if this is a recent ruby-vim change
or a recent vim change, but if a vim change it’s been around since 6.2
at least.

Jeff C.man wrote:

Does anyone else find gVim 6.4 a bit unstable on Windows XP? It’s
become my editor of choice since learning it recently but I’m noticing
some peculiar behavior. Last night I spontaneously lost the “Edit in
vim” context-menu option, at the same time as its autoindenting feature
changed on its own.
I use vim 6.4 all day at work and haven’t noticed anything strange, the
edit in vim context menu is always there for me.

So I can confirm what’s going on, what options control the
autoindenting?

If you look in your vim directory under program files, (in the vim64
folder I belive), you’ll see a directory entitled indent, (or something
like that). There should be a file in there like ruby.vim. I’m pretty
sure this is where the indentation for ruby is controlled from.

The behavior I want is for it to indent two spaces after I type
something like

x = Fred.new(
indent like this.

and hit Enter.

I do this by inserting the lines
set shiftwidth=2
set tabstop=2
set softtabstop=2
set expandtab

in the aforementioned ruby.vim in the indent directory

What I’m seeing is that it indents to the point of the open parenthesis.

x = Fred.new(
indent like this.

I’m not sure what options govern this or why it changed, because it was
behaving properly yesterday and I haven’t altered the _vimrc options.

Thanks,
Jeff

Hope this helps,
Gary

PS, this probably doesn’t matter, but I always insert those lines at the
bottom of the file so they don’t get overridden by options that appear
earlier in the file.

Gary

Thanks all,

I’m not sure what happened with the context menus, reinstalling gVim did
the trick.

I do have another question about vim’s indenting in .rhtml files. I
find that it tends to shift my lines to places I don’t want them, making
it hard to keep by program and HTML blocks organized visually. I even
turned off the auto- and smartindent options in rhtml files, but I still
noticed the same behavior.

Often I’ll be typing on a line and while I’m typing it will shift the
line backward a tab stop. Any ideas on how to keep it from doing this?

Thanks again,

Jeff

I do this by inserting the lines
set shiftwidth=2
set tabstop=2
set softtabstop=2
set expandtab
I generally prefer vim to gvim, but on dos I do go to gvim as it can be
quicker to get to than opening a monad shell or the like. I too put the
set directives at the bottom of the vimrc file, also important if you’re
going to turn your work over to clients or if you have others who edit
your files is to put important directives at the top of the file so
others don’t mess up your settings, this is the one that I like:

vim: set expandtab tabstop=2 shiftwidth=2 foldmethod=marker:

That way it comes back to you the way you want it no matter which vimrc
file it was edited under…

Good Luck with vi, it’s served me well
Alan