3 ms·
I recently had the same problem with Conda's and Pandoc's initializations in Bash. At first I did the same as the author and just dumped the output from `pando
by rphln 4y ago
I recently had the same problem with Conda's and Pandoc's initializations in Bash.
At first I did the same as the author and just dumped the output from `pandoc --bash-completion` et al. into a file, but then I'd have to deal with cache invalidation on every machine that I use. Doing it manually isn't that bad, but remembering to update the file in a bunch of machines is a bit too much ugly for me.
After a surprisingly short Google session, I ended up settling with lazy initialization [1]. Unlike the post I found, I did it all manually, though. Now I just have this tucked at the end of my `.bashrc`:
function conda {
unset -f conda
# shellcheck disable=SC1090
source <(conda shell.bash hook)
conda "${@}"
}
function _pandoc {
unset -f _pandoc
# shellcheck disable=SC1090
source <(pandoc --bash-completion)
_pandoc "${@}"
}
complete -F _pandoc pandoc
[1]: https://dev.to/zanehannanau/bash-lazy-completion-evaluation-2a2d https://dev.to/zanehannanau/bash-lazy-completion-evaluation-...
- paulirish 4y agoI've also spent time profiling shell startup and found conda's init wasn't fast. (And that's consistent in fish shell, tol) Your found solution is elegant; I'll adopt it. nvm and rvm both have initializations have a decent perf hit, too.