Closed dgudim closed 7 months ago
Depending on the situation, there are several options. I'm not sure which would be the best one in your environment because the bottleneck would be different in different environments, so you probably need to try them to see if it works for you.
One option is to limit the number of candidates by the complete_limit_auto
option. If the generated number surpasses the configured value, the processing of auto-complete
is canceled in the middle. The default value is 2000
, so you can specify a less number. For example, if you want to limit it under 100, you can put the following setting:
# blerc
bleopt complete_limit_auto=2000
However, this might not work, if the generation stage is the bottleneck.
Another option is to add a delay for starting auto-complete
in the background using the config complete_auto_delay
. This is actually not what you requested, but it might solve the problem. For example, if you want to set the delay of 300 milliseconds, you can put the following setting:
# blerc
bleopt complete_auto_delay=300
Or maybe you don't want auto-complete
in any directories? In that case, you can just turn off the feature using the complete_auto_complete
option:
# blerc
bleopt complete_auto_complete=
Or, the most flexible option would be to dynamically change the setting in blehook CHPWD
. CHPWD is the hook that is called when the current working directory is changed after the execution of a user command.
# blerc
blehook CHPWD!='my/blerc/update-settings'
function my/blerc/update-settings {
if [[ $PWD == /usr/bin || $PWD == /lib || $PWD == /bin ]]; then
# turn off auto-complete
bleopt complete_auto_complete=
else
# turn on auto-complete
bleopt complete_auto_complete=1
fi
}
I already tried the delay and limiting the candidates. The CHPWD is the perfect solution! Thanks :) works like a charm
How to turn off automatic completions for some directories (/bin, /usr/bin, /lib) because it takes A LOT of time. I want to only trigger the completions when I press tab