taoso / phpcd.vim

phpcd - A Intelligent/Smart PHP Complete Daemon Plugin for Vim/NeoVim
https://github.com/taoso/phpcd.vim
Apache License 2.0
389 stars 45 forks source link

There appears to be no way to 'reload the index' when the path changes. #188

Closed LeighBicknell closed 3 years ago

LeighBicknell commented 3 years ago

I use a plugin called tcd, which allows each tab to have a different project in it by doing a cd to each projects directory when the tab changes.

This is obscure I realise but there appears to be no way to force phpcd.vim to 'reload the index'.

I've try let phpcd_root=//new path And various other things such as setting need_update and calling various Index() functions. But regardless of what I do, I'm unable to force it to update when switching tabs.

As a result, I end up with the autocomplete results from whatever the first project opened was, regardless of the project i'm currently working on.

Do you have any hints as to how I can work around this and force phpcd.vim to switch to the new project when I open a file from another project/root dir?

taoso commented 3 years ago

You can add the following line to your vimrc.

let g:phpcd_auto_restart = 1

However, this will restart phpcd daemon every time you switch buffer. It maybe slow your vim. I recommend to open different vim instances for different project.

LeighBicknell commented 3 years ago

Thanks! This is really useful.

Is there not a command I can call to force a restart myself though? An autocommand on tabswitch would be ideal in my personal situation.

Having multiple vims open per project would go against the way I've used vim for the last 10+ years!

taoso commented 3 years ago

If not set the g:phpcd_auto_restart, you could run :call phpcd#OpenFileNoAutoRestart() after tap switch.