Skip to content

Commit

Permalink
Automatically restore winfixwidth when leaving the buffer (#517)
Browse files Browse the repository at this point in the history
  • Loading branch information
lambdalisue authored Jan 6, 2025
1 parent 56f7c0d commit 4f9694b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions autoload/fern/internal/drawer/auto_winfixwidth.vim
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ function! fern#internal#drawer#auto_winfixwidth#init() abort
augroup fern_internal_drawer_auto_winfixwidth_init
autocmd! * <buffer>
autocmd BufEnter <buffer> call s:set_winfixwidth()
autocmd BufWinLeave <buffer> call s:restore_winfixwidth()
augroup END
endfunction

function! s:set_winfixwidth() abort
let &l:winfixwidth = winnr('$') isnot# 1
endfunction

function! s:restore_winfixwidth() abort
let &l:winfixwidth = 0
endfunction

0 comments on commit 4f9694b

Please sign in to comment.