I want to substitute all cygdrive/e
with cygdrive/d
using vim. But I can’t get the matching pattern correctly. Here is my command:
s/cygdrive\/e/cygdrive\/d/g
it doesn’t work. Can anybody show me what is wrong?
Thanks,
,
vim allows you to specify the delimiter.. (First character after s is the delimiter)
s/cygdrive\/e/cygdrive\/d/g
using line range argument .. and # as delimiter
ESC:
:1,$ s#/cygdrive/e#/cygdrive/d#g
,
Your search pattern and replacement string look fine.
Make sure you are in ex
mode when you try it.
So press ESC
, then :
and then
%s/cygdrive\/e/cygdrive\/d/g
But if you want all he replacements in just the current line you can do:
s/cygdrive\/e/cygdrive\/d/g
,
You have to escape the special character
like this
s/cygdrive\/e/cygdrive\/d/g