From 697a90857c95fb0fda357fd07b38fe37b0ea5bf0 Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Mon, 22 Oct 2018 10:39:14 +0200 Subject: [PATCH] Streamline SetFontSize function for gvim --- gvimrc | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/gvimrc b/gvimrc index 17bf39a..c1a92fd 100644 --- a/gvimrc +++ b/gvimrc @@ -41,25 +41,18 @@ if !exists('g:colors_name') end end -function! SetFont() - if exists("g:font_temp") && exists("g:font_size") - let &guifont=substitute(&guifont, g:font_temp, g:font_size, "g") - end -endfun -function! SetFontSize(size) - let g:font_size=a:size - call SetFont() -endfun - -let s:fontsize = 13 - if has("unix") elseif has("win32") let g:font_temp=".*:h\\zs\\d\\+" - let g:font_size=s:fontsize set linespace=0 - call SetFont() end +let s:fontsize = match(&guifont, "") + +function! SetFontSize(size) + if exists("g:font_temp") + let &guifont=substitute(&guifont, g:font_temp, a:size, "g") + end +endfun command! -nargs=1 SetFontSize call SetFontSize() command! ResetFontSize call SetFontSize(s:fontsize)