-
-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
winheight cannot be smaller than winminheight #4
Comments
Oh, I should mention... sessions load up without error if I remove those lines from my .vimrc |
Is the fundamental problem that you are restoring a big window into a smaller one? Perhaps |
Hmm, that didn't seem to help. I think something is setting winminheight=1 in the background somewhere which is what the conflict is, I just don't know what is setting that. Not a big deal though, I'm only experimenting with that split auto-resize functionality and am leaning towards ditching it anyway. Thanks for the suggestion. |
I'm having the same problem, but I really like the (essentially) "auto-resize to make current window big" functionality that these three lines together implement. Also I love this plugin. So I'm pretty keen on finding a solution :) In looking at the Session.vim file, it appears the "set winheight=1" line is setting things up for the lines that follow, which appear to restore the window configuration from the prior session:
I'm wondering if there's a way to perhaps change the "set winheight=1" line to something like "set winheight=minwinheight" instead? The other possibility I'm thinking is somehow make the three line winheight, minheight, winheight bit in the OP get executed after the Session.vim is finished? I don't know enough about the finer points of Vim yet, but perhaps putting it in some .after file or a special autocmd type of thingy? Would be very grateful for the cycles of your superior Vim brain to short-circuit to an workaround or fix, otherwise I'll have to put up with it until I get further along in my Vim education :) |
Okay. I couldn't stand the suspense. I know. It's a problem. I'm working on it. :) After noodling on the after bit for a few minutes I looked around and worked out a fix. If you put this in your .vimrc and move the winheight/minheight lines into this autocommand group it works:
|
@scanny nice! I'll give this a try too. Thanks for digging in :) |
@scanny huh, well this solution isn't working for me. I guess it stops the error messages, but then it also stops the autoresizing stuff too... any thoughts? Are you still using this? Thanks, |
Hi Jon, no, turned out that only worked long enough for me to think it was a solution. I still get the error messages now, I've just gotten used to them :) I tend to leave sessions up for days at a time, so it's not too big of a hardship. Sure would be nice if there was a fix though. I think it's going to take Pope cycles (distantly related to the Popemobile :) to get to the bottom of this one. Might need a post-plugin hook or something, I'm not sure who writes the Session.vim and when it gets sourced. |
Nah, I'm all into Ctrl-P for file/buffer navigation. When I occasionally need to see the directory structure I just use :e. and navigate that way. Those two give me what I need. Sessions are big for me. I have an alias 'e' set up in zsh that opens MacVim with the Session.vim in the current dir (project dirs mostly), so sessions are a pretty important feature in my world :) |
Gotcha, I use ctrl-p mostly too... for some reason I just feel more comfortable seeing the directory structure on the left. Actually it helps position the code close to the center of my screen too, which is nice when editing only one buffer. Anyway, do update us if you find a solution to those loading error messages! Thanks much. |
FWIW, GoldenView is a plugin which might setup winminheight (initially reported for session.vim). |
Anyone found a good workaround or is the current thinking just to ignore the errors? |
I've moved on to meta-ignoring. I've been ignoring the errors so long now that I started ignoring the fact I ignore them :) |
@scanny How do you ignore the error or did you find another way to solve it? It's very annoying!! I tried putting |
@jondkinney @scanny @blueyed @hiattp @lvarayut I've found a way to fix this. I'll be making a PR shortly to see what @tpope thinks of this. It's probably a little hackish, and I'm not sure if there are any unintended consequences of this, but in the little testing I've done it seems to work as expected. Inside of
to
The PR: #28 |
@boatrite |
@boatrite |
@boatrite: That works for me! I patched it in on the latest master and it seems to do the needful very cleanly. I would get the message every single time, so those lines seem to be placed in the session file systematically and unconditionally. I think it's a solid fix :) |
The following approach avoids window size errors which tend to occur when restoring sessions. * Store window height settings in functions. * Before exiting Vim (VimLeavePre), reset 'winminheight' and 'winheight' * After entering Vim (VimEnter), load custom settings. Reference: * tpope/vim-obsession#4 * :h 'winheight' * :h 'winminheight'
I've battled this issue for a long time and have tried a myriad of approaches to fixing it. I believe I've found a solution which does not require any alterations to to the vim-obsession plugin. Below are the relevant parts from my
|
@joshukraine Nice, I just added that to my .vimrc to try it out, and it definitely works as far as I can tell. My solution stopped working a while back for what that's worth. Not sure why. Thanks! Edit: I actually started getting a "Not enough room" error when I switched away from my branch to the regular vim-obsession. Still playing with this. Edit 2: So I ended up with the error still even with that snippet, so I took another look at my fix. I changed it to filter by regex and get rid of any lines matching "set winheight" or "set winminheight". master...boatrite:zb-fix-winheight-error Anyways, hope this helps any one else with this issue. |
An idea I just had: autocmd SourcePre Session.vim set minwinheight=1
autocmd SessionLoadPost * set minwinheight=5 This is probably oversimplified, but could be another piece in the autocmd puzzle. |
Nice plugin!
I have these settings in my .vimrc courtesy of Gary Bernhardt's Destroy All Software screencast series.
When I go to load up a saved session I receive the following error:
I'm not sure what is setting winheight=1, but that isn't in my .vimrc. Is that something this plugin is setting? It doesn't seem like it matters much, the sessions load fine, but it's obviously an eye sore / slow to have it error out each time I load up a saved session.
Thanks for taking a look!
The text was updated successfully, but these errors were encountered: