Steven, On Tue, Mar 25, 2025 at 04:14:16PM -0000, Steven H. wrote: > Say, we start with: > > this␣--one␣--two␣--three⏎ > > and the cursor is on the space right after '--one'.
Indeed an interesting question! I had use a new approach to do that regards vim9script # We want to travel from this # # 1 2 3 4 # ( I W B ) # E # # to this # # 1 \r # I w E # # I(dent) W(ord, the 1st one and its trailing space) # B(egin) and E(nd) of the content split by the # #(cursor) so the capture here is: # w is the result of repeat(' ', len(W)) # # KNOWN BUG: # * at least one space is required at the end of line. # (TODO fix with an alternative? like %#$?) # NOTE: # * If you want ArgIndentRhs to stay generic, all extra chars # like \\ should be appended from the imap var ArgIndentRhs = () => submatch(1) .. "\r" .. submatch(2) .. repeat(' ', len(submatch(3))) .. submatch(4) command -nargs=0 ArgIndent s!\v^((\s*)(\S+\s*).*%#)(.*)!\=ArgIndentRhs()! inoremap \\<cr> \<c-o>:ArgIndent<cr> set ai ci noet -- Marc Chantreux -- -- 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+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_use/Z-PUhjq-BtH6yFMB%40prometheus.