andreyorst / fzf.kak

FZF for Kakoune
MIT License
143 stars 33 forks source link

Cannot open fzf file picker with the `fzf_terminal_command` in Kitty #105

Closed dssgabriel closed 2 years ago

dssgabriel commented 2 years ago

Problem description

Hi! I've been trying to find a solution to this issue for weeks now and cannot figure it out... When trying to open a file within fzf mode, no window/tab/buffer with the file picker opens. The following error is thrown in the debug buffer:

Error: 1:27: 'fzf-file': 1:2: 'evaluate-commands': 4:1: 'fzf': 1:2: 'evaluate-commands': 1:1: 'terminal-tab': no such command

Here is my (minimal) kakrc configuration:

map global normal <space> , -docstring 'leader'

plug "andreyorst/fzf.kak" config %{
    require-module fzf
    require-module fzf-buffer
    require-module fzf-cd
    require-module fzf-file
    require-module fzf-grep
    require-module fzf-search

    map global user f ': fzf-mode<ret>' -docstring 'fzf'
} defer fzf %{
    set-option global fzf_terminal_command 'terminal-tab kak -c %val{session} -e "%arg{@}"'
}

I am not using Tmux and my terminal emulator is Kitty. From what I read in the documentation for this plugin and in the closed issues, terminal-tab, defined in the fzf module, is the command to use when running Kakoune in the Kitty terminal and not running Tmux. I have tried with the terminal command as well, without success. I don't know what am I missing to make this work...

Steps to reproduce

Given the above kakrc configuration:

  1. Press space (leader) to enter user-mode;
  2. Press f to enter fzf-mode;
  3. Press f again to open files;
  4. Error is thrown into the debug buffer.

What should happen

Kakoune should open the fzf file picker.

What happens instead

An error saying that the terminal-tab command does not exist is thrown in the debug buffer. However, the info box for the fzf-file mode still shows up.

Environment information

Kakoune version: v2021.11.08 OS version: Arch Linux 5.17.9-arch1-1 sh executable version: fish, version 3.4.1 fzf version: v0.30.0 (2093667)

find version: v4.9.0 fd version: v8.3.2 ag version: - rg version: v13.0.0 fg version: - git version: v2.36.1 ctags version: -

andreyorst commented 2 years ago

Sorry for the delayed reply.

I don't use Kitty, so I can't really help here, but the error shows me that the terminal-tab command is not defined.

Can you use terminal-tab outside of fzf.kak? Maye something with kitty.kak not being loaded?

dssgabriel commented 2 years ago

Hi!

It indeed seems to be that kitty.kak is not loaded, as none of the commands defined in this file work/are recognized by Kakoune when run outside of fzf.kak.

I'm not sure what the fix is though? How can I manually load the missing kitty.kak on Kakoune's startup?

andreyorst commented 2 years ago

I believe it is loaded by the https://github.com/mawww/kakoune/blob/021da117cf90bf25b65e3344fa8e43ab4262b714/rc/windowing/detection.kak script. However, it will load only one of these modules, so I guess you'll have to manually specify that you're running Kitty.

I think its a question for upstream why kitty.kak is not loaded, but my wild guess would be that you have some other terminal that is found by the script above.

andreyorst commented 2 years ago

Perhaps something to do with this check:

evaluate-commands %sh{ [ -z "${kak_opt_windowing_modules}" ] || [ "$TERM" = "xterm-kitty" ] || echo 'fail Kitty not detected' }

Check what your TERM env. variable is set to

andreyorst commented 2 years ago

Perhaps something to do with this check:

evaluate-commands %sh{ [ -z "${kak_opt_windowing_modules}" ] || [ "$TERM" = "xterm-kitty" ] || echo 'fail Kitty not detected' }

Check what your TERM env. variable is set to

dssgabriel commented 2 years ago

Sorry for the delayed reply, I haven't had much time to look further into this.

It indeed seems that this issue is related with upstream, so I'm closing this one. From what I could test though, even when launching Kakoune with TERM=xterm-kitty kak, the check above fails. I don't know what's causing this. It seems that the windowing detection scripts aren't even called by Kakoune, as none of the alternatives defined in that module seem to be run. Thanks anyway!