i want >
/ <
and >>
/ <<
to simply insert and remove tab characters at the beginning of the line.
variant: i would even prefer to have
>
/<
and>>
/<<
insert / remove a tab character at the position of the last tab character of each line within the selection (defaulting to the first character of each line within the selection whenever none such tab character is found).
can i change their behaviour to do so?
example. denoting tabs as ›–––
and spaces as ·
, say i have some text like the following.
›–––··A
›–––······B
›–––····C
i have preserveindent
set. selecting all three lines in visual mode and pressing >
thus far yields the following.
›–––··›–··A
›–––······›–··B
›–––····›–––C
clearly i want it to be as follows.
›–––›–––··A
›–––›–––······B
›–––›–––····C
variant. the variant allows to indent in a more reasonable way some text with a preceding comment # …
like the following.
›–––··A
›–––······B
#›––····C
indenting the three lines by pressing >
is then supposed to yield the following.
›–––›–––··A
›–––›–––······B
#›––›–––····C
context. it appears that vim/neovim does something way more complicated, namely to compute the indentation level of each line by counting its leading tabs and spaces, then increase / decrease this indentation level and finally indent the entire line fully anew by inserting a number of first tabs, then spaces corresponding to the freshly increased / decreased indentation level.
so this messes up the indentation structure when using “tabs for indentation, spaces for alignment”.
if preserveindent
is on, it seems that indentation is increased / decreased by inserting a mixture of first spaces, then tabs right before the first non-white-space character, which is again way more complicated than what i want.
i want this for a sane configuration for using tabs as indentation, spaces as alignment; this is a follow-up to a previous question about leading tabs.