In Vim, is it possible to “move” a window to the left or right? Eg, similar to or , but left/right instead of up/down?>
It really seems like vim can't do this with the standards key maps. The documentation says that the ^W K, J, H and L commands work by creating the split and opening the buffer in the now position, so I wrote a function to the same: Hide the buffer, move to the left, split, and then open the original buffer:
" Rotate a window horizontally to the left
function! RotateLeft()
let l:curbuf = bufnr('%')
hide
wincmd h
split
exe 'buf' l:curbuf
endfunc
" Rotate a window horizontally to the right
function! RotateRight()
let l:curbuf = bufnr('%')
hide
wincmd l
split
exe 'buf' l:curbuf
endfunc