vim smart tabbing
Asked Answered
C

3

6

In emacs, whenever tab is pressed, the cursor moves to the appropriate location on the current line. However, in vim, this does not happen, the tab is a given length and will go that far every time I press tab. Is there a way to enable "smart tabbing" in vim?

Caesarism answered 11/5, 2011 at 18:8 Comment(0)
R
6

I'm not exactly sure what behavior you expect, but this is probably it.

:set smarttab

Also consider setting:

:set smartindent
:set autoindent
Ramunni answered 11/5, 2011 at 18:12 Comment(1)
Also :set cindent which, per manual, works sometimes better but is more strict.Casar
H
0

I assume your question is the following. You have text like:

This is line 1

$ (lots of white space) This is line 2

This is line 3

Now, you are in normal mode, your cursor is after $, and you would like it get just before T. If so, just press 'w' (to traverse a 'w'ord) and you would achieve your objective.

Hunnicutt answered 11/5, 2011 at 18:30 Comment(1)
I'm sorry, I should clarify, in vim, when appending a file, whenever I hit tab, can it 'auto tab' where it should be? Like in an if/else block, after the bracket, in emacs, whenever I hit tab, it will tab over until I am under the bracket or lined up with the line under the if statement.Caesarism
W
0

Perhaps you just want to use == to auto-indent the current line.

Winterize answered 11/5, 2011 at 21:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.