Create function for initializing options

This commit is contained in:
Kim Silkebækken 2011-03-29 08:47:59 +02:00
parent 1d263a8a99
commit c3d3d0f3d5

View File

@ -11,23 +11,16 @@
let g:EasyMotion_loaded = 1 let g:EasyMotion_loaded = 1
" }}} " }}}
" Default configuration {{{ " Default configuration {{{
if ! exists('g:EasyMotion_keys') " {{{ function! s:InitOption(option, default) " {{{
let g:EasyMotion_keys = '' if ! exists('g:EasyMotion_' . a:option)
let g:EasyMotion_keys .= 'abcdefghijklmnopqrstuvwxyz' exec 'let g:EasyMotion_' . a:option . ' = ' . string(a:default)
let g:EasyMotion_keys .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' endif
endif " }}} endfunction " }}}
if ! exists('g:EasyMotion_target_hl') " {{{ call s:InitOption('keys', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
let g:EasyMotion_target_hl = 'EasyMotionTarget' call s:InitOption('target_hl', 'EasyMotionTarget')
endif " }}} call s:InitOption('shade_hl', 'EasyMotionShade')
if ! exists('g:EasyMotion_shade_hl') " {{{ call s:InitOption('do_shade', 1)
let g:EasyMotion_shade_hl = 'EasyMotionShade' call s:InitOption('do_mapping', 1)
endif " }}}
if ! exists('g:EasyMotion_do_shade') " {{{
let g:EasyMotion_shade = 1
endif " }}}
if ! exists('g:EasyMotion_do_mapping') " {{{
let g:EasyMotion_do_mapping = 1
endif " }}}
" Create default highlighting {{{ " Create default highlighting {{{
if ! hlexists(g:EasyMotion_target_hl) " {{{ if ! hlexists(g:EasyMotion_target_hl) " {{{
let hl = 'guibg=none guifg=#ff0000 gui=bold ' let hl = 'guibg=none guifg=#ff0000 gui=bold '