On 2011-09-04, Chaoxu Tong wrote:
> Hi All,
> 
> I have a file containing file names like this:
> 
> a.txt
> b.dat
> e.cpp
> 
> I would like to invoke wc to count number of lines for these files, so i would
> like to use the current line or the select part(with visual mode) as my
> arugment.
> 
> So how could i do this in vim?

Using just the current line, you could execute this:

    :.w !wc

That pipes the current line to wc.  See

    :help :w_c

Using a visually-selected region, you could execute this:

    :'<,'>w !xargs wc

where Vim automatically inserts the "'<,'>" part.

Regards,
Gary

-- 
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

Reply via email to