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

Running slowly with multiple cpp files

Open danboxall1988 opened this issue 3 years ago • 3 comments

I have three cpp files, all connected, along with their corresponding header files, and it is getting achingly slow, and getting slower each time I add a new file. I could handle a little bit of lag, but this is really bad. Also, whenever I try to add a comment, vim freezes after I've added the first / character. It takes between 10 to 60 seconds to start up again.

I am using vim 8.2 in the windows 10 msys2 environment.

danboxall1988 avatar Mar 15 '22 01:03 danboxall1988

Recently I made some optimizations. You can update it and try again. I didn't have msys2 environment. I just test a project with more than 50 files in the MacOS. Everything seems ok.

Or you can use ccls instead of clangd. Copy these code into your .vimrc:

au User easycomplete_custom_plugin call easycomplete#RegisterSource({
      \ 'name': 'cpp',
      \ 'whitelist': easycomplete#FileTypes("cpp", ["c", "cc", "cpp", "c++", "objc", "objcpp", "hpp"]),
      \ 'completor': 'easycomplete#sources#cpp#completor',
      \ 'constructor' :'easycomplete#sources#cpp#constructor',
      \ 'gotodefinition': 'easycomplete#sources#cpp#GotoDefinition',
      \ 'command': 'ccls',
      \ "root_uri_patterns": [
      \    "compile_flags.txt", "compile_commands.json"
      \ ],
      \ 'semantic_triggers':["[^->]->$", "[^:]::$"]
      \ })

you must install ccls manully by: brew install ccls

jayli avatar Mar 15 '22 04:03 jayli

Thanks for your response, I will let you know how it goes

danboxall1988 avatar Mar 15 '22 22:03 danboxall1988

I updated it, but still had the same problems. Then I tested it in my linux vm, and it worked just fine, so I guess it has something to do with the msys2 environment.

danboxall1988 avatar Mar 16 '22 23:03 danboxall1988