Quantcast

textobj-lastpat plugin: text object not capturing last character of the match?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

textobj-lastpat plugin: text object not capturing last character of the match?

zpkarol
Hi guys, does anyone use textobj-lastpat plugin?

http://www.vim.org/scripts/script.php?script_id=2355

I tried it and it seems to have a bug: the text object omits the last character in a match.
For example, if I start with the following text

foo bar baz

Then I do

/bar<CR> 

The word "bar" is highlighted and the cursor is at first "b" character (as expected), but when I try, say

da/

I end up with this

foo r baz

I would expect the following result:

foo  baz

Is this behavior correct? And if so, how can I achieve what I want, i.e. have a text object that encompasses the whole match?

Thx for help!
Karol
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: textobj-lastpat plugin: text object not capturing last character of the match?

Ben Fritz
On Friday, December 28, 2012 2:06:56 PM UTC-6, zpkarol wrote:

> Hi guys, does anyone use textobj-lastpat plugin?
>
>
>
> http://www.vim.org/scripts/script.php?script_id=2355
>
>
>
> I tried it and it seems to have a bug: the text object omits the last
>
> character in a match.
>
> For example, if I start with the following text
>
>
>
> foo bar baz
>
>
>
> Then I do
>
>
>
> /bar<CR>
>
>
>
> The word "bar" is highlighted and the cursor is at first "b" character (as
>
> expected), but when I try, say
>
>
>
> da/
>
>
>
> I end up with this
>
>
>
> foo r baz
>
>
>
> I would expect the following result:
>
>
>
> foo  baz
>
>
>
> Is this behavior correct? And if so, how can I achieve what I want, i.e.
>
> have a text object that encompasses the whole match?
>
>
>
> Thx for help!
>

Is your 'selection' option set to 'exclusive'? (This is the default if you have "behave mswin" in your .vimrc). This option causes problems in a *lot* of plugins. Try setting 'selection' to "inclusive". If the problem goes away, alert the plugin maintainer.

--
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: textobj-lastpat plugin: text object not capturing last character of the match?

Christian Brabandt
In reply to this post by zpkarol
Hi zpkarol!

On Fr, 28 Dez 2012, zpkarol wrote:

> Hi guys, does anyone use textobj-lastpat plugin?
>
> http://www.vim.org/scripts/script.php?script_id=2355
>
> I tried it and it seems to have a bug: the text object omits the last
> character in a match.
> For example, if I start with the following text
>
> foo bar baz
>
> Then I do
>
> /bar<CR>
>
> The word "bar" is highlighted and the cursor is at first "b" character (as
> expected), but when I try, say
>
> da/
>
> I end up with this
>
> foo r baz
>
> I would expect the following result:
>
> foo  baz
>
> Is this behavior correct? And if so, how can I achieve what I want, i.e.
> have a text object that encompasses the whole match?

recent Vim version have something like this almost build in. Use dgn to
delete the next match.

regards,
Christian
--
Computerviren verbreiten sich prinzipiell ├╝ber >>garantiert unverseuchte<<
Disks.

--
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: textobj-lastpat plugin: text object not capturing last character of the match?

zpkarol
In reply to this post by Ben Fritz
> Is your 'selection' option set to 'exclusive'? (This is the default if you have "behave mswin" in your .vimrc).
> This option causes problems in a *lot* of plugins. Try setting 'selection' to "inclusive".
> If the problem goes away, alert the plugin maintainer.

Yep, that was it. Many thanks! I will try to get in touch with the maintainer (Kana Natsuno).
Loading...