I'd like to set c++ header file path automatically from .vimrc. So I tried to write .vimrc file as shown below:
let g:gcpp_headers_path=system("g++ --version | grep g++ | awk '{print \"/usr/include/c++/\"$NF}'")
"if isdirectory(gcpp_headers_path)
set path+=g:gcpp_headers_path
"endif
from the vimrc above I found the vim variable path set as shown below:
:set path?
path=.,/usr/include,,,g:gcpp_headers_path
The wanted output is as shown below:
:set path?
path=.,/usr/include,/usr/include/c++/7.5.0
I'd like to get this reviewed. Could someone advise me?
F.Y.I. The command in system() is shown below:
~$ g++ --version | grep g++ | awk '{print "/usr/include/c++/"$NF}'
/usr/include/c++/7.5.0