Better support of GVim

- Hide unnecessary scrollbars
- Fix errors on color schemes without background
This commit is contained in:
Junegunn Choi
2013-12-04 10:58:52 +09:00
parent 7c923dd77f
commit c75be8e24a

View File

@@ -62,7 +62,8 @@ function! s:setup_pad(bufnr, vert, size)
autocmd WinEnter <buffer> call s:blank() autocmd WinEnter <buffer> call s:blank()
augroup END augroup END
let diff = winheight(0) - line('$') " To hide scrollbars of pad windows in GVim
let diff = winheight(0) - line('$') - (has('gui_running') ? 2 : 0)
if diff > 0 if diff > 0
set modifiable set modifiable
call append(0, map(range(1, diff), '""')) call append(0, map(range(1, diff), '""'))
@@ -96,7 +97,8 @@ function! s:tranquilize()
let bg = s:get_color('Normal', 'bg') let bg = s:get_color('Normal', 'bg')
for grp in ['NonText', 'FoldColumn', 'ColorColumn', 'VertSplit', for grp in ['NonText', 'FoldColumn', 'ColorColumn', 'VertSplit',
\ 'StatusLine', 'StatusLineNC', 'SignColumn'] \ 'StatusLine', 'StatusLineNC', 'SignColumn']
if bg == -1 " -1 on Vim / '' on GVim
if bg == -1 || empty(bg)
call s:set_color(grp, '', 'NONE') call s:set_color(grp, '', 'NONE')
call s:set_color(grp, 'fg', get(g:, 'goyo_bg', 'black')) call s:set_color(grp, 'fg', get(g:, 'goyo_bg', 'black'))
call s:set_color(grp, 'bg', 'NONE') call s:set_color(grp, 'bg', 'NONE')
@@ -123,6 +125,9 @@ function! s:goyo_on(width)
\ 'statusline': &statusline, \ 'statusline': &statusline,
\ 'ruler': &ruler \ 'ruler': &ruler
\ } \ }
if has('gui_running')
let t:goyo_revert.guioptions = &guioptions
endif
" vim-gitgutter " vim-gitgutter
let t:goyo_disabled_gitgutter = get(g:, 'gitgutter_enabled', 0) let t:goyo_disabled_gitgutter = get(g:, 'gitgutter_enabled', 0)
@@ -158,6 +163,12 @@ function! s:goyo_on(width)
set fillchars+=stl:. set fillchars+=stl:.
set fillchars+=stlnc:\ set fillchars+=stlnc:\
" Hide left-hand scrollbars
if has('gui_running')
set guioptions-=l
set guioptions-=L
endif
let t:goyo_pads.l = s:init_pad('vertical new') let t:goyo_pads.l = s:init_pad('vertical new')
let t:goyo_pads.r = s:init_pad('vertical rightbelow new') let t:goyo_pads.r = s:init_pad('vertical rightbelow new')
let t:goyo_pads.t = s:init_pad('topleft new') let t:goyo_pads.t = s:init_pad('topleft new')