Wednesday, October 27, 2010

Re: For languages that end statements with semicolons: d$-1

On 10/27/10 04:42, Dotan Cohen wrote:
> Does VIM have an easy way to delete up to the last character of a
> line, not inclusive?

In addition to John's suggestions about text-objects (something I
use regularly and sets vim apart from many other editors I've
used), based on your Subject line, you can use the f/F/t/T
commands as your motion, so if you want to keep the semi-colon
(assuming you don't have compound statements or
semi-colons-in-strings) you can just issue

dt;

to delete from the cursor up-to-but-not-including the next
semi-colon. If you do have compound statements or ";" in
strings, you can take a visual tally and prefix with a count:

d3t;

(to delete to the 3rd semi-colon) if your line is something like

foo(X);bar("text;text");

with the cursor on "X" to transform it into

foo(;

Hope this helps too,

-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

No comments: