Friday, March 21, 2025

Re: BASH script: Indent with tabs, align with spaces

Thank you.

OK, in my .vimrc I added:

set listchars=eol:⏎,tab:>·,trail:-,space:␣,extends:>,precedes:<,nbsp:+
set ai ci
command -nargs=0 ArgIndent {
y | put # yyp in normal mode # stage 1
s!\v^\s+\zs(\S+\s+).*!\=repeat(' ', 1 + len(submatch(1)))!
}

Unfortunately it doesn't seem to work as expected:

#!/bin/bash⏎

this␣--example␣\⏎
>·······--example␣\⏎
>·······⏎

The correct result should be:

#!/bin/bash⏎

this␣--example␣\⏎
␣␣␣␣␣--example␣\⏎
-----⏎

Am I doing something wrong?

--
--
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/20250321081537.25569a16%40localhost.

No comments: