nehaj
nehaj

Reputation: 23

How to search for a word but replace characters in the line above in gvim

In the code below, I want to replace/remove the , from the line above .VSS(VSS).

It is at multiple places in the file. I have basic knowledge of gvim and I could not figure out how to just search and then pipe it with replace.

ANTENNABWP7THVT ANTENNABWP7THVT_spr_gate156 (
    **.I(LTIELO_NET), 
    .VSS(VSS),** 
    .VDD(VDD));

Upvotes: 2

Views: 47

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172520

Matching each line that contains .VSS(VSS) and doing something with it can be done with :global. You then want to address the line above it; that's a :help :range: .-1 (or short -1). And removal of a (all with the /g flag) comma can be done with plain :substitute. Taken together:

:global/\.VSS(VSS)/-1substitute/,//

Upvotes: 4

Related Questions