LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] vi goodies

[ILUG] vi goodies

Colm Buckley colm at tuatha.org
Fri Jun 9 12:16:00 IST 2000


Donncha writes:

> Just deleted some lines in a file and discovered this nugget which
> someone might find handy..

> Search for a word using the usual "/" way.
> Then, in command mode, press "d" to delete and type "/<RETURN>" and
> it'll delete to the next occurance of the previous searched for word..
> Of course, you could do "d", and then "/searchword" to delete from the
> current position to position of "searchword" too which is much the same. 
> Makes sense since you can do dw,db,dk, etc..

Actually, this is part of a *really* powerful vi feature.  You can
follow 'd' by *any* movement command and it'll delete the range covered
- between the point you start at and the point you end at.

Examples :

    dG            delete from here to the end of the file
    d1G           delete from here to the start of the file
    d}            delete from here to the end of the paragraph
    d5w           delete 5 words
    d20h          delete 20 characters to the left
    d/echo<RET>   delete to the next occurrence of the word 'echo'

This also works for the 'y' command (yank) - 'd' is to 'cut' what 'y' is
to 'copy'.

vi is a *very* powerful editor; a lot more so than people give it credit
for.

           Colm

-- 
Colm Buckley BA BF | NewWorld Commerce, 44 Westland Row, Dublin 2, Ireland
colm at tuatha.org (personal) | colm.buckley at nwcgroup.com (business)
+353 87 2469146 | whois cb3765 | http://www.tuatha.org/~colm/
Can open.  Worms everywhere.




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell