Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When loading session dwm changes buffers in windows past the third window #73

Open
count-ellington opened this issue Jul 10, 2020 · 1 comment

Comments

@count-ellington
Copy link

count-ellington commented Jul 10, 2020

If you load a previous session saved with a layout from the dwm plugin that looks like this


=====================================
|              |        B           | 
|              |====================|
|      A       |        C           | 
|              |====================|
|              |        D           | 
=====================================

Each window, past the third will be a copy of the third window, and the buffers will be rotated so that whatever buffer was last is now master, the second to last is now second and Master is now in the third slot Like below

=====================================
|              |        C           | 
|              |====================|
|      D       |        A           | 
|              |====================|
|              |        A           | 
=====================================

The buffer B will still be in the bufferlist but it will no longer be open in a window.

This is something that happens on the loading of the session. If the session is loaded without plugins you can see that it will load correctly. I also tested this with no other plugins besides vim-plug and dwm active and the problem persists.

@count-ellington
Copy link
Author

I actually figured out a solution. The dwm autocommand needs to be toggled off when a session is being loaded and then turned back on when the session is done being loaded. The following can be accomplished by adding this to the bottom of the code.

function! ToggleDwmAutogroup()
	if !exists('#dwm#BufWinEnter')
		augroup dwm
			au!
			au BufWinEnter * if &l:buflisted || &l:filetype == 'help' | call DWM_AutoEnter() | endif
		augroup end
	else
		augroup dwm
			au!
		augroup end
	endif
endfunction

au VimEnter * au SourcePre * call ToggleDwmAutogroup()
au VimEnter * au SourcePost * call ToggleDwmAutogroup()

An alternate solution, which I didn't see until I began typing this comment is to use the pull request from delphinus but change it from a buffer variable to a global variable (that is change b: to g:) and do the let command instead of calling the function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant