/ in vi Search and replace?

前端 未结 6 554
耶瑟儿~
耶瑟儿~ 2021-01-30 08:02

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         


        
6条回答
  •  清酒与你
    2021-01-30 08:44

    You need to escape the forward slashes internally, too.

    :%s/\/Users\/tom\/documents\/pdfs\///g
    

提交回复
热议问题