motiejus/dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.jakstys.lt/motiejus/dotfiles.git
Log | Tree | Refs | README | LICENSE

commit da30818d177b1a04f2ed0eb253e1414bdb19e957 (tree)
parent ab57abf1d066c83a1bac20ab9830463396b10d02
Author: Tim Pope <code@tpope.net>
Date:   Thu, 23 Dec 2021 14:27:51 -0500

Resize EDITOR window automatically when necessary

Resolves: https://github.com/tpope/vim-fugitive/issues/1907

Diffstat:
Mautoload/fugitive.vim | 14++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim @@ -3269,7 +3269,17 @@ function! s:RunEdit(state, tmp, job) abort call remove(a:state, 'request') let sentinel = a:state.file . '.edit' let file = FugitiveVimPath(readfile(sentinel, '', 1)[0]) - exe substitute(a:state.mods, '\<tab\>', '-tab', 'g') 'keepalt split' s:fnameescape(file) + try + if !&equalalways && a:state.mods !~# '\<tab\>' && 3 > (a:state.mods =~# '\<vert' ? winwidth(0) : winheight(0)) + let noequalalways = 1 + setglobal equalalways + endif + exe substitute(a:state.mods, '\<tab\>', '-tab', 'g') 'keepalt split' s:fnameescape(file) + finally + if exists('l:noequalalways') + setglobal noequalalways + endif + endtry set bufhidden=wipe let bufnr = bufnr('') let s:edit_jobs[bufnr] = [a:state, a:tmp, a:job, sentinel] @@ -6494,7 +6504,7 @@ function! fugitive#Diffsplit(autodir, keepfocus, mods, arg, ...) abort return 'echoerr ' . string(v:exception) finally if exists('l:equalalways') - let &l:equalalways = equalalways + let &g:equalalways = equalalways endif if exists('diffopt') let &diffopt = diffopt