Tuesday, September 8, 2020

Re: Matching « and »

On 06/09/2020 14.15, gevisz wrote:
> What line(s) of code should I add to my vimrc so that ci« behave in
> the same way with respect to « and », as ci( behaves with respect to (
> and )?

It's not very easy but there are some plugins that ought to make it
possible, such as vim-textobj-user
(https://www.vim.org/scripts/script.php?script_id=2100) and CountJump
(https://www.vim.org/scripts/script.php?script_id=3130).

I made a quick attempt with CountJump and managed to make it somewhat
partially work:

I installed it by reading the .vmb.gz in Vim, doing :UseVimball, reading
ingo-library-1.042.vmb.gz from
https://www.vim.org/scripts/script.php?script_id=4433 and doing
:UseVimball again.

I then used
 :call CountJump#TextObject#MakeWithCountSearch('','z','ai','','«','»')
which apparently registered a new iz text object: after that "ciz"
changed a «» block such as
«
a
b
c
»

to
«
»

However, it didn't work with inline strings («abc») and it left the
borders of the block unaltered:
«12
a
b
c
34»
became
«12

34»
after "ciz".

And I didn't manage to make it work with "ci«" (by replacing the z with
a «), but of course I don't have a keyboard with that key, I typed it in
with "C-K <<", maybe it can be made to work with some kind of mapping.


Kind regards,

Gabriele



--
--
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 on the web visit https://groups.google.com/d/msgid/vim_use/d7f9caaf-388e-722f-888c-3c8f2fce38f2%40tiscali.it.

No comments: