On 2025-03-22, Anton Shepelev wrote:
> Steven H. to Anton Shepelev:
> 
> > > No, you do not need any plugins for that.  I have been
> > > indenting with tabs and alighning with spaces for years,
> > > with just copyindent:
> >
> > How exactly do you do this?  Could you please share your
> > setup (relevant .vimrc lines)?
> 
> Beg pardon for the misinformation, folks.  I had not used
> Vim to program in tabs+spaces mode in a long time, and now I
> see that I cannot make it respect my indentation and
> alignment with any standard settings.
> 
> The correct action for indent/unindent should affect the
> initial tab on the line, leaving intact whatever spaces may
> occur furher to the right. Vim's < and > do not seem able to
> do that by default.  I don't understand why `preserveindent'
> adds tabs /after/ my spaces, and wish Vim would support this
> simply and natural indentation mechanism without custom
> scripting.

I don't think it's obvious that using < or > should remove or add
white space at the beginning of the line.  My mental model has
always been that the white space was deleted or inserted immediately
to the left of the first non-blank character in the line.  That also
agrees with the Vim help description of those commands, which is to
shift lines leftwards or rightwards, not to decrease or increase the
indent.

Also see the description of 'shiftround'.  There again the viewpoint
is of moving the first non-blank character rather than decreasing or
increasing the indentation.

Both viewpoints are useful.

I agree that adding tabs after spaces seems wrong, even considering
this note in ":help 'preserveindent'":

    NOTE: When using ">>" multiple times the resulting indent is
    a mix of tabs and spaces.  You might not like this.

Regards,
Gary

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_use/20250321233714.GB30799%40phoenix.

Reply via email to