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

buggy in Tmux #279

Open
stevalkr opened this issue Feb 22, 2025 · 9 comments
Open

buggy in Tmux #279

stevalkr opened this issue Feb 22, 2025 · 9 comments

Comments

@stevalkr
Copy link

  1. In the lua/image/utils/tmux.lua file, tmux commands are executed through a shell. However, it’s quite common to create aliases for tmux to execute default commands, layouts, or SetUserVars, among other things. Unfortunately, this practice can break all the functionalities if any output is written to the stdout. It might be better to not use a shell by default.
  2. When I open any file inside tmux, the buffer is modified, and a file can\’t\ find\ window:\ \'0\' is created under the current working directory. This issue persists even with (1) fixed, and I haven’t found the reason yet.
@UnaTried
Copy link
Contributor

Do you have passthrough enabled?

@stevalkr
Copy link
Author

Do you have passthrough enabled?

Yes, this is my tmux config:

set -s  extended-keys on
set -g  default-terminal 'tmux-256color'
set -as terminal-features 'xterm*:extkeys'
set -a  terminal-features 'xterm-256color:RGB'

set -g mouse on
set -g mode-keys vi
set -g status-keys vi
set -g visual-activity off
set -gq allow-passthrough on

@UnaTried
Copy link
Contributor

What terminal do you use, do you have ueberzug setup (if you use it)?

@stevalkr
Copy link
Author

stevalkr commented Feb 23, 2025

I use Wezterm and also tried Kitty, both of which have the same issue. (I don’t need ueberzug for these two, right?)

@UnaTried
Copy link
Contributor

no

@stevalkr
Copy link
Author

stevalkr commented Feb 25, 2025

The second issue might be related to neovim and tmux themselves. check neovim/neovim#32609. It just happened after I installed image.nvim.

However, I still wish we could address issue 1. Changing the command string into a list of arguments would work.

@UnaTried
Copy link
Contributor

UnaTried commented Feb 28, 2025

I tried using ueberzugpp with foot, ghostty and alacritty and it worked perfectly fine. When I tried using ghostty with the kitty backend the view jumps a bit if the cursor gets close to the image. that is something that shouldn't happen, because it doesn't with ueberzug @stevalkr

@UnaTried
Copy link
Contributor

UnaTried commented Feb 28, 2025

It also happens without tmux, in KGP terminal! What you explained doesn't happen to me though, so it might be correct, that its related to neovim and tmux themselves

@stevalkr
Copy link
Author

stevalkr commented Mar 1, 2025

@UnaTried, could you reproduce the first issue I mentioned? In my fish configuration, I have an alias defined as follows:

# functions/tmux.fish
function tmux
    function __fish_set_user_var
        if type -q base64
            printf "\033]1337;SetUserVar=%s=%s\007" "$argv[1]" (echo -n "$argv[2]" | base64)
        end
    end

    __fish_set_user_var IS_TMUX true

    command tmux $argv

    __fish_set_user_var IS_TMUX false
end

And this would break image.nvim. It’s quite straightforward to implement the same in zsh and bash.

If there’s no specific reason to execute commands in a shell, I’ll open a pull request to address this issue.

local has_passthrough = false
if is_tmux then
local ok, result = pcall(vim.fn.system, "tmux show -Apv allow-passthrough")
if ok and (result:sub(-3) == "on\n" or result:sub(-4) == "all\n") then has_passthrough = true end
end

:h system():

If {cmd} is a List it runs directly (no 'shell').
If {cmd} is a String it runs in the 'shell'.

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

2 participants