Created
April 3, 2022 22:28
-
-
Save geofflangenderfer/0e8cede17f99edc7ed34a8980f84bf88 to your computer and use it in GitHub Desktop.
auto resize vim split panes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
" init.vim or .vimrc | |
function Splitresize() | |
let hmax = max([winwidth(0), float2nr(&columns*0.66), 90]) | |
let vmax = max([winheight(0), float2nr(&lines*0.66), 25]) | |
exe "vertical resize" . (min([hmax, 140])) | |
exe "resize" . (min([vmax, 60])) | |
endfunction | |
nnoremap <silent><C-J> <C-W><C-J>:call Splitresize()<CR> | |
nnoremap <silent><C-K> <C-W><C-K>:call Splitresize()<CR> | |
nnoremap <silent><C-L> <C-W><C-L>:call Splitresize()<CR> | |
nnoremap <silent><C-H> <C-W><C-H>:call Splitresize()<CR> | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment