Tuesday, February 25, 2025

Unexpected indentation with :left

Reading the help for :left, it says:

Sets the indent in the lines to [indent] (default 0).

However, it seems to do that indenting with N spaces rather than
respecting 'shiftwidth' and 'expandtab' settings.

Or do I just need to roll an independent solution? It's not as simple
as using

:{range}>>>>

because `:left` first removes all left-indentation before indenting.

The best I've been able to come up with is

:{range}le | {range}>>>>

With cpo-star in the default and using a linewise-visual-range, that
simplifies a bit to

:'<,'>le|*>>>>

While kinda-opaque, it does the Right Thing(tm)

Is there a way to get the indent-count parameter of `:left` to behave
like using the > motion (which respects 'shiftwidth' and 'expandtab')?

-tim

brought to my attention by this Reddit thread:
https://www.reddit.com/r/vim/comments/1ixcyt5/put_all_lines_in_visual_bloc_on_the_same_indent/

--





--
--
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 visit https://groups.google.com/d/msgid/vim_use/Z75b-2K2myS_L09M%40thechases.com.

No comments: