![]() Then you can use :argdo to repeat the operation on all the files Vim got as arguments: :argdo %s/apple/pear/eg | update If they're all *.txt files, you can use: $ vim *.txt (See :help :argdo.)įor example, you can open your 10 files by passing them as arguments to Vim. You can use a command such as :argdo or :bufdo to repeat the same Ex command on many files. Read more using Vim's help system :h argument-list :cfdo %s/apple/pear/ge | %s/red/green/ge | update Search with :vimgrep and run your substitutions with :cfdo :vimgrep /apple\/red/ *.txt Supercharged substitution with :Subvert.Project-wide find and replace (note :cdo/ :cfdo are in Vim now).Here are some Vimcasts episodes which are related: ![]() Use :Subvert's w flag to only substitute words. This will convert apple -> pear and red -> green due to their positions inside of the curly braces. You can supply arguments after vim is started via :args or :argadd. If you started Vim with the list of files you wish to work on then these files are already in the Argument List $ vim file*.txt
0 Comments
Leave a Reply. |