vimpostor / vim-tpipeline

Embed your vim statusline in tmux
GNU General Public License v3.0
364 stars 10 forks source link

Tmux Status Bar Does Not Restore When Exiting Nvim And Does Not Update When Using Nvim #30

Closed CarbonChauvinist closed 2 years ago

CarbonChauvinist commented 2 years ago

Describe the bug

With latest two commits (a95ccb6 and 211c438) applied plugin does not appear to load properly. For instance the g:tpipeline_restore=1 setting breaks. Exiting nvim and my tmux statusline retains my nvim status line. I have to either restart my tmux server or resource my tmux.conf to get back normal non-nvim tmux status line.

Additionally, when starting nvim although my nvim statusline is drawn in my tmux status bar, it is static in the tmux status bar and for instance doesn't update when changing modes in nvim. There is a duplicate nvim status line and command-line above my tmux status bar and that is the "live" version that updates and expands etc. when using nvim's command-line.

Here's my packer config for the plugin:

  use({
    "vimpostor/vim-tpipeline",
    config = function()
      vim.cmd([[let g:tpipeline_restore=1]])
    end,
    --commit = "af7fe78523c7c860d00b79383908322fcb5e6133"
  })

If I pin the plugin to af7fe78, by uncommenting the commit line above, the plugin goes back to behaving as expected.

For sake of completeness here's my .tmux.conf

.tmux.conf ``` #Change default prefix to Ctrl-a unbind C-b set -g prefix C-a bind C-a send-prefix bind r source-file ~/.tmux.conf bind R run-shell 'tmux source-file ~/.tmux.conf 2>/dev/null; tmux display-message "(Re)sourced .tmux.conf!"' # Prefer vi style key table set -g mode-keys vi # status line setups set -g window-status-bell-style 'bold' set -g window-status-separator ' ' set -g status-style bg=default # window title colors non-active set -g window-status-style bg=terminal,dim #highlight active window set -w -g window-status-current-style bg=cyan,bright,fg=black,bold,italics #make widths constant with or without flags set -w -g window-status-current-format ' #I:#W#F ' set -w -g window-status-format ' #I:#W#{?#{==:#F,}, ,#F }' set -g pane-active-border-style "fg=colour148" set -g pane-border-style "fg=colour240" set -g status-right-length "90" set -g status-left-length "90" set -g status-left "#[fg=yellow,bold,italics]#S § #{prefix_highlight} " set -g status-right "#[fg=yellow,bold,italics]$USER@#h #[fg=magenta] %l:%M %p #[fg=blue,reverse] %y-%m-%d " set -g status-justify absolute-centre #prefix_highlight setup set -g @prefix_highlight_empty_prompt ' ' set -g @prefix_highlight_fg 'black,bold,italics' # default is 'colour231' set -g @prefix_highlight_bg 'magenta' # default is 'colour04' set -g @prefix_highlight_show_copy_mode 'on' set -g @prefix_highlight_copy_mode_attr 'fg=black,bg=yellow,bold,italics' # default is 'fg=default,bg=yellow' set -g @prefix_highlight_copy_prompt 'Cp' # open tmux-fzf-url in a tmux v3.2+ popup set -g @fzf-url-fzf-options '-p50%,50% --multi -0 --no-preview --no-border' # Make new windows/panes open to the current path instead of the path tmux was # started from bind '"' split-window -c "#{pane_current_path}" bind % split-window -h -c "#{pane_current_path}" #bind c new-window -c "#{pane_current_path}" #have new windows default to home path #To limit the scrollback buffer to 100000 lines: set -g history-limit 100000 #Terminal emulator window titles #If you SSH into a host in a tmux window, you'll notice the window title of your terminal emulator remains to be user@localhost rather than user@server. To allow the title bar to adapt to whatever host you connect to #For set-titles-string, #T will display user@host:~ and change accordingly as you connect to different hosts. set -g set-titles on # string shown on titlebars or programs such as 'wininfo' set -g set-titles-string "#T" # title format set -g automatic-rename on # name windows with , (sessions with $) # Start indices from 1 for both windows and panes. Makes it easier for # direct navigation. Also renumber windows. set -g base-index 1 set -g pane-base-index 1 set -g renumber-windows on set -g aggressive-resize on #manpage says "on" is bad for shells... #To use your mouse in this mode copy mode #As of tmux 1.5 this option makes using the scroll wheel automatically switch to copy mode and scroll back the tmux scrollback buffer. It is not necessary to first hit Ctrl-B + [ any more. Scrolling back down to the prompt also ends copy mode automatically. set -g mouse on #allow tmux to queue commands instantly (reduce time) set -s escape-time 0 # emacs key bindings in tmux command prompt (prefix + :) set -g status-keys emacs # focus events enabled for terminals that support them set -g focus-events on #Support True (24-bit) color #https://github.com/jwilm/alacritty/issues/109#issuecomment-507026155 set -g default-terminal "tmux-256color" set -ga terminal-overrides ",*256col*:Tc,alacritty:RGB,foot:RGB" # pane movements bind h select-pane -L bind j select-pane -D bind k select-pane -U bind l select-pane -R # window movements bind a last-window bind C-p previous-window bind C-n next-window # Copy selection on drag end event, but do not cancel copy mode and do not clear selection # clear select on subsequent mouse click #bind -T copy-mode-vi MouseDragEnd1Pane # send-keys -X copy-pipe "$yank" #bind -T copy-mode-vi MouseDown1Pane select-pane \; send-keys -X clear-selection # List of plugins set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-prefix-highlight' set -g @plugin 'wfxr/tmux-fzf-url' set -g @plugin 'laktak/extrakto' bind-key -T copy-mode-vi v send-keys -X begin-selection bind-key -T copy-mode-vi y send-keys -X copy-selection bind-key -T copy-mode-vi r send-keys -X rectangle-toggle #bind -t vi-copy y copy-pipe "wl-copy" # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) run -b '~/.tmux/plugins/tpm/tpm' ```

And an admittedly very dark screen grab of the issue

Screengrab example (sorry for quality)

To reproduce

Update to latest commit using :PackerSync then start nvim

Expected behavior

No response

Vim version

NVIM v0.8.0-dev+600-g034d28c705

Tmux version

tmux 3.3a

Terminal emulator

foot version: 1.12.1 +pgo +ime +graphemes -assertions

Debug output

{'right': ['#[fg=,bg=#103c48]#[fg=#93a1a1,bg=#103c48] unix #[fg=#002b36,bg=#93a1a1] 100% #[fg=#002b36,bg=#268bd2,bold]   0:1  '], 'nativ
e_str': ' NORMAL  [No Name]                                                                                                   unix  100%
    0:1  ', 'left': ['#[fg=,bg=#103c48]#[fg=#002b36,bg=#268bd2,bold] NORMAL #[fg=#93a1a1,bg=#103c48,nobold] [No Name] #[fg=#93a1a1,bg=#1
03c48]'], 'native_highlights': [{'group': 'lualine_a_normal', 'start': 0}, {'group': 'lualine_c_normal', 'start': 8}, {'group': 'lualine
_c_normal', 'start': 19}, {'group': 'lualine_c_normal', 'start': 116}, {'group': 'lualine_b_normal', 'start': 122}, {'group': 'lualine_a
_normal', 'start': 128}]}
vimpostor commented 2 years ago

Thanks for the detailed bug report!

It looks like the UIEnter autocmd is triggered even for neovim inside a terminal... I will have to find a better way to detect GUI neovim.