tmux-resurrect icon indicating copy to clipboard operation
tmux-resurrect copied to clipboard

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

Open dylan-chong opened this issue 7 years ago • 21 comments

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

dylan-chong avatar Dec 22 '17 07:12 dylan-chong

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

deepakjois avatar Jan 04 '18 14:01 deepakjois

Did you try vanilla NeoVim.. no plugins etc?

bruno- avatar Jan 10 '18 14:01 bruno-

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

deepakjois avatar Jan 10 '18 14:01 deepakjois

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.

deepakjois avatar Jan 20 '18 04:01 deepakjois

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

dylan-chong avatar Jan 21 '18 00:01 dylan-chong

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

Starefossen avatar Feb 19 '18 19:02 Starefossen

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.

Darren-Haynes avatar Jun 06 '18 02:06 Darren-Haynes

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

dylan-chong avatar Aug 28 '18 09:08 dylan-chong

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

dylan-chong avatar Aug 31 '18 23:08 dylan-chong

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 avatar Nov 07 '18 09:11 tanc

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

set-window-option -g aggressive-resize

tanc avatar Nov 07 '18 09:11 tanc

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

sfpmld avatar Dec 14 '18 19:12 sfpmld

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.

Darren-Haynes avatar Feb 16 '19 19:02 Darren-Haynes

@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 avatar Feb 17 '19 19:02 dylan-chong

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

dylan-chong avatar Feb 26 '19 07:02 dylan-chong

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.

comicsads avatar Mar 13 '19 13:03 comicsads

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.

joerideg avatar Apr 15 '19 13:04 joerideg

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.

PaddiM8 avatar Jul 07 '19 00:07 PaddiM8

i have the same problem with vim.

pantosaur avatar Sep 13 '19 03:09 pantosaur

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 avatar Oct 20 '21 14:10 yahyaanwar

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

yahyaanwar avatar Oct 20 '21 14:10 yahyaanwar