Commit 95743681 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Make Vim force vertical splits in wide format terminals

This change does not actually force vertical splits, which would
require a patch to (N)Vim, instead it reorganises the windows after
a new window opens, to approximate a vertical split.
parent 0aa10b9b
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
function! s:setorientation()
	" If an 80×24 terminal is approx. a 4:3 pixel ratio, assume a 1:1 pixel 
	" ratio is approx. a 1:2.5 cell ratio.
	augroup orientation
		if 1.0 * &columns / &lines > 2.5
			" Wide terminal
			execute 'au WinNew * wincmd' (&splitright ? 'L' : 'H')
		else
			" Narrow terminal, normal behaviour fine
			au! WinNew
		endif
	augroup END
endfunction

augroup orientation
	au!
	au VimEnter * call s:setorientation()
	au VimResized * call s:setorientation()
	au OptionSet splitright call s:setorientation()
augroup END