Skip to content

Commit

Permalink
Set bufhidden=hide instead of using :hide.
Browse files Browse the repository at this point in the history
'bufhidden' has higher precedence. :hide will not work if 'bufhidden' is
already set.
  • Loading branch information
dstein64 committed Jan 25, 2020
1 parent f49d54a commit 0cc507c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions autoload/win.vim
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ function! s:Swap(winnr)
let l:view1 = winsaveview()
" The following commands are executed in the context of window 2.
let l:commands = [
\ 'let l:bufhidden2 = &l:bufhidden',
\ 'setlocal bufhidden=hide',
\ 'let l:view2 = winsaveview()',
\ 'noautocmd silent hide ' . l:bufnr1 . 'buffer',
\ 'noautocmd silent ' . l:bufnr1 . 'buffer',
\ 'call winrestview(l:view1)'
\ ]
" The following handling can't be factored out to e.g., s:WinExecute,
Expand All @@ -76,8 +78,9 @@ function! s:Swap(winnr)
let &eventignore = l:eventignore
endtry
endif
execute 'silent hide ' . l:bufnr2 . 'buffer'
execute 'silent ' . l:bufnr2 . 'buffer'
call winrestview(l:view2)
let &l:bufhidden = l:bufhidden2
endfunction

function! s:GetChar()
Expand Down

0 comments on commit 0cc507c

Please sign in to comment.