2 ms·
I'm noticing that in Bash, when I complete on ~-1 without a trailing slash, nothing happens. When I use $c1 and hit tab, it adds the slash for me! So in that si
by kazinator 3y ago
I'm noticing that in Bash, when I complete on ~-1 without a trailing slash, nothing happens. When I use $c1 and hit tab, it adds the slash for me! So in that situation, $c1 saves a keystroke. Well, not a keystroke per se, but having to use a different character rather than repeated Tab.
Also, I can shorten these variables to one letter, like $p, $q, ...
Bash has an option so that tab completion will expand out the directory.
shopt -s direxpand
this is useful because variables like $c1 or syntax like ~-1 entered into the history is not useful for recall.
I know about M-x C-e to expand everything, but that is far too clumsy compared to just the tab completion doing it.
Here is something: the direxpand option is not working for ~-n/[Tab] completions. Only for variable names!
- JNRowe 3y agoMy description above wasn't great. I meant completion would be an improvement in the sense that under zsh `~-<Tab>` can show not only the possible completion options, but also the value they expand to. For example, mine is set to display in the manner of a colorful version of the text below: $ cd ~- 0 -- ~ 1 -- ~/Downloads 2 -- ~/Desktop The handling of tilde expansion under bash is a readline option, so users would configure it in their inputrc. It is pretty useful in general, because then it is also available to tools like imv¹ beyond just bash. Unfortunately, as it is handled separately from word completion you'd need to change the completion function to make it match the mark-directories behaviour you like. If I wanted the text expanded for history use I'd probably expand it before writing using a zshaddhistory hook, but I don't think there is an equivalent in bash so changing the line buffer probably is the best option. ¹ https://www.nongnu.org/renameutils/ https://www.nongnu.org/renameutils/