This is an annoyance I've had for a long time.
(Nitpicky section: I prefer 4 space characters to tab characters. It's a lot easier to type "tab" instead of explaining that. When I say "tab", I mean "the action that happens when you press the tab key" which is probably more simply stated as "increase indentation".)
I'm using smartindent while editing a document where indentation has some significance. In "dumb" windows text editors I can press Shift+Tab to remove a tab or, more appropriately, decrease the indentation level of the current line. I can't figure out how to do this from edit mode in Vim; Shift+Tab seems to count just the same as Tab.
I know in Command mode <<
will decrease indentation. I want the equivalent in edit mode. These are the solutions I've found so far and why I don't like them, one in particular may be the key to the answer.
Maybe there's an option I can set? Maybe I can rebind left arrow to something? (If it requires rebinding please explain in detail; I've never delved into reconfiguring (g)Vim.
In edit mode: One more level, press tab. Going back one level, press backspace.
In normal mode, press Tab or Shift-Tab to adjust the indent on the current line and position the cursor on the first nonblank character; in insert mode, press Shift-Tab to unindent; in visual mode, press Tab or Shift-Tab to adjust the indent on selected lines.
Select what you want (typically with v or Shift + v ) then type 5> . If you need to fix or repeat the same selection, use gv . Show activity on this post. You can select the current line by pressing v , and then type 5> to indent the current line 5 times, the equivalent of pressing > 10 times.
You can use Ctrl+D to back up one tab stop. This actually moves the whole line to the left one tab stop; Ctrl+T does the same thing to the right.
Note that these keystrokes only work in Insert mode (use << and >> for the equivalent in Command mode).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With