Paul
Paul

Reputation: 36319

Vim trailing characters search

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

Upvotes: 3

Views: 3852

Answers (1)

Steven
Steven

Reputation: 2558

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

Upvotes: 9

Related Questions