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
cd tab completion not working #872
Comments
You should |
I'm not sure what you mean. |
Oh sorry, I guess I now understand what you meant. You are saying that the normal, default bash behavior of autocompletion does not work after installing FZF, right? That sounds strange. Is that only for |
@dqgthb yes that's exactly what I meant. It is very strange to me too. |
|
It is for others as well, not just And the output for complete -o nospace -F _fzf_dir_completion cd |
Hmm, it looks different than mine: complete -o nospace -o plusdirs -F _fzf_dir_completion cd Not sure why, bash version? |
Hmm yeah I'm not sure - the one I have is bash version |
What happens when you directly paste the command ( |
Sorry for the slow response. I needed to wait and try it on the work
terminal where this is happening.
If I paste the command on the shell directly, tab completion for `cd` works
again.
…On Mar 23, 2017 9:03 PM, "Junegunn Choi" ***@***.***> wrote:
What happens when you directly paste the command (complete -o nospace -o
plusdirs -F _fzf_dir_completion cd) on your shell? Still no plusdirs?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#872 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABk3c7hcp8LvibxL758a1TdCvN82lBPjks5roxZggaJpZM4MbQjW>
.
|
Then it's likely that you have some other plugin or configuration that are interfering with completion. Can you check if you can still reproduce the problem with a vanilla bashrc that only loads fzf and nothing else? |
Here's what I just tried: :; bash --noprofile --norc
# cd tab-completion works
:; source ~/.fzf.bash
# now tab-completion does not work
:; cat ~/.fzf.bash
# Setup fzf
# ---------
if [[ ! "$PATH" == */home/tnguyen14/.fzf/bin* ]]; then
export PATH="$PATH:/home/tnguyen14/.fzf/bin"
fi
# Auto-completion
# ---------------
[[ $- == *i* ]] && source "/home/tnguyen14/.fzf/shell/completion.bash" 2> /dev/null
# Key bindings
# ------------
source "/home/tnguyen14/.fzf/shell/key-bindings.bash" |
I'm as clueless as you are. You're getting different results when you run |
I have this exact same issue since a few days. As soon as this line is executed:
tab completion stops working. On an older system with bash 3.2.25 everything is still working. When using putty from Windows to the Linux-system tab completion is still working. This is the only bash plugin installed. Running System: |
Hmm, I can't seem to reproduce the issue on Centos 7. I used this Dockerfile to set up the environment. FROM centos:7
RUN yum -y update
RUN yum -y install git vim
RUN git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && \
~/.fzf/install --all
WORKDIR /usr/ |
I don't know what the differences between RHEL7.2 and Centos 7 (version?) are or how the Docker environment is different to a real installation. fzf has just been uninstalled and reinstalled from scratch and the issue still exist. What do you suggest for debugging completion.bash ? |
Hmm, I'm not sure if it's an issue of completion.bash. What's the output of |
Here you go:
this is with latest status on the master branch. Tab completion is not working. |
@ezschemi Does the output of complete -o dirnames -o nospace -F _fzf_dir_completion cd If it doesn't, do you have any clue why it's not correctly applied to your system? Since I can't reproduce the problem locally, I need your assistance on this. |
It does change:
but tab completion still does not work. Also note that tab completion does not work for commands like ls or cat, not just cd. |
Okay, so it does change when you do it manually, but it doesn't apply properly when it's called within completion.bash script? Strange, right? Can you help debugging the issue? |
Sure I can help. I have never debugged a bash script before though. What do you want me to do? Let me see if I can quickly create a VM with RHEL 7.2 for you with remote access. Then you can debug it. Might be more efficient... |
I got unset tab complete not working. |
I am having the same issue as @ezschemi and everyone else here. when I run
If I manually change it to System: |
What is the update on this issue? I'm having same problem. My bash version is 4.3.48. The output of Edit: I checked it with zsh v5.1.1 and it works well in zsh, but not in bash. |
@junegunn You need to look at the problem from this angle, maybe. I found out that the problem is with tmux. When I'm outside tmux, inside neovim's terminal, tab-completion works normally. But when I'm inside tmux, it doesn't work. So, there must be something wrong with tmux. |
I'm on CentOS 7.5, having the exact same issues as mentioned above. ## new terminal, tab complete works
daev> complete | grep cd$
complete -o nospace -o plusdirs -F _fzf_dir_completion cd
daev> screen
## now tab-complete doesn't work
daev> complete | grep cd$
complete -o nospace -F _fzf_dir_completion cd
daev> complete -o nospace -o plusdirs -F _fzf_dir_completion cd
daev> complete | grep cd$
complete -o nospace -o plusdirs -F _fzf_dir_completion cd
## now tab complete works again |
Wow, I stopped using fzf for this issue and again installed it yesterday only to see that the bug is not fixed. What happened? |
Just for the sake of it, just tried
|
@enanajmain
That doesn't make sense to me as you can easily opt-out fuzzy completion during the installation process. |
I installed it with vim, so I didn't get the yes/no options that I got today when I installed it using git. I guess it was my bad. |
FYI, # All but fuzzy completion
./install --all --no-completion
# Just download the binary, and nothing else
./install --bin |
Ya, changed my |
I am experiencing this same issue running a vanilla .bashrc with only Running on CentOS Linux release 7.5.1804 with GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu). Interestingly, the issue only occurs using Gnome Terminal (3.22.1) or Xfce terminal, in Xfce-4, and not via SSH or with XTerm. Within Gnome terminal:
And setting explicitly:
Resolves the issue. |
I had same issue on bash, and finally figured out (at least in my case) it's related to the location fzf.bash get sourced, at the end of my default .bashrc, there are some stock completion like below erased fzf completion, after moving fzf bash source after this fix the issue. .bashrc: # source fzf.bash # was sourced here and not working if ! shopt -oq posix; then source fzf.bash # move to here works! |
So i figured out a fix for me, which is the opposite of the previous comment. Moving I did some more digging. If I place it before the following, it works. If I place it after the following code, it does not work. This is the default code that comes on a standard debian # 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 I should note that I am using homebrew on linux, and have bash-completion@2 installed. |
OK running on Mac with homebrew and I discovered that for me, it has to go to the BOTTOM of ~/.bashrc. I think this is because there are some completions that are overwriting. A quick look at the bash.completion script makes it hard to figure out what is going on here, but basically the shortcuts seem to work anywhere, but the This probably related to me installing bash_completion and not bash_completion@2 as described by https://docs.brew.sh/Shell-Completion, but for v1 on bash 5.x this does work source "$(brew --prefix)/ext/bash_completion"
[ -f ~/.fzf.bash ] && source ~/.fzf.bash And with the bash completion v2 it is the same thing, there line is somewhat different, but fzf has to come after it, you might want to add to the README [[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
# fzf must come after this line, it appears to remove the cd completion
[ -f ~/.fzf.bash ] && source ~/.fzf.bash |
Hey just a note my cd complete reads as complete -o nospace -v -F _fzf_dir_completion cd and works however you might want to try switching the trigger from ** to ^^ or ~~ i believe your shell options (shopt) are causing bash ti interpret the ** as a glob pattern and not a trigger in-fact i was able to reproduce by set -o posix —update tried changing the trigger and it didn't fix the issue but in still pretty sure its the posix flag still ill have a look at both then completion scripts this afternoon |
Ok what I see is that if I don’t put it after the bash completion that there is no FSD complete for cd at all. They are there for other commands like vim.
So seems like bash completion is overwriting the fzf completions for fzf
Sent via Superhuman iOS ( https://sprh.mn/?vip=rich@tongfamily.com )
…On Wed, Nov 4 2020 at 12:20, Derek < ***@***.*** > wrote:
Hey just a note my cd complete reads as complete -o nospace -v -F
_fzf_dir_completion cd and works however you might want to try switching
the trigger from ** to ^^ or ~~ i believe your shell options (shopt) are
causing bash ti interpret the ** as a glob pattern and not a trigger
in-fact i was able to reproduce by set -o posix
Try set +o posix and that should fix your issue if im correct posix
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub (
#872 (comment) ) , or unsubscribe
(
https://github.com/notifications/unsubscribe-auth/AANTCR2YIMFEKQJIJWLQI5DSOGZR7ANCNFSM4DDNBDLA
).
|
Hmm maybe its a separate issue i found then because the only way i could reproduce is (while working) set -o posix then it stopped working or does set spawn a new environment i had a script for a while that was on / off switch for environmental variables that broke fzf completion would unset some of the completion variables try adding an echo “$SHLVL” before and after both the fzf source and the bash complete source will help narrow down how the environment is being effected. |
That's correct. The fzf completion should be loaded at the end. The completion script of fzf is smart enough to keep the previous completion function as the fallback, but you can't expect the other scripts to do the same. @rayiik Thanks for trying to help, but @richtong already found the right answer. |
It probably should be documented somewhere. Or the installer script might add as a comment when it sticks it into the profile :-)
Sent via Superhuman iOS ( https://sprh.mn/?vip=rich@tongfamily.com )
…On Thu, Nov 5 2020 at 00:54, Junegunn Choi < ***@***.*** > wrote:
@richtong ( https://github.com/richtong )
>
>
> it has to go to the BOTTOM of ~/.bashrc. I think this is because there are
> some completions that are overwriting
>
>
That's correct. The fzf completion should be loaded at the end. The
completion script of fzf is smart enough to keep the previous completion
function as the fallback, but you can't expect the other scripts to do the
same.
@rayiik ( https://github.com/rayiik ) Thanks for trying to help, but @richtong
( https://github.com/richtong ) already found the right answer.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub (
#872 (comment) ) , or unsubscribe
(
https://github.com/notifications/unsubscribe-auth/AANTCR7DLJDCD7NVEBJM2BLSOJR5JANCNFSM4DDNBDLA
).
|
FWIW, @rayiik gave the clue I needed. I was playing with various |
For some reason,
cd <tab>
is not auto-complete for me. I am running on a linux terminal X11-forwarded to a Windows machine.fzf version is
0.16.6
.I have narrowed down the problem to these lines in
shell/completion.bash
:Commenting them out gives me back the regular tab autocompletion behavior.
Please let me know if there's some way I could debug this further.
The text was updated successfully, but these errors were encountered: