Skip to content
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

how to enable goyo when start vim? #247

Open
xukongwen opened this issue Feb 6, 2021 · 8 comments
Open

how to enable goyo when start vim? #247

xukongwen opened this issue Feb 6, 2021 · 8 comments

Comments

@xukongwen
Copy link

thanks!

@christopherisnow
Copy link

See h: Buf

@shaunsingh
Copy link

If you want to run any command on start with vim, you can use an autocmd. In this case, you could put the following line in your .vimrc

autocmd vimenter * Goyo

which would run the command :Goyo as soon as vim starts up

I highly recommend looking through a bit of the documentation, as it makes tinkering around with vim much easier in the long run~

@scammi
Copy link

scammi commented Apr 27, 2021

Thank you.

I needed markdown files to be open with Goyo. Super simple.

autocmd vimenter *.md Goyo

@ghost
Copy link

ghost commented Jul 18, 2021

How to avoid typing ":q!" twice to exit?

@sicr0
Copy link

sicr0 commented Nov 10, 2021

@leontepe I am having the same question. Did you found any solution?

@zach-is-my-name
Copy link

zach-is-my-name commented Mar 7, 2022

@leontepe @sicr0 when I can remember to do it i use :qa short for "quit all". Vim should check if you have any unsaved buffers before exiting. Caveat - because I use buffers, when I type :q I'm quitting vim not closing a tab or window.

@jonulrich
Copy link

jonulrich commented Jun 16, 2023

How to avoid typing ":q!" twice to exit?

Just in case anyone has not found a workaround yet:

let s:goyostatus = 1
function! ToggleGoyo()
    if s:goyostatus
        let s:goyostatus = 0
    else
        let s:goyostatus = 1
    endif
    Goyo
endfunction

nnoremap <silent> <Leader><Leader> :call ToggleGoyo()<CR> 

function! s:goyo_leave()
  if s:goyostatus
    quit!
  endif
endfunction

autocmd! User GoyoLeave nested call <SID>goyo_leave()

Not sure if there's a more elegant solution but this works as long as you toggle with :call ToggleGoyo() or \\ and not :Goyo. For my purposes tho toggling is not necessary and is just an added bonus. If you don't foresee a need to toggle off Goyo at all I think you can get away with this:

function! s:goyo_leave()
    quit!
endfunction

autocmd! User GoyoLeave nested call <SID>goyo_leave()

@jonulrich
Copy link

nevermind there was a better solution all along

Ensure :q to quit even when Goyo is active

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants