Friday, February 26, 2021

Re: How to delete from the current cursor position to a particular character on the same line?

On Fri, 26 Feb 2021, Joseph Wulf <joseph.c.wulf@gmail.com> wrote:
> I've a common problem that I've never been able to find a solution for.
...
> With my cursor at "B" how can I delete from the current cursor position
> (col 18) to the first double-quote mark (") efficiently?

Delete up to a quote mark later in the line:
dt"

Delete up to the third quote mark later in the line:
d3t"

Delete up to a quote mark earlier in the line:
dT"

Delete up to and including a quote mark:
df"

Delete up to and including a quote mark earlier in the line:
dF"

Delete up to and including the second quote mark earlier in the line:
d2F"

Delete forward using a repeat of last to or including search:
d,

Delete backward using a repeat of last to or including search:
d;

Delete to column 40 (either forward or backward):
d40|

I'm a frequent user of the f/F/t/T motions. Often one or the other is
the better choice to use due to frequency of characters used and
context.

In shell scripting, say, I may want to change {foo} to {bar} and
sometimes it will be in single quotes and sometimes double quotes, so
I'll use c2fo with the cursor on the {f} and then the . command works
properly.

Other times I'm changing a bunch of variable names all terminated at
the = to new different names, so I'll use ct= first and c; later.

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 vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/4DnJwm6Pb7zfYm%40panix5.panix.com.

No comments: