Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>maybe do this:</p> <pre><code>:noautocmd vim /Search/ **/* :set hidden :cfirst qa :%s//Replace/gce :cnf q 1000@a :wa </code></pre> <p>Explanation:</p> <ul> <li><code>:noautocmd vim /Search/ **/*</code> &#x21D2; lookup (<code>vim</code> is an abbreviation for <code>vimgrep</code>) pattern in all files in all subdirectories of the cwd without triggering autocmds (<code>:noautocmd</code>), for speed's sake.</li> <li><code>:set hidden</code> &#x21d2; allow having modified buffers not displayed in a window (could be in your vimrc)</li> <li><code>:cfirst</code> &#x21d2; jump to first search result</li> <li><code>qa</code> &#x21d2; start recording a macro into register <em>a</em></li> <li><code>:%s//Replace/gce</code> &#x21d2; replace all occurrences of the last search pattern (still <code>/Search/</code> at that time) with <code>Replace</code>: <ul> <li>several times on a same line (<code>g</code> flag)</li> <li>with user confirmation (<code>c</code> flag)</li> <li>without error if no pattern found (<code>e</code> flag)</li> </ul></li> <li><code>:cnf</code> &#x21d2; jump to next file in the list created by the <code>vim</code> command</li> <li><code>q</code> &#x21d2; stop recording macro</li> <li><code>1000@a</code> &#x21d2; play macro stored in register a 1000 times</li> <li><code>:wa</code> &#x21d2; save all modified buffers</li> </ul> <p><strong>* EDIT *</strong> Vim 8 way:</p> <p>Starting with Vim 8 there is a better way to do it, as <code>:cfdo</code> iterates on all files in the quickfix list:</p> <pre><code>:noautocmd vim /Search/ **/* :set hidden :cfdo %s//Replace/gce :wa </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload