If there is only whitespace to the left of the cursor position and there is additional whitespace to the right, pressing tab first jumps to the end of the line and then inserts another indentation level.
If there are some non-whitespace characters to the left or right of the cursor, the tab is inserted at the present cursor location (and the cursor doesn’t jump to the end of the line). This is how Sublime works all the time.
I would like the behavior to be the same no matter what: a tab is inserted at the present cursor location without ever jumping to the end of the line.
(Below, “|” is the cursor location, “----” is relevant whitespace)
TAB with whitespace to the left and right
<div> <div> |---- </div> </div>
… press TAB
<div> <div> --------| <--- whitespace inserted at end of line, including whitespace that existed </div> </div>
TAB with characters to the left and whitespace to the right
<div> <div> hello|---- </div> </div>
… press TAB
<div> <div> hello----|---- <--- whitespace inserted at cursor location </div> </div>
I almost can get the behavior that I want by changing the tab key to be
editor:indent-selected-rows with two exceptions:
- I can no longer insert a tab in the middle of a line, and
- I can no longer insert a tab on an empty line.
Is there any way to get tab behavior I prefer?