Welcome

Troves being gleaned while surfing on the Internet mostly about computer/IT/system skills and tricks, Welcome here ...
Powered By Blogger

Disclaimer

This blog is written by the owner with real practices and tests and intended to hold all original posts except there is a clear declaration for referencing from others. Thanks for tagging with the source link or other tips for reference from here if you would like to quote partial or full text from posts in this blog.

Tuesday, February 8, 2011

Why vim not search STL headers?

In vim it is common to open a header in place, which is really a handy feature for browsing a directory hierarchy.

But you might find this functionality seems to fail with C++ STL headers : when the cursor is blinking under "#include <iostream>", say, and your hitting 'gf' will not respond by entering that header but engender a grouch like following instead:

"E447: Can't find file iostream in path".

In actuality it is quite easy to resolve this problem by riffling through vim manual.

Treatment:

open the rc file of vim, for instance, /etc/vimrc, add following setting :

set path = **,/usr/include/c++/**

provided your c++ STL headers are hoarded in /usr/include/c++.

reopen the source code you were previously browsing around and try "gf" again, it should work now! It is really that piece of cake!  Really extensible is vim!

remove empty line by sed or in vim

In vim, following the same trick for general sustitution:
:%s/^[\ \t]*\n//g 

By sed on the command line:
cat orgfile | sed /^$/d