Comments (2)
An understanding of bash tab completions continues to elude me. There are three different systems I've encountered that all seem to do things differently: knuth, my phone, and my laptop.
A little bit of a breakthrough came when I played around with cds tab completion a while back. I'll document a few things I learned for posterity. Hopefully they can shed some light on how normal alias gets its completions too.
- Bash completions are not an inherent feature of bash necessarily. I think they need to get enabled by an external script.
- Bash completions get enabled every time the terminal is started. The following code needs to appear in your .bashrc in order for this to happen. In order for tab completions from our repo to work appropriately, our code needs to be sourced after this code is run.
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
- knuth does not have the above code. Neither does it have a bash_completion enabler script. Yet it seems to have some form of tab completion, albeit a really bad one. You can enable better bash completions on knuth by copying the script and adapting the code above to the appropriate places.
- Most computers also have a folder
/etc/bash_completion.d/
where it seems like bash completion scripts for some individual commands (like git, for example) are stored. I have yet to understand what this does and why it exists. - I still don't know where tab completions for normal
cd
are defined. @GiselleSerate, you might run into the same problem with normal alias since they are both bash built-in commands (I think?)
from myaliases.
Okay, tab completion was a little enthusiastic. Alias doesn't do any tab completing. (I don't know where it would . . .) So we're going to call this a case of Tab Completion Isn't Duct Tape and close this issue.
from myaliases.
Related Issues (20)
- options HOT 6
- Reran install script and .included gave me this HOT 2
- cds - too many file descriptors? HOT 3
- wiki better m8 HOT 1
- cds tab complete shell conditional agh HOT 2
- add guidance about setup/install to wiki
- document git and hg and grep
- prepending .included line into .bash_aliases HOT 7
- comments in cds command
- unalias for altalias? HOT 1
- double slashes in cds tab completion HOT 3
- alias in alias command
- test suite HOT 3
- Setup script's jank on an RPI HOT 6
- Setup script should finish off by sourcing HOT 1
- Somehow enforce make
- some ideas
- cds - is not portable
- wsl open cmd overrides default open cmd HOT 2
- WSL 2 alternative to SFTP Net Drive using SSHFS HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from myaliases.