jarun / nnn

n³ The unorthodox terminal file manager
BSD 2-Clause "Simplified" License
19.1k stars 760 forks source link

'size missing' when trying to preview-tui in tmux #1812

Closed sakarimov closed 7 months ago

sakarimov commented 8 months ago

Environment details (Put x in the checkbox along with the information)

[[ -r "/usr/share/z/z.sh" ]] && source /usr/share/z/z.sh

- [ x ] Configuration options set:

export NNN_FIFO=/tmp/nnn.fifo
export NNN_PLUG='c:fzcd;s:rsynccp;r:renamer;m:nmount;p:preview-tui'
export NNN_TERMINAL='konsole'


- [ x ] tmux config:

change command binding

unbind C-b set -g prefix C-Space bind C-Space send-prefix

change windows base index to start from 1 not 0

set -g base-index 1 set -g pane-base-index 1 set-window-option -g pane-base-index 1 set-option -g renumber-windows on

set vi-mode

set-window-option -g mode-keys vi

keybindings

bind-key -T copy-mode-vi v send-keys -X begin-selection bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel

set -g @plugin 'olimorris/tmux-pomodoro-plus' set -g @plugin 'catppuccin/tmux' set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @plugin 'tmux-plugins/tmux-continuum' set -g @plugin 'tmux-plugins/tmux-logging' set -g @plugin 'tmux-plugins/tmux-pain-control' set -g @plugin 'tmux-plugins/tmux-sessionist'

set -g mouse on

pomodoro setup

set -g status-right "#{pomodoro_status}" set -g @pomodoro_sound 'on'

catppuccin setup

set -g @catppuccin_flavour "frappe"

nnn config

set -g allow-passthrough on set -g escape-time 0

run '~/.tmux/plugins/tpm/tpm'



#### Exact steps to reproduce the issue
i just finished installing nnn, and set minimal config, when i try to use preview-tui inside tmux i got this ```size missing```  error
![image](https://github.com/jarun/nnn/assets/5676876/52e525d2-e6e8-4483-ae6a-4012feda5a2f)

but, when i try to use preview-tui without tmux, everything run as expected, is there something i missed, since i read in the documentation that for dual-panel nnn will work firstly on tmux
sakarimov commented 7 months ago

after a bunch of trial and error, i found that the problem is with newest tmux with sixel, and still cannot find any solution for this issue. but i also found that nnn works very well when i want to preview files preview-tabbed, thank's to all devs on it, i'll close this issue

image this is preview-tui inside tmux, nnn-nerd

image this is live preview-tabbed inside tmux, nnn-nerd

XhstormR commented 7 months ago

I have the same issue after upgrade tmux version to 3.4.

rennsax commented 7 months ago

+1 for this problem, using Tmux 3.4.

aketawi commented 7 months ago

Seems that the -p option for splitting panes in tmux is now gone, which is what the plugin uses. The simple fix I found is to use -l instead as suggested here: https://github.com/tmux/tmux/issues/3836#issuecomment-1941801438

On line 165 of preview-tui in your plugins directory change ... -p "$NNN_SPLITSIZE ..." to ... -l "$NNN_SPLITSIZE" ... so that the full line looks like

            tmux split-window "${ENVVARS[@]}" -d"$split" -l"$NNN_SPLITSIZE" "$0" "$1" ;;

although reading further, seems that this is just a temporary bug in 3.4: https://github.com/tmux/tmux/issues/3836#issuecomment-1945034174

rennsax commented 7 months ago

@aketawi Thank you very much! It works for me. But I find the size of the new pane is a little weird. Maybe your advise can serve as a temporary workaround :) image

XhstormR commented 7 months ago

https://github.com/tmux/tmux/pull/3840


Update: After I re-downloaded the preview-tui plugin script, the error disappeared. I don't know why, but it worked.

curl 'https://raw.githubusercontent.com/jarun/nnn/master/plugins/preview-tui' -o '/Users/user/.config/nnn/plugins/preview-tui'
rennsax commented 7 months ago

Oh yes, in the newer version, the plugin has fixed this problem. Anyone who has the same problem can try to upgrade the version of plugins.