You are not logged in.

#1 2009-12-27 15:38:19

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 2,001
Website

loading bash-completion faster?

getting sick of having to wait a second or so anytime i load a new shell to see my PS1.
i found out that the sole culprit is sourcing /etc/bash_completion.
I know you can already start typing when processing .bashrc and /etc/bash.bashrc is still ongoing, but it's kinda ugly.

anyone knows how to make it faster?
just some ideas that may [not] be feasible/possible:
- load completions in the background (`source` is synchronous though)
- show PS1 already when completions are not loaded yet.  maybe we could make it so that the end of .bashrc you change the color of PS1.
- make a custom package of bash-completion that has no files for stuff i don't use (apt, moosay, yum etc)


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

#2 2009-12-28 00:44:39

Cdh
Member
Registered: 2009-02-03
Posts: 1,098

Re: loading bash-completion faster?

I sped starting a shell up with changing to zsh. Also the autocompletion itself is faster.


฿ 18PRsqbZCrwPUrVnJe1BZvza7bwSDbpxZz

Offline

#3 2009-12-28 01:25:57

pwd
Member
Registered: 2009-12-14
Posts: 13

Re: loading bash-completion faster?

I didn't believe you in #bash. ;)

Anyway, you can try set -a or export -f function_name (lots of functions in bash_completion so exporting them one by one isn't practical).

Putting set -a in ~/.bash_profile will export everything. This could be a solution since that file is only sourced during login shells, meaning it'll only load it once per vc. Now instead of sourcing bash_completion from bashrc, do it from bash_profile.

The trade-off is that now these functions/variables are available in non-interactive instances like scripts, which shouldn't be a problem since good scripts define their functions or source them at runtime.

Edit: make sure SHELLOPTS is not exported, else the -a attribute gets inherited.

Last edited by pwd (2009-12-28 01:41:46)

Offline

#4 2009-12-28 01:44:02

JohannesSM64
Member
From: Norway
Registered: 2009-10-11
Posts: 623
Website

Re: loading bash-completion faster?

Cdh wrote:

I sped starting a shell up with changing to zsh. Also the autocompletion itself is faster.

^

Offline

Board footer

Powered by FluxBB