From 2b3fae1174b890b515004b3afd2067a1603187df Mon Sep 17 00:00:00 2001 From: Paul Walker Date: Wed, 23 Oct 2019 14:09:57 +0100 Subject: [PATCH] Add window horizontal/vertical toggle --- vimrc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/vimrc b/vimrc index dddac66..d2e3c86 100644 --- a/vimrc +++ b/vimrc @@ -374,3 +374,20 @@ function! PrintFile(fname) call delete(a:fname) return v:shell_error endfunction + +function! ToggleWindowHorizontalVerticalSplit() + if !exists('t:splitType') + let t:splitType = 'vertical' + endif + + if t:splitType == 'vertical' " is vertical switch to horizontal + windo wincmd K + let t:splitType = 'horizontal' + else " is horizontal switch to vertical + windo wincmd H + let t:splitType = 'vertical' + endif +endfunction + +nnoremap wt :call ToggleWindowHorizontalVerticalSplit() +