I try to set up my Vim to use omnicppcomplete.
I followed the constructions c++ code completion to install it step by step. First I always get the error "Omni-completion (^0^N^P) Pattern not found". It was hard to figure out but now i know why it doesn't work. Its because the following line in my vimrc
"set tags+=C:\\Program\\ Files\\ (x86)\\Vim\\vim74\\tags\\cpp"
Vim can't handle the whitespaces in the path but i don't know how to get it work except to copy the tag-files into another directory (which i try and it worked). I tried these options but nothing worked:
How do I have to write the path so omnicppcomplete can use the tags?
See :help option-backslash
. When using the :set command, you need to escape every backslash, and every space character, so you will need three backslashes to set paths with spaces! Ie set tags+=C:\\\\Program\\\\\\ Files\\\\\\ (x86)\\\\Vim\\\\vim74\\\\tags\\\\cpp
Sometimes a nicer way, is to use a :let
command, so that you can use single-quoted strings and don't need to escape as much. For example, :let &tags.=',C:\\Program\\ Files\\ (x86)\\Vim\\vim74\\tags\\cpp'
Try this:
let &tags .= ',C:\Program\ Files\ (x86)\Vim\vim74\tags\cpp'
An option opt
can also be accessed as a variable &opt
, which can be manipulated with let
, can be used in expressions, and so on. Unlike set
, let
has an almost sane syntax.
Also, paths in tags
have to be separated by commas.
I had the same problem. Try just to use /
in paths, and escape whitespace like this '\\ '. For example I add this line in my vimrc:
set rtp=C:/Program\ Files\ (x86)/Vim/vim74/vim.exe
Than if you will command :echo &rtp
you can see:
C:/Program Files (x86)/Vim/vim74/vim.exe
Note that here is no \\
before whitespace.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.