tpope / vim-apathy

apathy.vim: Set the 'path' option for miscellaneous file types
180 stars 9 forks source link

Add support for cpp #4

Closed bfrg closed 6 years ago

bfrg commented 6 years ago

The preprocessor lists additional system include paths for C++ (check with cpp -v -x c++, as opposed to cpp -v -x c). So a new file for cpp filetypes should be added.

I renamed the old g:cpp_path to g:c_path in c_apathy.vim (I thought the prefix resembles the filetype). g:cpp_path holds now all system include paths for filetype cpp.

I know it's quite confusing. There's the command cpp (the C preprocessor) and there's the filetype cpp.

tpope commented 6 years ago

So one thing to note is that ftplugin/cpp.vim loads all the c filetype plugins, which means that a filetype of cpp will load both c_apathy.vim and cpp_apathy.vim. That means we can ditch the duplicate parts in cpp_apathy.vim, and it might mean we want to handle the path change a bit differently?

bfrg commented 6 years ago

You're right about the duplicates. So how would you handle the path change?

tpope commented 6 years ago

Now that I've thought about it, I think the least worst way would be an if &filetype ==# 'cpp' ... else conditional for the unique parts.