Ad blocker interference detected!
Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers
Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.
created April 23, 2002 · complexity intermediate · author Kartik Agaram · version 6.0
This is just in case there's somebody else who likes to work in a maximized Vim window on a high resolution desktop. If you follow good coding practice and make sure your programs use only 80 characters in each row, have you noticed how much space lies unused on the right?
I find that the following settings keep me from ever seeing another horizontal split, unless I specifically ask for it.
cabbrev split vsplit cabbrev hsplit split cabbrev sta vertical sta cabbrev help vertical help cabbrev new vnew cabbrev right botright " A more heavyweight solution for ^W^] function! ToggleSplit (dir) let currFname = bufname ("%") let old = winnr () " Window navigation to ensure the correct window is 'last'. if (a:dir == "u") wincmd k let back="j" elseif (a:dir == "d") wincmd j let back="k" elseif (a:dir == "l") wincmd h let back="l" elseif (a:dir == "r") wincmd l let back="h" endif if (winnr () == old) echo "Ouch" return endif exec "wincmd " . back quit if (back == "j" || back == "k") let orientation = "vsplit" else let orientation = "split" endif if (back == "j" || back == "l") let dir = "below" else let dir = "above" endif exec dir . " " . orientation " " . currFname endfunction noremap ^W^] ^W^]:silent call ToggleSplit ("d")<CR>
In which case the above mapping becomes:
noremap ^W^] :set splitbelow<CR>^W^]:silent call ToggleSplit ("u")<CR>:set nosplitbelow<CR>
Or you could just
Very elegant and almost perfect, but it screws up if you want to run a command with ranges
noremap : :vertical<Space>