Tuesday, September 4, 2018

Re: How do I delete from the end of the line through space (up to) the first word?

On 2018-09-04 17:52, 'Grant Taylor' via vim_use wrote:
> On 09/04/2018 05:27 PM, Gary Johnson wrote:
> > The best way to move to the first space on a line is to move to
> > the start of the line, then find the next space to the right.
> > The best solution to your problem that I know of would be this:
> >
> > ^f D
>
> Interesting idea. It makes perfect sense.
>
> It also solves the problem as I described it.
>
> I would still like to know how to delete backwards {t,T}o a word,
> not {f,F} on a character I'd like to keep.
>
> I've got all sorts of things like the following:
>
> aaa bbbb ccccc ddd eeeeeee ffff
>
> Where the cursor is on the last f and I want to delete from the
> last f up to but not including the last d. I.e. "Td".

But "dTb" does keep the character under the cursor. If you're at
the end of the line and *do* want to delete the character under the
cursor, you can use

vTbd

to use character-wise visual mode or

TbD

to position first and then delete to the end of the line (slightly
different behaviors if the cursor isn't at the end of the line).

There are lots of options depending on how much you want to do
manually vs. automatically, as well as how easy it is to identify the
matches in question.

-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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: