Saturday, March 22, 2025

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

Marc,

I think some correction of the implementation of the algorithm may be
necessary, otherwise editing existing code does not auto-align next
line.

Perhaps:

> if (Enter is pressed after a single backslash); then

^^ Currently that condition is checked through be the key mapping of
'\<cr>' but when editing existing code, pressing Enter after an
*existing* backslash does not run your function.

I don't know if it is possible to map the function to '<cr>', then
(considering how it currently works by copying the line) make it:

> go to new line
> preserve the indentation and alignment of the previous line

delete trailing backslash

> add spaces to align to the second word in the previous line
> # word: anything that is not white space
> fi

What do you think?



On Sat, 22 Mar 2025 06:35:08 -0000 Steven H. wrote:

> P.S. Speaking of duplication: I don't know why but I always receive
> each of your messages twice. :)

I think the reason is that (I see that in your messages only):

To: vim_use@googlegroups.com
Cc: vim@vim.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/20250322071137.2d4ddf26%40localhost.

No comments: