-
-
Notifications
You must be signed in to change notification settings - Fork 117
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
:q only disables Goyo #16
Comments
Hi, thanks for your interest in Goyo. Actually it's intended behavior. I designed Goyo to work like an ordinary tab, which you can open with |
Thanks for the reply! I get your point but as far as I'm concerned my muscle memory is too used to quitting single windows with |
Fair enough, for your information, you can use |
lovely plugin! But I agree with mm2703.
as far as I'm concerned (of course ~95% are mm2703) feel free to add this your customization page in the wiki. |
Will do, thanks! To explain the reasoning behind the default behavior is that I see Goyo as a "mode" (like "zen mode" from other editors) which I can quickly switch on and off during an editing session. But of course you can have a different point of view. |
No need to explain :) But me for example I configured mutt (the email client) to open vim in Goyo mode right away. And from there I want to close vim right away. And of course mm2703 has a point with the muscle memory. Anyway: I am happy as it is but i would, of course, prefer to have this as an "official" config option. I don't know if I'll ever have the time to do this but if I implemented this "properly" would you be willing to pull? (wouldn't want to implement something that you don't want to have in your code base in the first place) |
Thanks, but I think an additional option is unnecessary as we already have a workaround. function! g:goyo_before()
let b:quitting = 0
autocmd QuitPre <buffer> let b:quitting = 1
endfunction
function! g:goyo_after()
" Quit Vim if this is the only remaining buffer
if b:quitting && len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1
qa
endif
endfunction
let g:goyo_callbacks = [function('g:goyo_before'), function('g:goyo_after')] (EDIT: Updated to quit only on |
ok thanks. I'll try the new version as soon as I'm able |
I would like to point out that the workaround works when you simply type |
not sure why but the workaround also breaks ":q!" some situations |
Strange, I don't see any issue with both cases you mentioned. If you could provide me with a script that reproduces the problem, I'll take a look. |
One thing I noticed it that QuitPre event was added and bug-fixed pretty recently. Maybe you're running a slightly older version of Vim?
|
As far as I'm concerned I'm running MacVim, I don't think there's a way I can update it? |
@junegunn: sorry. I was a bit vague :/ Yes. I'm running 7.3. with the corrections 1-547 The situation is this:
I'm nowhere good enough in vimscript to debug this. But it sure looks like the workaround is being run prematurely. |
@mm2703 You mean the system-default Vim (/usr/bin/vim) that comes with OSX? I'm running Mavericks and the default Vim doesn't even have QuitPre:
Installing a newer version of vim and macvim is trivial if you use Homebrew, @axelGschaider I see what you're getting at. Just change If you don't mind Vim quitting not just on function! g:goyo_before()
endfunction
function! g:goyo_after()
" Quit Vim if this is the only remaining buffer
if len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1
qa
endif
endfunction
let g:goyo_callbacks = [function('g:goyo_before'), function('g:goyo_after')] |
@axelGschaider Hmm, changing it to |
@axelGschaider Try this: function! g:goyo_before()
let b:quitting = 0
let b:quitting_bang = 0
autocmd QuitPre <buffer> let b:quitting = 1
cabbrev <buffer> q! let b:quitting_bang = 1 <bar> q!
endfunction
function! g:goyo_after()
" Quit Vim if this is the only remaining buffer
if b:quitting && len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1
if b:quitting_bang
qa!
else
qa
endif
endif
endfunction
let g:goyo_callbacks = [function('g:goyo_before'), function('g:goyo_after')] |
@junegunn wonderfull. Works like a charm. Very nice.
|
This is great! Many thanks to everyone who solved this problem. It works when I launch vim and then run However, when I launch vim with...
The I'd like this to work, specifically for when I launch vim from mutt, or from vim-anywhere. In both cases I'd like Goyo to be active from the start, and for I'm not sure where to look from here! |
Arg, please disregard. It was user error. 👎 |
@mwcz Okay. And please note that the recent version of Vim requires a function name to start with an uppercase letter, so you might want to change the names of the callback functions accordingly. e.g |
@junegunn Interesting, thanks. I'm using Vim 7.4 and the lower-case |
@mwcz Yeah, it was very recently changed, April this year. See: ftp://ftp.vim.org/pub/vim/patches/7.4/7.4.260 |
this allows for setting custom goyo callbacks in addition to the zenroom ones. This is useful for adding workarounds like the one mentioned in junegunn/goyo.vim#16. Right now those custom callbacks would get overwritten, this change makes it append the callbacks.
@kminh Then Goyo is closed but you still stay in Vim, right? I didn't intend it but I don't know how to "fix" it. Let me know if you find a workaround. |
@junegunn Vim is closed as well if that's the last buffer, so everything seems correct, except that the warning message ("Save changes to ....? Yes, No, Cancel") is not shown under ":q". It seems to be hidden somewhere (perhaps in the original tab?) |
Hi,
First of all, this is an excellent plugin. There's just one minor problem I'm having with it, it's that when Goyo is active
:q
doesn't quit but simply closes Goyo. Therefore two quits are needed to really quit. I've "fixed" it this way but I'm thinking maybe there is a cleaner way to do it?What do you think?
Thank you and best regards,
Maxime.
The text was updated successfully, but these errors were encountered: