Open siteshwar opened 7 years ago
Not quite sure how to do that. Appending the /
(plus setting nospace mode) is not enough IMO, we want to set to filename completion mode (compopt -o filenames
) when that occurs so one can sanely complete filenames following the variable and the slash. But when doing that, the $
gets backslash escaped :(
But when doing that, the $ gets backslash escaped
Interestingly, I seem to be running exactly into what you've described (compopt
causing $
in environment variables to get escaped with backslashes \
)
If I brew uninstall bash-completion@2
and restart my shell, environment variables do not get escaped.
I came across the same question on this thread which recommended:
shopt -s direxpand
(for bash >= 4.2.29)
That resolved the issue of escaping $
when hitting TAB for me.
With regards to the original question of appending a /
while tab completing variables that contain path to directories, adding the following to my ~/.inputrc
resolves the issue:
$include /etc/inputrc
set completion-ignore-case On
+ set mark-symlinked-directories on
set show-all-if-ambiguous on
set visible-stats on
set page-completions off
With bash-completion scripts, '/' is not appended while tab completing directory names.
With bash-completion scripts :
will expand to:
Without bash-completion scripts :
will expand to: