mirror of
https://github.com/junegunn/goyo.vim.git
synced 2025-11-16 07:13:50 -05:00
Temporarily disable vim-airline while in Goyo mode (#1)
+ revert options after (not before) closing goyo tab
This commit is contained in:
@@ -132,6 +132,12 @@ function! s:goyo_on(width)
|
|||||||
GitGutterDisable
|
GitGutterDisable
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" airline
|
||||||
|
let t:goyo_disabled_airline = exists("#airline")
|
||||||
|
if t:goyo_disabled_airline
|
||||||
|
AirlineToggle
|
||||||
|
endif
|
||||||
|
|
||||||
if !get(g:, 'goyo_linenr', 0)
|
if !get(g:, 'goyo_linenr', 0)
|
||||||
set nonu nornu
|
set nonu nornu
|
||||||
endif
|
endif
|
||||||
@@ -161,27 +167,26 @@ function! s:goyo_on(width)
|
|||||||
autocmd VimResized * call s:resize_pads()
|
autocmd VimResized * call s:resize_pads()
|
||||||
autocmd ColorScheme * call s:tranquilize()
|
autocmd ColorScheme * call s:tranquilize()
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
let t:goyohan = 1
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:goyo_off()
|
function! s:goyo_off()
|
||||||
augroup goyo
|
if !exists('#goyo')
|
||||||
autocmd!
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
if !exists('t:goyohan')
|
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
for [k, v] in items(t:goyo_revert)
|
" Clear auto commands
|
||||||
execute printf("let &%s = %s", k, string(v))
|
augroup goyo
|
||||||
endfor
|
autocmd!
|
||||||
execute 'colo '. g:colors_name
|
augroup END
|
||||||
|
augroup! goyo
|
||||||
|
augroup goyop
|
||||||
|
autocmd!
|
||||||
|
augroup END
|
||||||
|
augroup! goyop
|
||||||
|
|
||||||
if t:goyo_disabled_gitgutter
|
let goyo_revert = t:goyo_revert
|
||||||
GitGutterEnable
|
let goyo_disabled_gitgutter = t:goyo_disabled_gitgutter
|
||||||
endif
|
let goyo_disabled_airline = t:goyo_disabled_airline
|
||||||
|
|
||||||
if tabpagenr() == 1
|
if tabpagenr() == 1
|
||||||
tabnew
|
tabnew
|
||||||
@@ -189,12 +194,25 @@ function! s:goyo_off()
|
|||||||
bd
|
bd
|
||||||
endif
|
endif
|
||||||
tabclose
|
tabclose
|
||||||
|
|
||||||
|
for [k, v] in items(goyo_revert)
|
||||||
|
execute printf("let &%s = %s", k, string(v))
|
||||||
|
endfor
|
||||||
|
execute 'colo '. g:colors_name
|
||||||
|
|
||||||
|
if goyo_disabled_gitgutter
|
||||||
|
GitGutterEnable
|
||||||
|
endif
|
||||||
|
|
||||||
|
if goyo_disabled_airline
|
||||||
|
AirlineToggle
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:goyo(...)
|
function! s:goyo(...)
|
||||||
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 get(t:, 'goyohan', 0) == 0
|
if exists('#goyo') == 0
|
||||||
call s:goyo_on(width)
|
call s:goyo_on(width)
|
||||||
elseif a:0 > 0
|
elseif a:0 > 0
|
||||||
let t:goyo_width = width
|
let t:goyo_width = width
|
||||||
|
|||||||
Reference in New Issue
Block a user