find and replace vimfind and replace on vim. for those who use vim, there is a feature on vim that you can use to do find and replace. This feature (find and replace) is a standard ability that every text editor should have, including vim.

for example, many files that are edited using default windows texteditor on windows machine will have “^M”. this annoying end-pf-line character, will give error when the script is run under linux. therefore, you need to edit the file and do find and replace on that file, and vim can do that for you.

to do find and replace, you need to be on the “command mode” (press esc) and to the syntax below:

:%s/text_old/text_new

tadaaa… you already done a find and replace.

to undo, just press u

picture from thegeekstuff.com

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.