mirror of
https://github.com/junegunn/goyo.vim.git
synced 2025-11-13 05:43:50 -05:00
Add Goyo! command for turning it off
This commit is contained in:
@@ -21,7 +21,10 @@ Use your favorite plugin manager.
|
|||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
|
|
||||||
`:Goyo [width]`
|
- `:Goyo [width]`
|
||||||
|
- Toggle Goyo
|
||||||
|
- `:Goyo!`
|
||||||
|
- Turn Goyo off
|
||||||
|
|
||||||
You might map this to a key combo in your `.vimrc` like so:
|
You might map this to a key combo in your `.vimrc` like so:
|
||||||
```vim
|
```vim
|
||||||
|
|||||||
@@ -301,9 +301,14 @@ function! s:goyo_off()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:goyo(...)
|
function! s:goyo(bang, ...)
|
||||||
let width = a:0 > 0 ? a:1 : get(g:, 'goyo_width', 80)
|
let width = a:0 > 0 ? a:1 : get(g:, 'goyo_width', 80)
|
||||||
|
|
||||||
|
if a:bang
|
||||||
|
if exists('#goyo')
|
||||||
|
call s:goyo_off()
|
||||||
|
endif
|
||||||
|
else
|
||||||
if exists('#goyo') == 0
|
if exists('#goyo') == 0
|
||||||
call s:goyo_on(width)
|
call s:goyo_on(width)
|
||||||
elseif a:0 > 0
|
elseif a:0 > 0
|
||||||
@@ -312,9 +317,10 @@ function! s:goyo(...)
|
|||||||
else
|
else
|
||||||
call s:goyo_off()
|
call s:goyo_off()
|
||||||
end
|
end
|
||||||
|
end
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
command! -nargs=? Goyo call s:goyo(<args>)
|
command! -nargs=? -bar -bang Goyo call s:goyo('<bang>' == '!', <args>)
|
||||||
|
|
||||||
let &cpo = s:cpo_save
|
let &cpo = s:cpo_save
|
||||||
unlet s:cpo_save
|
unlet s:cpo_save
|
||||||
|
|||||||
Reference in New Issue
Block a user