…just as a goatee-laden nu-metal steadfast will never concede to how lame, white-boy angst killed the late-90′s.
In full disclosure, tab-completion and I have quite a history. It therefore pains me to call-out this shell feature.
Out-of-the-box, Ubuntu is configured to not anoint vim or vi with the ability to tab-complete .class file names from bash.
e.g. If there existed a file, foo.class
mike@ubuntu:~$ ls foo.class mike@ubuntu:~$
Attempting to tab-complete the following will only ring that joyful bell
mike@ubuntu:~$ vim foo. <--tabbing with fervor! FFFFFUUUUUU!
Now don’t get me wrong, I’m capable of hitting the extra four keystrokes, but I’m also lazy.
It took a few searches to realize that there existed tab-completion config. And for the record AND hilarity, yes, this took me more time than just typing the extra characters.
The solution is the following:
- Open /etc/bash_completion
- Search for your offending file extension.
…and in my instance, it appeared as:
complete -f -X '*.@(o|so|so.!(conf)|a|rpm|gif|GIF|jp?(e)g|JP?(E)G|mp3|MP3| mp?(e)g|MPG|avi|AVI|asf|ASF|ogg|OGG|class|CLASS)' vi vim gvim rvim view rview rgvim rgview gview
- Replacing the line with:
complete -f -X '*.@(o|so|so.!(conf)|a|rpm|gif|GIF|jp?(e)g|JP?(E)G|mp3|MP3| mp?(e)g|MPG|avi|AVI|asf|ASF|ogg|OGG|class|CLASS)' gvim rvim view rview rgvim rgview gview
…and a quick bash session restart, .class files were once again being massacred by my intentions.
FIN!
