"make gvim able to adjust font size using key command
command! FontLarger call s:fontLarger()
function! s:fontLarger()
"store current setting to var curfont
let curfont=&guifont
echo "current font is:" . curfont
"split by " " and extract the fontsize
let list=split(curfont," ")
echo "list contents:" . list[0] . list[1]
"get length of the list
let listlen=len(list)
echo "listlen" . listlen
"
let newfontsize=list[listlen-1]+1
"preparation for while statement
let indexi=0
let indexj=listlen
let newfont=""
"construct newfont strings using while loop
while indexi < listlen "loop (listlen)th times
echo "in the while loop"
echo "listlen:" listlen
echo "indexi:" indexi
echo "indexj:" indexj
echo list[indexi]
"newfont=newfont . list[indexi]
"use conditional statement if
if indexi == 0 "first time, no add \space
let newfont=newfont . list[indexi]
elseif indexi != 0
if indexi < listlen-1
let newfont=newfont . " " . list[indexi]
"if list[indexi] is numerical value, increment 1
elseif indexi == listlen-1
let newfontsize=list[indexi]+1
echo "newfontsize:" . newfontsize
let newfont=newfont . " " . newfontsize
endif
endif
"update indexes
let indexi=indexi+1
let indexj=indexj-1
endwhile
"edit curfont and get font size
echo "newfont is:" . newfont
let &guifont=newfont
endfunction