I'm using ag
in Vim with good results for string/file search.
However, there seems to be not much documentation how patterns are constructed for ag.
I'm trying to use ag instead of vimgrep in an example from the Practical Vim book.
I want to find every occurrence of "Pragmatic Vim" in all files in a directory recursively, and substitute this string with "Practical Vim". There is also "Pragmatic Bookshelf" in some files, and that string must remain.
the book suggests this approach:
/Pragmatic\ze Vim
:vimgrep /<C-r>// **/*.txt
And after that step, populate quickfix list with :Qargs
plugin command, and, finally :argdo %s//Practical/g
Now, how do I specify /Pragmatic\ze
pattern using ag
?
Is ag
at all designed for what I'm trying to do here?
$ ag '(?<=Pragmatic )Vim'
in a directory finds Vim, I am trying to find the Pragmatic part. However, since I'm trying to populate quickfix with relevant files, this command seems to limit the list to the needed files. I suppose I will need to read up on PCRE. It seems, that I will still need to use/Practical\ze
for:argdo %s//Pragmatic/ge
part? – Linearity