Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Append '/' while tab completing variables that contains path to directories #171

Open
siteshwar opened this issue Oct 24, 2017 · 4 comments

Comments

@siteshwar
Copy link

With bash-completion scripts, '/' is not appended while tab completing directory names.

With bash-completion scripts :

# echo $HOME<tab>

will expand to:

# echo $HOME<space>

Without bash-completion scripts :

# echo $HOME<tab>

will expand to:

# echo $HOME/
@scop
Copy link
Owner

scop commented Oct 25, 2017

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 :(

@pbnj
Copy link

pbnj commented Jun 14, 2018

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 \)

screen shot 2018-06-14 at 4 21 06 pm

If I brew uninstall bash-completion@2 and restart my shell, environment variables do not get escaped.

@pbnj
Copy link

pbnj commented Jun 18, 2018

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.

@pbnj
Copy link

pbnj commented Jun 18, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants