Closed bfrg closed 2 years ago
An improvement would be to add
to the regex in the syntax match vim9MarkCmdArg, but I don't know if you want to further complicate the regex:
There are other locations where the plugin needs to allow for a keycode like <Bar>
, <CR>
. I think for those, <
is allowed. So, to be consistent, I did the same thing; I just allowed <
in this commit. Maybe, it's not accurate enough. But for now, that should be enough.
Thank you. It fixes the issue with the white space. But what about the backtick? It's still not contained in mark_vaild
.
It looks like the backtick doesn't even change anything. I thought it would also save the column position but that's not the case. Anyway, it's fixed as far as I'm concerned.
It looks like the backtick doesn't even change anything. I thought it would also save the column position but that's not the case.
Yes, most Ex commands operate linewise. They are not aware of the column cursor position, which is why I prefer the single quote as an argument in a :mark
command (it's less misleading). For a column-aware command, :normal
can be used instead (because it simulates a keypress):
v------------------v
nnoremap ]x <scriptcmd>execute 'normal! m`'<bar>range(v:count1)->map((_, _) => search('^\(<\\|=\\|>\)\{7}\([^=].\+\)\?$', 'W'))<cr>
The problem with execute 'normal! m`'
is that the count doesn't work anymore. I should probably just use a separate function after all.
Thanks anyway!
The problem with execute 'normal! m`' is that the count doesn't work anymore.
Not sure, but maybe :help v:prevcount
could help retrieve the old count.
I should probably just use a separate function after all.
Yes, as soon as the RHS becomes a little complicated, I turn it into a function; it's easier to read and maintain later.
I have quite a few motion mappings similar to the following:
Unfortunately, after the
mark
the syntax file highlights some parts of the RHS asvim9MarkCmdArgInvalid
.Screenshot:
Adding a
`
tomark_valid
fixes the issue, but only if we also add a whitespace before the<bar>
:An improvement would be to add
<bar>
to the regex in the syntax matchvim9MarkCmdArg
, but I don't know if you want to further complicate the regex: