argdo and grep

2007-03-01 Thread Naim Far
Hi Vimers,


  I was wondering about argdo! Is there anyway to do the following
command

:grep pattern * | argdo :%s/pattern/new_pattern/g

I tried it but it didn't work, I tried some few others ways, but they
didn't work either

Thanx...



RE: argdo and grep

2007-03-01 Thread Naim Far
Thanx Yakov for your response,

It would help, but I would rather to do it with in working in vim. I'm
editing an enormous number of files, and when I change a pattern, I want
to change it in the few files that has this pattern, and not having to
go through all the files. 
 
Is there anyway you could think of?!


Thanx again...

 Naim


-Original Message-
From: Yakov Lerner [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 01, 2007 2:20 PM
To: Naim Far
Cc: vim@vim.org
Subject: Re: argdo and grep

On 3/1/07, Naim Far [EMAIL PROTECTED] wrote:
   I was wondering about argdo! Is there anyway to do the following
 command

 :grep pattern * | argdo :%s/pattern/new_pattern/g

How about this:
vim `grep -l 'pattern' *`
:argdo :%s/pattern/new_pattern/g

Yakov


RE: How to diff in gvim

2007-02-13 Thread Naim Far
Hi,

  Does anyone know how to do vert diffsplit between two buffers?!
When using diffsplit I have to supply the full path of the second
comparison file, what if I simply want the comparison to be done with
another already opened buffer?!

Thanx in advance...

-Original Message-
From: Tom Purl [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 13, 2007 1:59 PM
To: Eric Leenman
Cc: vim@vim.org
Subject: Re: How to diff in gvim

 Hi,

 I'm trying to diff two files in (portable) gvim
 I have two files opened in two vertical windows.
 (Kind of Winmerge screen setup)

 When I type :diff  I get the error
 E97: Can not create diffs

I don't think that you're supposed to diff files this way, but I could
be wrong.  If I have a buffer that I want to diff with another, I
usually do the following:

1. Un-split all of your windows, leaving only one, and then load file
#1 in that window.
2. Type the following command:
* :vert diffsplit path_to_file2

This should give you the results that you want.

HTH!

Tom Purl




Re: replace with a number sequence

2007-02-04 Thread Naim Far

Hi Vimers,

  Can anyone please help me with making the vim indent verilog files 
properly?!


Thanx in advance!



Verilog Indentation

2007-02-04 Thread Naim Far



Hi Vimers,

  Can anyone please help me with making the vim indent verilog files 
properly?!


Thanx in advance!





Re: replace with a number sequence

2007-02-01 Thread Naim Far

Hi,

I liked the following replacement command, and I found it very usefull:
 :let n=0|g//s//\=n/|let n+=1

But, could anyone please explain the way it works?!
I used the help := to try and understand it, but the vim help says the 
:= command displays the line number, which cannot explain the way the 
command above works


Thanx in advance...



jose isaias cabrera wrote:



Mark Woodward wrote,


On Mon, 2007-01-29 at 21:57 +1300, John Little wrote:


Hi

IMHO simpler and more flexible (works if there are lines not matching
the pattern) is:

:let n=0 | g/opIndex(\zs\d\+/s//\=n/|let n+=1

A useful idiom I learned here.  Usually I muck around with ordinary
searches until the search highlighting shows I've got it right, then

:let n=0|g//s//\=n/|let n+=1

is what I have to remember, and it's obvious what the start and 
increment are.


John



Just as additional info this method also lets you perform this sort of
incremental substitution on letters.

 UniqueID2   = lview.focusedItem.subItems.opIndex(0).text;
 Parent  = lview.focusedItem.subItems.opIndex(0).text;
 Children= lview.focusedItem.subItems.opIndex(0).text;
 login   = lview.focusedItem.subItems.opIndex(1).text;

let i=97|g/opIndex(\zs\d\+/s//\=nr2char(i)/|let i=i+1

 UniqueID2   = lview.focusedItem.subItems.opIndex(a).text;
 Parent  = lview.focusedItem.subItems.opIndex(b).text;
 Children= lview.focusedItem.subItems.opIndex(c).text;
 login   = lview.focusedItem.subItems.opIndex(d).text;

let i=65|g/opIndex(\zs\d\+/s//\=nr2char(i)/|let i=i+1

 UniqueID2   = lview.focusedItem.subItems.opIndex(A).text;
 Parent  = lview.focusedItem.subItems.opIndex(B).text;
 Children= lview.focusedItem.subItems.opIndex(C).text;
 login   = lview.focusedItem.subItems.opIndex(D).text;


:h nr2char




Since you brought it up, I also have this other situation,

bla.blah.blahh[0].text;
bla.blah.blahh[0].text;
bla.blah.blahh[0].text;
bla.blah.blahh[0].text;
bla.blah.blahh[0].text;
bla.blah.blahh[0].text;

I tried using the original solution you gave me,

:let n=0 | g/opIndex(\zs\d\+/s//\=n/|let n+=1

but it kept going to the same spot as before.  I will not change the 
[#]. Where is the match for (?  I can't figure it out.  The next 
version of vim should have an easier way of doing this.  I constantly 
have to copy from vim and paste to TextPad and doing it there and then 
copy from TextPad back to vim.  Yes, I know I could make a function 
and assign a key to it, but these kind of things should be just built 
in.  I know, I am a picky guy, aren't I? :-)


thanks.







grep and regular expression

2006-12-14 Thread Naim Far

Hi,

 I'm writing C++ code, I'm trying to search for all class declaration 
via the following command:


:grep 'class\s*\w\+{' *.hpp

The command fails! although if I do search for the same expression, the 
search succeeds (in a specific file)!


Y?!

Thanx...



file name from command mode

2006-10-25 Thread Naim Far

Hi Vim guys,

Any body knows how to get the current file name in command mode?!

Thanx...



automatically going from header file to implementation file

2006-10-18 Thread Naim Far

Hi,
 Does any body know a way of automatically going from header file to 
its implementation file?! and vice versa?!