sponsor Vim development Vim logo Vim Book Ad

basic Tip #574: delete/move matching paragraphs/lines

 tip karma   Rating 25/7, Viewed by 1256 

Read and edit this tip on the Vim tip wiki. The wiki may have a more recent version of this tip.

created:   October 4, 2003 11:32      complexity:   basic
author:   mosh@cs.albany.edu      as of Vim:   6.0

" Put these in .vimrc, and these four items will become menu items.
" You can of course just type these one liners, if you don't have menus.
" Edit /word/ before pressing return,
" Note: /word/ can be any perl expression to select paras.

:amenu Mo1./.Delete-Matching-Paras<tab>:1,$!perl :1,$! perl -0000lne 'print if m/word/'

:amenu Mo1./.Delete-Matching-Lines<TAB>:g//d     :g//d<CR>
:amenu Mo1./.Delete-Non-Matching-Lines<TAB>:v//d :v//d<CR>

:amenu Mo1./.Move-Matching-Lines-Top<TAB>g//\.m0     ma:g// .m0<CR>`a
:amenu Mo1./.Move-Non-Matching-Lines-Last<TAB>v//\.m$ ma:v// .m$<CR>`a    


" - Mohsin Ahmed http://www.cs.albany.edu/~mosh

" > To match thy goodness? My life will be too short,
" > And every measure fail me. -- Cordelia, King Lear 4.7

 rate this tip  Life Changing Helpful Unfulfilling 

<< Repeating a substitute from current cursor position | chop long lines. >>

Additional Notes

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to vim@vim.org after searching the archive. Help Bram help Uganda.
   
Sponsored by Web Concept Group Inc. SourceForge.net Logo