jarun/nnn

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

sakarimov opened this issue · 7 comments

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

  • [ x ] Operating System:
    Archlinux x86_64

  • [ x ] Desktop Environment:
    i'm using qtile (window manager)

  • [ x ] Terminal Emulator:
    konsole 23.08.4

  • [ x ] Software Versions:
    bash with tmux next-3.4 (tmux-sixel-git on aur)
    nnn 4.9 (nnn-nerd on aur)

  • [ x ] Program options used:

n() {                                                                                                                                                        
        # if [ -n "$TMUX" ]; then                                                                                                                            
        #       nnn -a $@                                                                                                                                   
        # else                                                                                                                                              
        #       tmux new-session nnn -a $@                                                                                         
        # fi                                                                                                                                                 
        # Block nesting of nnn in subshells                                                                                                                  
        [ "${NNNLVL:-0}" -eq 0 ] || {                                                                                                                        
                echo "nnn is already running"                                                                                                                
                return                                                                                                                                       
        }                                                                                                                                                    
                                                                                                                                                             
        # The behaviour is set to cd on quit (nnn checks if NNN_TMPFILE is set)                                                                              
        # If NNN_TMPFILE is set to a custom path, it must be exported for nnn to                                                                             
        # see. To cd on quit only on ^G, remove the "export" and make sure not to                                                                            
        # use a custom path, i.e. set NNN_TMPFILE *exactly* as follows:                                                                                      
        #      NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"                                                                                    
        export NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"                                                                                    
                                                                                                                                                             
        # Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn                                                                                     
        # stty start undef                                                                                                                                   
        # stty stop undef                                                                                                                                    
        # stty lwrap undef                                                                                                                                   
        # stty lnext undef                                                                                                                                   
                                                                                                                                                             
        # The command builtin allows one to alias nnn to n, if desired, without                                                                              
        # making an infinitely recursive alias                                                                                                               
        command nnn "$@"                                                                                                                                     
                                                                                                                                                             
        [ ! -f "$NNN_TMPFILE" ] || {                                                                                                                         
                . "$NNN_TMPFILE"                                                                                                                             
                rm -f "$NNN_TMPFILE" >/dev/null                                                                                                              
        }                                                                                                                                                    
}                                                                                                                                                            
                                                                                                                                                             
[[ -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

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

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

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

+1 for this problem, using Tmux 3.4.

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: tmux/tmux#3836 (comment)

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: tmux/tmux#3836 (comment)

@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

tmux/tmux#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'

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.