Find and replace strings in vim on multiple lines

I can do :%s/<search_string>/<replace_string>/g for replacing a string across a file, or :s/<search_string>/<replace_string>/ to replace in current line. How can I select and replace words from selective lines in vim? Example: replace text from lines 6-10, 14-18 but not from 11-13. 1Best Answer 11 Replace All: :%s/foo/bar/g Find each occurrence of ‘foo’ (in all lines), … Read more

How can I make my match non greedy in vim?

I have a big HTML file that has lots of markup that looks like this: <p class=”MsoNormal” style=”margin: 0in 0in 0pt;”> <span style=”font-size: small; font-family: Times New Roman;”>stuff here</span> </p> I’m trying to do a Vim search-and-replace to get rid of all class=”” and style=”” but I’m having trouble making the match ungreedy. My first … Read more

Where is my .vimrc file?

I have been using Vim, and I would really like to save my settings. The problem I am having is that I cannot find my .vimrc file, and it is not in the standard /home/user/.vimrc location. How might I find this file? 19 s 19 You need to create it. In most installations I’ve used … Read more