vim-codequery icon indicating copy to clipboard operation
vim-codequery copied to clipboard

Adding "c++" and "h++" filetype

Open ajcorda opened this issue 2 years ago • 0 comments

HI! I love your vim-codequery plugin, but I needed to modify it to recognize my file extensions… I use .c++ and .h++ for code in my C++ development library.

The mods I made were to the first two lines in the codequery.vim file:

let g:c_family_filetype_list = \ ['c', 'h', 'cpp', 'c++', 'cxx', 'cc', 'hpp', 'hxx', 'hh', 'h++']

let g:codequery_supported_filetype_list = g:c_family_filetype_list + \ ['python', 'javascript', 'go', 'ruby', 'java', 'c', 'cpp', 'c++']

I also had to modify the db.vim file:

function! codequery#db#construct_c_db_build_cmd(db_path) abort let find_cmd = 'find . -iname ".c" > c_cscope.files && ' . \ 'find . -iname ".h" >> c_cscope.files && ' . \ 'find . -iname ".cpp" >> c_cscope.files && ' . \ 'find . -iname ".cxx" >> c_cscope.files && ' . \ 'find . -iname ".c++" >> c_cscope.files && ' . \ 'find . -iname ".cc" >> c_cscope.files && ' . \ 'find . -iname ".hpp" >> c_cscope.files && ' . \ 'find . -iname ".hxx" >> c_cscope.files && ' . \ 'find . -iname ".h++" >> c_cscope.files && ' . \ 'find . -iname ".hh" >> c_cscope.files'

These seem to allow me to create a database and use the plugin properly with c++ and h++ files…

As I do not actually know vimscript, I thought I’d ask you to see if I missed anything else that needed to be changed, or if you see any unintended consequences from these mods...

If these changes look OK to you, and you think it useful to other folks are using these extensions for their c++ work, you might consider adding them to your official version..

Again, thanks for creating this great plugin!

[email protected]

ajcorda avatar Feb 21 '23 20:02 ajcorda