Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions plugin/vim_iawriter.vim
Original file line number Diff line number Diff line change
Expand Up @@ -191,21 +191,25 @@ fun! s:leave() " {{{1
silent! doautocmd <nomodeline> User IawriterPostLeave
endfun

fun! s:toggle() " {{{1
fun! s:toggle(dimension) " {{{1
silent! doautocmd <nomodeline> User IawriterToggleTriggered
if exists('#goyo') && s:vim_iawriter_enabled
Goyo!
else
call <SID>pre_enter()
Goyo
if a:dimension is v:none
Goyo
else
execute 'Goyo' a:dimension
endif
endif
silent! doautocmd <nomodeline> User IawriterToggleFinished
endfun " }}}

fun! vim_iawriter#toggle() " {{{1
call <SID>toggle()
fun! vim_iawriter#toggle(dimension=v:none) " {{{1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dimension=v:none is currently not supported in neovim and older vim versions.

call <SID>toggle(a:dimension)
endfun " }}}
command! Iawriter call vim_iawriter#toggle()
command! -nargs=? Iawriter call vim_iawriter#toggle(<f-args>)

" Close vim when only window open is iAwriter " {{{1
" Taken from https://github.com/junegunn/goyo.vim/wiki/Customization#ensure-q-to-quit-even-when-goyo-is-active
Expand Down