I am trying to get VIM to revert to it's default split window sizes, after I
have changed the default split window sizes.
For some reason, I keep getting a "E36: Not enough room" error when trying to
revert to defaults for winminheight=1! As such, I assign this setting a
winminheight=0 to avert or avoid this error. But I still do not get equally
sized windows, so I must further statically assign window sizes to get
something similar to VIM defaults when viewing two text files within a
vertically split session. (I haven't even begun to think about more than two
text files, as I usually just use tabs or a tabbed session when viewing more
than two files from within a VIM instance.)
Below are the settings I'm using.
In lamens terms - The two set statements should toggle a customized split
window session and a default split window sized session.
# Give me customized window split views.
# Resizing the window to only show the focused window, with the smallest window size view of the other window indicating split windows are present.
set nowinfixwidth nowinfixheight noequalalways eadirection=both winminheight=1 winminwidth=1 winwidth=9999 winheight=999 helpheight=999 cmdwinheight=999 previewheight=999
# This line contains the default values of the above statement variables, and should revert to an equally sized window split views within the session or instance of VIM.
set nowinfixwidth nowinfixheight equalalways eadirection=both winminheight=1 winminwidth=1 winwidth=20 winheight=1 helpheight=20 cmdwinheight=7 previewheight=12
Also, you may notice some variables do not change their values, but are
required to be entered in order to get the proper split window effect for some
odd reason. Using ":set winfixwidth?" (along with other duplicated variable
initializing) does show the variables area already initialized prior to the
other variables being altered. This secondary issue is more of a minimal issue
compared to my previously mentioned problem, and this secondary issue is just
worked around by duplicating resetting or reinitilizing the variables to the
same value.
For those wanting the above within their vimrc, below is my .vimrc snippet
encapsuling the above within a function for toggling using the F6 key. Works
pretty good, albeit using some static values for checking to see if resizing
has been attempted. (Omit the commented lines, as they're there for my viewing
pleasure.;-)
$HOME/.vimrc
" Toggle Window Width/Height Auto Resizing
" {
function WindowAutoResize()
"{
" Check for default window sizes, or some values set by this function
if &winwidth==20 || &winheight==1 || &winwidth==90 || &winheight==27
set nowinfixwidth nowinfixheight
set noequalalways eadirection=both
set winminheight=1 winminwidth=1
set winwidth=9999 winheight=999
set helpheight=999 cmdwinheight=999 previewheight=999
else
" Try to revert to default values, or equally split windows
set nowinfixwidth nowinfixheight " Defaults
set equalalways eadirection=both " Defaults
"set winminheight=1 winminwidth=1 " Defaults
"set winwidth=20 winheight=1 " Defaults
"set helpheight=20 cmdwinheight=7 previewheight=12 " Defaults
set winminheight=0 winminwidth=1 " Try to avert "E36: Not enough room" error
set winwidth=90 winheight=27 " Try to avert "E36: Not enough room" error
set helpheight=20 cmdwinheight=7 previewheight=12 " Defaults
endif
endfunction
"}
" F6 toggles Window Width/Height Resizing
" (Auto resizing on by default.)
" Following are default settings
"map <F6> :set nowinfixwidth nowinfixheight equalalways eadirection=both winminheight=1 winminwidth=1 winwidth=20 winheight=1 helpheight=20 cmdwinheight=7 previewheight=12<CR>
" Following resizes windows to full width/heigth
"map <F6> :set nowinfixwidth nowinfixheight noequalalways eadirection=both winminheight=1 winminwidth=1 winwidth=9999 winheight=999 helpheight=999 cmdwinheight=999 previewheight=999<CR>
"map <F6> :set nowinfixwidth nowinfixheight noequalalways eadirection=both winminheight=1 winminwidth=1 winwidth=9999 winheight=999 helpheight=999 cmdwinheight=999 previewheight=999<CR>
"map <F6> :set winwidth=9999 winheight=999 helpheight=999 cmdwinheight=999 previewheight=999<CR>
"map! <F6> :set winwidth=9999 winheight=999 helpheight=999 cmdwinheight=999 previewheight=999<CR>
" }
" F6 -> TOGGLE WINDOW WIDTH/HEIGHT AUTO RESIZING
nnoremap <silent><F6> :call WindowAutoResize()<CR>
--
Roger
http://rogerx.freeshell.org/
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Thursday, November 21, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment