tmux-plugins / tmux-resurrect

Persists tmux environment across system restarts.
MIT License
11.4k stars 424 forks source link

Restoring session with vim in a split - neovim is not sized properly #223

Open dylan-chong opened 6 years ago

dylan-chong commented 6 years ago

If i save, killed the tmux server, restart tmux, and restore the session, neovim will not fill up the entire split

screen shot 2017-12-22 at 8 52 12 pm 3

If the vim is taking up the entire screen (not in a split when session is saved), then the bug above does not happen

deepakjois commented 6 years ago

For me, it happens even if the window with NeoVim has only one pane (w/ no splits)

screenshot from 2018-01-04 20-10-53

bruno- commented 6 years ago

Did you try vanilla NeoVim.. no plugins etc?

deepakjois commented 6 years ago

I tried vanilla NeoVim, and it is the same result.

deepakjois commented 6 years ago

Here is some additional info and workaround that may help in figuring out the underlying cause.

I use Tilix on Gnome as my terminal applicaton. The default size of the terminal application is 24x80. But I tend to make it full screen/vertically maximized as soon as it launches. All the reports above are after I had maximised the size of the terminal application.

However, just now I launched tmux first, before resizing, and the problem did not occur. I resized the terminal application after that, and neovim was sized properly even after that.

I am not sure, but this leads me to suspect that there is some issue in the way tmux/tmux-resurrect is reporting the size of the terminal to the underlying application.

dylan-chong commented 6 years ago

Is there some way we can tell tmux to tell all of its panes that their sizes have changed? If so , then we can do some hacky thing that tells all panes to resize after the restore has completed

Starefossen commented 6 years ago

Same problem with NVIM v0.2.2. Use :redraw to manually have vim redraw correctly after being resurrected.

Darren-Haynes commented 6 years ago

I am having the same issues. If I use vim or neovim, with or without splits - the whole split is not filled and renders incorrectly too. Overlapping lines and big spaces between lines. Im using ressurect with obsession.vim.

:redraw has no effect.

dylan-chong commented 6 years ago

This issue seems to have gone away in the last few months. Maybe this was fixed accidentally in nvim 0.3

dylan-chong commented 6 years ago

ignore my previous comment. this problem just happened to me again

tanc commented 6 years ago

Also happens to me when restoring. Sometimes I can move the cursor up and down the vim window and it will kind of grow back to size. Using :redraw does not fix it.

tanc commented 6 years ago

Looks like adding the following to .tmux.conf has fixed it:

set-window-option -g aggressive-resize
sfpmld commented 5 years ago

Agressive-resize didn't worked for me with nvim resizing inside tmux :/

Darren-Haynes commented 5 years ago

I have found the solution to my issue and it was neither an issue with neovim or tmux. The vim airline status bar plugin is what was causing me the issue - https://github.com/vim-airline/vim-airline

I removed the airline plugin and then tested tmux and neovim using several different terminals - uxterm, termite, alacritty and urxvt - and neovim rendered correctly in a window with multiple panes.

Thus, I figured on trying a different status bar plugin - https://github.com/itchyny/lightline.vim - this status bar works just fine too. So pretty sure it's just vim airline that is the issue.

@dylan-chong @deepakjois Looking at some of the screen shots here - it looks like you guys are using the vim airline plugin too. Try lightline plugin instead and see what your results are.

dylan-chong commented 5 years ago

@Darren-Haynes Thanks so much for finding this out! I will have to try this at some point whenever i get the chance

dylan-chong commented 5 years ago

I have tried commenting out the vim airline plug in and can still replicate the bug

Just a note for anyone trying to replicate the bug in the future, it seems to help to replicate the bug if you resize the terminal window while it is restoringYet

comicsads commented 5 years ago

I have also gotten this bug, as far as I can tell, I'm on vanilla neovim (installed from Ubuntu repos, haven't tried to install any plugins.) This problem usually happens when I have two neovim sessions on two different windows.

joerideg commented 5 years ago

I can confirm that @comicsads . The problem for me only occurs when having 2 or more tmux windows have vim active when closing the terminal. After restarting the terminal and the resurrect happens only the first tmux window with vim has the wrong sizing.

PaddiM8 commented 5 years ago

I am also having this problem. I feel like it could be solved if resurrect opened vim differently, since it works fine when re-opened manually.

pantosaur commented 5 years ago

i have the same problem with vim.

yahyaanwar commented 3 years ago

I have found the solution to my issue and it was neither an issue with neovim or tmux. The vim airline status bar plugin is what was causing me the issue - https://github.com/vim-airline/vim-airline

I removed the airline plugin and then tested tmux and neovim using several different terminals - uxterm, termite, alacritty and urxvt - and neovim rendered correctly in a window with multiple panes.

Thus, I figured on trying a different status bar plugin - https://github.com/itchyny/lightline.vim - this status bar works just fine too. So pretty sure it's just vim airline that is the issue.

@dylan-chong @deepakjois Looking at some of the screen shots here - it looks like you guys are using the vim airline plugin too. Try lightline plugin instead and see what your results are.

I have no luck after removing airline. image

yahyaanwar commented 3 years ago

I can confirm that @comicsads . The problem for me only occurs when having 2 or more tmux windows have vim active when closing the terminal. After restarting the terminal and the resurrect happens only the first tmux window with vim has the wrong sizing.

After read this, I tried to open my nvim at second pane and the issue gone. image