Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save geofflangenderfer/0e8cede17f99edc7ed34a8980f84bf88 to your computer and use it in GitHub Desktop.
Save geofflangenderfer/0e8cede17f99edc7ed34a8980f84bf88 to your computer and use it in GitHub Desktop.
auto resize vim split panes
```
" 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