見つけたcolorschemeを使うスクリプト書いてみた

vimのcolorschemeを気まぐれで追加してみたりするんですが,
gvimrcで指定したカラースキームが見つからず残念な状態で起動しちゃったり.


そろそろvimscript書けるようになる予定(?)なので書いてみました.
指定したカラースキームのリストを順にたどって適用してくれます.

" adaptive colorscheme {{{
function! RuntimepathRange() " : unit -> path of list
  return split(&runtimepath, ",")
endfunction

function! ColorSchemePath(name) " : name -> path option
  for r in RuntimepathRange()
    let p =expand(r . "/colors/" . a:name . ".vim")
  if filereadable(p)
    return p
	  endif
    endfor
  return ""
endfunction

function! SetColorScheme(names) " : string of list -> unit
  for n in a:names
    if ColorSchemePath(n)!=""
      execute "colorscheme " . n
      return 
    endif
  endfor
  echo "there isn't applicable colorscheme"
endfunction " }}}

if &term == "builtin_gui"
  set background=dark
endif
call SetColorScheme(["earendel","slate","koehler","molokai"])

だれか添削してくれないかしら?