Search code examples
bashhaskellautocompletecabalcabal-install

How to make bash autocompletion work with cabal?


With stack build tool I need to add the following line to my system config and autocompletion works:

eval "$(stack --bash-completion-script stack)"

But autocompletion for cabal-install doesn't work out of the box and I can't find a way to do this. How can I enable bash autocompletion for cabal-install (my cabal-install version: 2.1.0.0)?

My OS: Ubuntu 16.04.03 LTS


Solution

  • There's a cabal-install autocomplete script here. You just need to source it somewhere in your shell: https://github.com/haskell/cabal/blob/master/cabal-install/bash-completion/cabal

    For ubuntu, you should be able to do it by just tossing it in /etc/bash_completion.d