Lockdown Beam: native-complete


If you have followed this blog long enough, you know it’s been a while since I embraced shell-mode. I even have a nice setup to handle its windows and to apply better colours to it1.

However, before Troy Hinckley’s native-complete fixed it for me, tab-completion in shell-mode wasn’t quite the same experience as the one on a separate terminal emulator. To be honest, I didn’t investigate far enough to understand whether this was due to my Bash configuration or to Emacs itself. The only thing I know is that Troy’s package got me where I wanted to be.

On MELPA you will find two packages: native-complete and company-native-complete. I use both, but if you are not a Company user you can live with the former alone.

Anyway, I set up native-complete with a hook to shell-mode that runs native-complete-setup-bash, then another hook adds company-native-complete to company-backends. Tom explained everything you need to start and other useful details in the package README, so head over there for more details. The only thing I can add is that I have TAB bound to company-complete in shell-mode-map.

Now that there is a libvterm integration for Emacs, staying with shell-mode may sound anachronistic, because proper terminal emulation with your favourite shell is just a package away. But if you, like me, are happy with Bash in shell-mode, I can’t recommend native-complete and company-native-complete enough. By the way, Troy’s work supports csh and other fancy things too, so you’re not strictly limited to Bash.

Next time we will see highlights disappear suddenly. Is the Evil Genius2 operating my Emacs? Who knows.

Stay safe.

Notes

  1. Note that the Modus Themes have built-in support for that, so I don’t customise xterm-color-names and xterm-color-names-bright any more. 

  2. Evil Genius