in vi, search and replace, how do you escape a \'/\' (forward slash) so that it is correct. Say in a path.
like: /Users/tom/documents/pdfs/
:%s//Users/to
You can use ?
to search
In case of searching pattern in a register, and the pattern contains a '/' character, you can simply use ?
command instead of /
command from normal mode to start pattern matching. In such case, no more escape required for '/' char. (however you need to escape '?' char now)
?
will search in the opposite direction of /
, so if you don't mind the search direction, and your search pattern doesn't contains '?' char.
In addition, check the escape()
script if you want more.