开发者

Vim trailing characters search

开发者 https://www.devze.com 2023-03-27 12:23 出处:网络
I know I have to escape regex special characters in a search and replace in vim, but I can\'t see what I\'m missing here.I do this:

I know I have to escape regex special characters in a search and replace in vim, but I can't see what I'm missing here. I do this:

:%s/RAILS_ROOT/Rails\.root\.to_s/gj

and I get the "trailing characters" error开发者_开发知识库 in Vim.

I have also tried escaping the _ the same way, just in case, same result. Any idea what I'm missing?

Thanks


Try removing the j at the end. :%s/RAILS_ROOT/Rails\.root\.to_s/g j is not a valid flag for :substitute as far as I can tell http://vimdoc.sourceforge.net/htmldoc/change.html#:s_flags

0

精彩评论

暂无评论...
验证码 换一张
取 消