[PLUG] vim question

Tony Rick tonyr42 at gmail.com
Sun Jun 10 03:24:43 UTC 2007


It depends on what you are trying to do: learn what >> is about,  learn how
to control
indenting more, or solve a particular indenting problem?

I like syntax highlighting, syntax sensitive indenting, 4 space tab stops,
and tabs
replaced with spaces automatically.  Here's my .vimrc:

  :syn on
  set tabstop=4
  set softtabstop=4
  set shiftwidth=4
  set expandtab
  autocmd BufRead *.py set smartindent
cinwords=if,elif,else,for,while,try,except,finally,def,class

You should read up on these and try any or all of them.  The 'autocmd' is
especially interesting.
In my example, 'autocmd' applies an automatic indent after a newline
following one of the
syntax keyword phrases in Python (specified by  *.py and cinwords in the
command definition).
There is apparently a smarter indent control setting 'cindent' for c/c++
code that will indent and
unindent automatically based on syntax.  I've never tried that one, either.

>From my reading of the vim Help file, >> is a 'shift' command macro, not a
tab insert, meaning,
approximately, shift the current line 'tabstop' spaces to the right.  It can
take a number argument,
>><number>, meaning 'apply this shift command to <number> lines'.  There is
another version,
><motion>, that I have never used, but maybe it means something like 'select
some number of
lines with the mouse/cursor' (?), and apply the shift'.

- tony


On 6/6/07, YAR Russ Gilman-Hunt <gilmanhunt at comcast.net> wrote:
>
> I've used vim for roughly ten years. I'm not particularly encouraged to
> try any other text editors, my fingers are just fine with input and
> command mode, tyvm.
>
> However, my vim use is rudimentary and I'm working on rounding it out
> with a few "new tricks." The one I'm working on now is "indenting a
> line with >> and unindenting it with <<"
>
> But I seem to be confused with some terminology. I want me indents on
> the sides to be tabs (when I hit enter, tab, to write the inside of a
> function) , and I want my >> to, basically, insert one tab on the side,
> but sometimes ( depending on which machine I happen to be working on)
> it doesn't seem to work that way.
>
> So I'm missing something, and it's probably a definition thing; if I
> have 'auto-indent' turned on, what's the name of the setting for
> this ... indent thing?
>
> --
> Russ Gilman-Hunt
> http://www.arghwebworks.com/
> gilmanhunt at comcast.net
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>



More information about the PLUG mailing list