mcwillig
mcwillig

Reputation: 223

vim smart tabbing

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?

Upvotes: 6

Views: 4245

Answers (3)

Amir Rachum
Amir Rachum

Reputation: 79685

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

Upvotes: 0

Vivek Pandey
Vivek Pandey

Reputation: 3555

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.

Upvotes: 0

Caleb
Caleb

Reputation: 5438

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

:set smarttab

Also consider setting:

:set smartindent
:set autoindent

Upvotes: 6

Related Questions