Monday, March 24, 2025

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

This:

set listchars=eol:⏎,tab:>·,trail:▪,space:␣,extends:>,precedes:<,nbsp:+
set ai ci noet
command -nargs=0 ArgIndent {
y y | put y
var s = @/
s!\v^\s*\zs(\S+\s+).*!\=repeat(' ', 1 + len(submatch(1)))!
@/ = s
}
inoremap \<cr> \<c-o>:ArgIndent<cr>


and typing your example gives me:


this␣--example␣\\⏎
--works␣\⏎
␣␣␣␣␣␣␣␣--fine▪⏎


However, if I type the '\\<cr>' fast, I get this:


this␣--example␣\\⏎
␣␣␣␣␣--works␣\▪⏎
␣␣␣␣␣␣␣␣␣␣␣␣␣--fine▪⏎


I wonder why it works for you and not for me.

I am running VIM on Debian 12:


$ vim --version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Feb 16 2025 05:23:41)
Included patches: 1-1378, 1499, 1532, 1848, 1858, 1873, 1969, 2142
Modified by team+vim@tracker.debian.org
Compiled by team+vim@tracker.debian.org
...

--
--
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/20250324093954.33b716c8%40localhost.

No comments: