delete until

26 views
Skip to first unread message

Mathieu Roux

unread,
May 18, 2019, 11:27:16 AM5/18/19
to vim...@googlegroups.com
Hello,
If i want to delete on my current line until say "a", i can do dfa.
If i do that, "a" is deleted.
Is there any command do delete strictly before a?
For exemple, if i am on the beginning of the line:
"star", i want to obtain "ar", and "not "r".

:he search-commands
did not give me the answer.

Best regards,
Mathieu Roux

Stefan Klein

unread,
May 18, 2019, 11:35:00 AM5/18/19
to vim...@googlegroups.com
Hi,

Am Sa., 18. Mai 2019 um 17:27 Uhr schrieb Mathieu Roux <mth...@gmail.com>:
If i want to delete on my current line until say "a", i can do dfa.
[ ... ]
"star", i want to obtain "ar", and "not "r".

i guess you're looking for t(o) instead of f(orward)

regards,
Stefan
 

Grant Taylor

unread,
May 18, 2019, 12:52:10 PM5/18/19
to vim...@googlegroups.com
On 5/18/19 9:34 AM, Stefan Klein wrote:
> i guess you're looking for t(o) instead of f(orward)

Agreed.

I've frequently seen it referred as (un)t(il). (I think that's what I
see in vim :help.)

Mathieu Roux

unread,
May 19, 2019, 5:16:28 AM5/19/19
to vim...@googlegroups.com
Thanks! that is exactly what i want!
> --

Mathieu Roux

unread,
May 19, 2019, 1:21:58 PM5/19/19
to vim...@googlegroups.com
hmmmm....

and how can i say?: go to the next /, and if you don't find it, go to
the next '

For exemple, if i am at the beginning of the string
'abc/def/ghi',
it should go to /
and if i am on "g" on the same string, it should go to '

In fact i want to map this command to <F5>.

map <F5> f('|/)v0*

quelque chose comme ça...

Best regards,
Mathieu Roux
> --
> --
> 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+u...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vim_use/CAA%3DcwqFXFu2wYdWPxDo3YBdbpjvCCQ5F0WKb4r2iBAHCmF-FpA%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.

Tim Chase

unread,
May 19, 2019, 5:04:01 PM5/19/19
to vim...@googlegroups.com
On 2019-05-19 19:21, Mathieu Roux wrote:
> and how can i say?: go to the next /, and if you don't find it, go
> to the next '
>
> For exemple, if i am at the beginning of the string
> 'abc/def/ghi',and some /
> it should go to /
> and if i am on "g" on the same string, it should go to '
>
> In fact i want to map this command to <F5>.
>
> map <F5> f('|/)v0*

Might try something like this?

nnoremap <f5> /\%#.\(.\{-}\/\<bar>[^\/]*'\)/e<cr>

-tim


Tim Chase

unread,
May 19, 2019, 5:21:41 PM5/19/19
to Tim Chase, vim...@googlegroups.com
The way you described the problem, it sounded like you wanted to
go forward to the next slash even if there was an intervening "'"
char:

this 'is/a/firstpath' and this 'is/another/path'

where, if your cursor was on the "f" of "firstpath", you wanted to
jump to the next slash (after the second "is") instead of the
single-quote at the end of "firstpath". So that's what the solution
in my previous email does. However, if you just want a "go to the
next slash-or-single-quote, whichever is next" it's a lot tidier:

nnoremap <f5> /[/']/<cr>

-tim
> --
> --
> 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+u...@googlegroups.com. To view this discussion on
> the web visit
> https://groups.google.com/d/msgid/vim_use/20190519160353.4abf9eb2%40bigbox.christie.dr.

Mathieu Roux

unread,
May 20, 2019, 7:01:52 AM5/20/19
to vim...@googlegroups.com, Tim Chase
Wonderful!

This is exactly what i wanted...

map <f5> /[/']/<cr>hvF'*

Thanks a lot !
> --

Reply all
Reply to author
Forward
0 new messages