Changing AWK indent behavior in VIM 7.



I recently upgraded to VIM 7. It was a "voluntary" upgrade and there
are some nice features that attracted me. However, one thing that is
annoying is the way it handles autoindent when writing AWK code.
Previously, it "just worked". What I think happened is that TPTB
decided to take the cindent conventions and extend them to other non-C,
but C-like languages (e.g., AWK). Now, in one sense, this could be a
good thing, but my conventions for writing code are different that what
TPTB think is standard. I've never liked the way VIM does C indenting,
but since I rarely write C, it hasn't been a problem. But now, they've
gone and screwed up the way it does AWK. Obviously, I'm looking for a
way to turn off the behavior/get things back to normal.

The problem is that it doesn't indent correctly. Or, to put it another
way, it is *too* familiar with the syntax of the language. Sometimes it
gets it right, but mostly, it gets it wrong. For example, if my cursor
is on:

if (...)

and hit o, I want the cursor to go to beneath the "i" in if. Now, it
moves me in a tab stop. This is relatively innocuous, but the next one
is a real PIA: Suppose I have:

BEGIN {
line1ThatStartsWithaTab
line2ThatStartsWithaTab

with my cursor on "line 1". I hit O to open a line above it and it puts
the cursor below the N in BEGIN. Clearly, hosed. Clearly, simple rules
of autoindent say that it should fill the line with a tab and leave the
cursor just above line1.

Now, I know that some of this is a function of my vimrc settings,
specifically, sw and ts. And I know my settings will not meet with
universal appeal, but that's not the point. The point is, it used to
work fine, and I'm pretty sure there is some setting I can tweak to make
it work normally again. Can anyone tell me what that setting is?

.



Relevant Pages

  • [Vim] - Cursor movement when in insert mode or cmdline mode (: or ex)
    ... I was wondering if there was any other way you can move the cursor in these two mode - insert mode especially.. ... or is the best strategy to just get used to escaping back to "normal" mode and use the more powerful vim cursor movement commands.. ...
    (comp.editors)
  • Re: Getting vim to work correctly.
    ... Home randomly capitalizes letters and shifts the cursor to the next letter. ... editor as vim in your ~/.bashrc. ... I get 'vim' and not what FreeBSD uses as vi by ...
    (freebsd-questions)
  • Re: Cursor position in opening Word 2007
    ... I actually get the correct sequence of letters. ... I just need to figure out a way to have Word open with the cursor "left ... and Windows keyboard settings. ... find it odd that changing language settings is considered popular, ...
    (microsoft.public.word.docmanagement)
  • Re: cursor and cookies
    ... > TweakUI, change it there, if not check your mouse settings under the Control ... > Troubleshooting Windows XP ... >> Before you tell me to just move my cursor back, I will say I don't want to ... >> setting for all cookies from that site, I will say that I don't always ...
    (microsoft.public.windowsxp.general)
  • Re: Great SWT Program
    ... None of the nasty things that you have said or implied about me are at ... Vim displays a message in status-bar... ... Of course not, but if screen takes over cursor positioning completely, ... the underlying app will become nigh-unusable. ...
    (comp.lang.java.programmer)