PatrickF1 / fzf.fish

πŸ”πŸŸ Fzf plugin for Fish
MIT License
1.96k stars 78 forks source link

Error which appears in every preview: "can't find session" #289

Closed DakEnviy closed 1 year ago

DakEnviy commented 1 year ago

Before proceeding...

Describe the bug

When tmux is running:

Error message appears in every preview. Error message format: can't find session: <some_number>

Π‘Π½ΠΈΠΌΠΎΠΊ экрана ΠΎΡ‚ 2023-01-11 12-13-31 Π‘Π½ΠΈΠΌΠΎΠΊ экрана ΠΎΡ‚ 2023-01-11 12-14-24

Without tmux:

Error message appears in every preview. Error message: no server running on /tmp/tmux-1000/default

Π‘Π½ΠΈΠΌΠΎΠΊ экрана ΠΎΡ‚ 2023-01-11 12-17-47

Steps to reproduce

Just run any command with preview.

Environment

Versions installed:

Which, if any, configuration variables such as fzf_preview_file_cmd are set?

set fzf_preview_dir_cmd exa -la --group-directories-first --icons --no-permissions --no-user --no-filesize --no-time
set fzf_fd_opts --hidden --exclude=.git
PatrickF1 commented 1 year ago

Does that error happen if you spawn a new fish shell. e.g. fish while in a fish session?

PatrickF1 commented 1 year ago

This might be relevant. https://github.com/PatrickF1/fzf.fish/wiki/Troubleshooting#error-text-being-printed-on-topbottom-of-fzf-previews

DakEnviy commented 1 year ago

Yeah, you are right. Thank you for your help! I have this configuration for tmux:

alias tn 'tmux new-session -s $fish_pid'
trap 'tmux kill-session -t $fish_pid' EXIT

The problem was this. My fix is:

alias tn 'tmux new-session -s $fish_pid'

if status is-interactive
    trap 'tmux kill-session -t $fish_pid' EXIT
end

Do you think that is good enough?

PatrickF1 commented 1 year ago

Yes, that's perfect! In my own dotfiles (https://github.com/PatrickF1/dotfiles/blob/main/.config/fish/config.fish#L28), I do status is-interactive || exit and put everything for interactive use below it.