- Improved for expand().

This commit is contained in:
Shougo Matsushita 2012-11-17 08:49:18 +09:00
parent 9653ba6c32
commit 705d61471c

View File

@ -1,7 +1,7 @@
"============================================================================= "=============================================================================
" FILE: util.vim " FILE: util.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com> " AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 23 Oct 2012. " Last Modified: 17 Nov 2012.
" License: MIT license {{{ " License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining " Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the " a copy of this software and associated documentation files (the
@ -55,12 +55,8 @@ function! neosnippet#util#iconv(...)"{{{
endfunction"}}} endfunction"}}}
function! neosnippet#util#expand(path)"{{{ function! neosnippet#util#expand(path)"{{{
let path = (a:path =~ '^\~') ? return neosnippet#util#substitute_path_separator(
\ substitute(a:path, '^\~', expand('~'), '') : \ expand(escape(a:path, '*?[]"={}'), 1))
\ (a:path =~ '^\$\h\w*') ? substitute(a:path,
\ '^\$\h\w*', '\=eval(submatch(0))', '') :
\ a:path
return s:V.substitute_path_separator(fnamemodify(path, ':p'))
endfunction"}}} endfunction"}}}
function! neosnippet#util#set_default(var, val, ...) "{{{ function! neosnippet#util#set_default(var, val, ...) "{{{
if !exists(a:var) || type({a:var}) != type(a:val) if !exists(a:var) || type({a:var}) != type(a:val)