On Wed, March 25, 2009 3:12 am, andy richer wrote: > How can I let vim treat metacharacters as ordinary characters? so I > can > //a/b/c/d/e/f to search /a/b/c/d/e/f ?
This is not possible for simple search "/", as the slash is used as delimiter. This is probably due to historical reasons. I think Posix demands that / acts as a delimiter for forward-search in vi. All other metacharacters (except \) can be treated as ordinary characters by the use of \V (see :help /\V). So the pragmatic solution would be to search using backward search (?) followed by N (for next search in reverse direction) together with a pattern that starts with \V You still would have to escape the backslash, though. You could also define a command to take care of the escaping, e.g.: :com! -nargs=1 Search :let @/='\V'.escape(<q-args>, '\/')| normal! n so you can literally search using Search a/b/c/d or even Search a\b\c\d and also Search a.b.c regards, Christian -- :wq! --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
