Matching « and »

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Matching « and »

Gevisz
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 )?

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CA%2Bt6X7dve8aOz5JoREJFkrzXu9ZAmPAT1AYcYGbv_MJDS4SE%2BQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Matching « and »

Gabriele Fava
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/d7f9caaf-388e-722f-888c-3c8f2fce38f2%40tiscali.it.
Reply | Threaded
Open this post in threaded view
|

Re: Matching « and »

Gabriele Fava
On 09/09/2020 0.26, Gabriele wrote:
>  :call CountJump#TextObject#MakeWithCountSearch('','z','ai','','«','»')

Ooops, I pasted the wrong command, and trying the correct one which is:
:call CountJump#TextObject#MakeWithCountSearch('','z','ai','v','«','»')

I realized that it works a lot better than I reported in the other mail,
it works correctly inline just as ci( does!!!

I think I made the previous test with 'V' in place of 'v'...

So, this does seems to work well, if you can forgo using '«' for the
textObjectKey (or if your keyboard has that key, or you figure out a
mapping or other way to make it work)


Kind regards

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/b8f55d72-d5fc-56a7-1498-be661578ec23%40tiscali.it.
Reply | Threaded
Open this post in threaded view
|

Re: Matching « and »

Gevisz
ср, 9 сент. 2020 г. в 01:46, Gabriele <[hidden email]>:

>
> On 09/09/2020 0.26, Gabriele wrote:
> >  :call CountJump#TextObject#MakeWithCountSearch('','z','ai','','«','»')
>
> Ooops, I pasted the wrong command, and trying the correct one which is:
> :call CountJump#TextObject#MakeWithCountSearch('','z','ai','v','«','»')
>
> I realized that it works a lot better than I reported in the other mail,
> it works correctly inline just as ci( does!!!
>
> I think I made the previous test with 'V' in place of 'v'...
>
> So, this does seems to work well, if you can forgo using '«' for the
> textObjectKey (or if your keyboard has that key, or you figure out a
> mapping or other way to make it work)
>

Thank you. I will try it.

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CA%2Bt6X7cBcMC5J7CnRUgq2RsWWOqADvkCOkG3kdSradrmGRqOSQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Matching « and »

Eli the Bearded
In reply to this post by Gevisz
gevisz <[hidden email]> 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 )?

Hmmm. "set matchpairs=(:),{:},[:],<:>,«:»" works fine for %, but it
appears that i(, i<, i{, a(, and the like are special movements, not
just keying off matchpairs.

Would it be possible to make the iX and aX family of motions use that
setting too? That's probably the more general fix.

Elijah

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/4BmzSq3KVLzfYm%40panix5.panix.com.
Reply | Threaded
Open this post in threaded view
|

Re: Matching « and »

Christian Brabandt

On Mi, 09 Sep 2020, Eli the Bearded wrote:

> gevisz <[hidden email]> 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 )?
>
> Hmmm. "set matchpairs=(:),{:},[:],<:>,«:»" works fine for %, but it
> appears that i(, i<, i{, a(, and the like are special movements, not
> just keying off matchpairs.
>
> Would it be possible to make the iX and aX family of motions use that
> setting too? That's probably the more general fix.

There is a patch floating around, to easily define text objects
delimited by the same character. I believe the latest version is here:
https://github.com/vim/vim/pull/958

But that does not handle a begin/end separator character.

Best,
Christian
--
Hardware scheppert, wenn man dagegen tritt.

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200910073608.GE8698%40256bit.org.