From 724de16aa0d023fcf5963b9a70d293b5fa6cd0b3 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 1 Dec 2013 02:34:49 +0900 Subject: [PATCH] Support color schemes w/o background color --- plugin/goyo.vim | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/plugin/goyo.vim b/plugin/goyo.vim index 3d426ef..d5ecb52 100644 --- a/plugin/goyo.vim +++ b/plugin/goyo.vim @@ -46,7 +46,7 @@ function! s:init_pad(command) execute a:command setlocal buftype=nofile bufhidden=wipe nomodifiable nobuflisted noswapfile - \ nonu nocursorline laststatus=0 colorcolumn= + \ nonu nocursorline colorcolumn= \ statusline=\ winwidth=1 winheight=1 let bufnr = winbufnr(0) @@ -88,8 +88,14 @@ function! s:tranquilize() let bg = s:get_color('Normal', 'bg') for grp in ['NonText', 'FoldColumn', 'ColorColumn', 'VertSplit', \ 'StatusLine', 'StatusLineNC', 'SignColumn'] - call s:set_color(grp, 'fg', bg) - call s:set_color(grp, 'bg', bg) + if bg == -1 + call s:set_color(grp, '', 'NONE') + call s:set_color(grp, 'fg', get(g:, 'goyo_bg', 'black')) + call s:set_color(grp, 'bg', 'NONE') + else + call s:set_color(grp, 'fg', bg) + call s:set_color(grp, 'bg', bg) + endif endfor endfunction @@ -103,8 +109,9 @@ function! s:goyo_on(width) let t:goyo_pads = {} let t:goyo_revert = - \ { 'laststatus': &l:laststatus, 'statusline': &l:statusline, - \ 'showtabline': &showtabline, 'colorcolumn': &l:colorcolumn } + \ { 'laststatus': &laststatus, + \ 'showtabline': &showtabline, + \ 'fillchars': &fillchars } " gitgutter let t:goyo_disabled_gitgutter = get(g:, 'gitgutter_enabled', 0) @@ -113,9 +120,13 @@ function! s:goyo_on(width) endif setlocal colorcolumn= - setlocal laststatus=0 setlocal statusline=\ - setlocal showtabline=0 + + set laststatus=0 + set showtabline=0 + set fillchars+=vert:\ + set fillchars+=stl:. + set fillchars+=stlnc:\ let t:goyo_pads.l = s:init_pad('vertical new') let t:goyo_pads.r = s:init_pad('vertical rightbelow new') @@ -145,7 +156,7 @@ function! s:goyo_off() endif for [k, v] in items(t:goyo_revert) - execute printf("setlocal %s=%s", k, v) + execute printf("setlocal %s=%s", k, escape(v, ' |')) endfor execute 'colo '. g:colors_name