#StackBounty: #vimscript Un-tab the cursor

Bounty: 200

Is there a way in vim to move backwards a tab as it does move forward a tab? For example, if my line is:

 *   *   *   *   *   *
 hello     |      =      4
           ^ 
           ^
           cursor is here

If I pressed [tab] it would go to the next tabstop, so:

 *   *   *   *   *   *
 hello       |      =      4
             ^ 
             ^
             cursor is here

How would I do un-tab, so my cursor would go here:

 *   *   *   *   *   *
 hello   |      =      4
         ^ 
         ^
         cursor is here

Note: I’m not looking for a >>/<<, or ctrl-d/ctrl-t, which tabs or untabs the entire line. I only want from the cursor position forward.

Update: I added a bounty for this question. I’d like to see how to add a ‘forward-delete’ with ctrl-d and a backward-delete with delete. Here is an example from TextMate: https://gyazo.com/c16d903c1a28c307e3875d9fdf11fe60

The closest I could find is:

*i_CTRL-I* *i_<Tab>* *i_Tab*
<Tab> or CTRL-I Insert a tab.  If the 'expandtab' option is on, the
    equivalent number of spaces is inserted (use CTRL-V <Tab> to
    avoid the expansion; use CTRL-Q <Tab> if CTRL-V is map


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.