Monday, September 14, 2020

Re: Tabs and spaces in autoindent mode

On 2020-09-14, Anton Shepelev wrote:
> Hello, all
>
> In autoindent and noexpandtab mode, Vim will sometimes
> repace a carefully chosen combination of tabs and spaces
> with another, in which all the spaces are replaced with tabs
> except a few trailing ones, corresponding to the remainder
> of dividing the indent width by tab width.
>
> The following example uses a tab width of 3 characters. Both
> the lines have a single level of indentation, but the second
> line is additionally aligned with the `source' inentifier
> above, using spaces. It looks thus:
>
> SomeTypeOfMine source,
> destination;
>
> If I denote tabs with `_' and spaces with `.' to show the
> indentation structure:
>
> ___SomeTypeOfMine source,
> ___...............destination;
>
> When, however, I add a third line, Vim replaces the
> alignment spaces with tabs:
>
> ___SomeTypeOfMine source,
> ___...............destination,
> __________________buffer;
>
> whereas I expect it not to interfere with my alignment and
> retain the tab-space combination:
>
> ___SomeTypeOfMine source,
> ___...............destination,
> ___...............buffer;
>
> Is it possible?

Try setting 'copyindent'. That should do what you want. See

:help 'copyindent'

HTH,
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200914172147.GA20505%40phoenix.

No comments: