vim - Replace end of line for lines that start with a particular pattern -


i have file in following format

--some-xyz-code ; --somemore--xyz--code; comment = " demo" --somemore--code; --somemore--code; 

i want put semicolon @ end of line comment, keeping rest of line intact.

try this:

:g/^comment/ normal a; 

for every line matches comment @ beginning enter in insert mode @ end of line , append semicolon.

explanation: :g selects every line matches following pattern ^comment , action after last slash, normal a;


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -