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

[Bash, gnome terminal] Ctrl+r displaying completions but pressing "enter" does nothing #1472

Open
4 of 15 tasks
apirrone opened this issue Jan 7, 2019 · 7 comments
Open
4 of 15 tasks

Comments

@apirrone
Copy link

apirrone commented Jan 7, 2019

  • Category
    • fzf binary
    • fzf-tmux script
    • Key bindings
    • Completion
    • Vim
    • Neovim
    • Etc.
  • OS
    • Linux
    • Mac OS X
    • Windows
    • Windows Subsystem for Linux
    • Etc.
  • Shell
    • bash
    • zsh
    • fish

Hello there,

I think the title describes the problem pretty well, here is a screenshot of what I get pressing ctrl+r :

capture d ecran de 2019-01-07 17-50-47

But when I press the "enter" key with an option selected, the menu disappears and nothing happens.

Thanks for your help !

@dieterdemeyer
Copy link

I'm having the same issue on macOS.

@junegunn
Copy link
Owner

junegunn commented Feb 14, 2019

I can't reproduce the issue. I suggest that you start bash with a minimal configuration file with only one line

[ -f ~/.fzf.bash ] && source ~/.fzf.bash

and see if you still have the issue. If you don't, then you need to find the culprit in your config.

@dieterdemeyer
Copy link

You were right.
In case it helps anyone, in my config the culprit was an alias for the history command itself that screwed with the functionality.

@junegunn
Copy link
Owner

@dieterdemeyer Okay, if that was the case, we can ensure that the original history command is executed like so

diff --git a/shell/key-bindings.bash b/shell/key-bindings.bash
index be24dec..cb86e98 100644
--- a/shell/key-bindings.bash
+++ b/shell/key-bindings.bash
@@ -55,7 +55,7 @@ __fzf_history__() (
   local line
   shopt -u nocaseglob nocasematch
   line=$(
-    HISTTIMEFORMAT= history |
+    HISTTIMEFORMAT= command history |
     FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} $FZF_DEFAULT_OPTS --tac --sync -n2..,.. --tiebreak=index --bind=ctrl-r:toggle-sort $FZF_CTRL_R_OPTS +m" $(__fzfcmd) |
     command grep '^ *[0-9]') &&
     if [[ $- =~ H ]]; then

@cliffordfajardo
Copy link

cliffordfajardo commented Dec 8, 2019

OS: MacOS catalina
Shell: Bash
Terminal Emulator: both iterm, terminal
Feature: history fuzzy search

I'm having a similar related issue concerning Ctrl+r for history, except I'm using aliases. (I prefer not remembering too many keyboard shortcuts.)

The issue thats occurring is:
using ctr-r for history works fine and copies the selection back to the prompt

However, if I decide to use a keyboard alias to call the history function __fzf_history__:

alias fzfhistory="__fzf_history__"

the interactive fuzzy finder works, however selecting the result from fzf no longer returns back the text, instead I get back to stdout the line number from history.

fzfhistory

@philippemiron
Copy link

philippemiron commented Nov 14, 2024

I had the same issues on MacOs using zsh. It worked with a simple .zshrc file so I was able to identify that settings:

setopt SHARE_HISTORY

prevents somehow fzf from returning to the prompt the selected command when pressing Enter.

Edit: just saw this discussion here.

@LangLangBart
Copy link
Contributor

prevents somehow fzf from returning to the prompt the selected command when pressing Enter.

The specific issue you mentioned for zsh should be fixed in the latest release, 0.56.3.

jakubgs added a commit to jakubgs/nixos-config that referenced this issue Dec 7, 2024
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

6 participants