1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 01:25:00 +08:00

Updated vimrc

This commit is contained in:
amix
2015-07-13 11:22:46 +01:00
parent 9a2843c2a5
commit d7752b59ae
301 changed files with 4699 additions and 7969 deletions

View File

@ -410,10 +410,10 @@ function! snipMate#OpenSnippetFiles() abort
let exists = []
let notexists = []
for scope in s:AddScopeAliases(snipMate#ScopesByFile())
let files += split(s:snippet_filenames(scope, ''))
let files += s:snippet_filenames(scope, '')
endfor
call filter(files, "v:val !~# '\\*'")
for path in split(g:snipMate.snippet_dirs, ',')
for path in g:snipMate.snippet_dirs
let fullpaths = map(copy(files), 'printf("%s/%s", path, v:val)')
let exists += filter(copy(fullpaths), 'filereadable(v:val)')
let notexists += map(filter(copy(fullpaths),

View File

@ -25,7 +25,8 @@ function! snipmate#legacy#process_snippet(snip) abort
let isexp = 0
for i in snip
if isexp
call add(new, substitute(eval(i), "\n\\%$", '', ''))
call add(new, substitute(snipmate#util#eval(i),
\ "\n\\%$", '', ''))
else
call add(new, i)
endif
@ -86,9 +87,9 @@ function! snipmate#legacy#build_stops(snip, lnum, col, indent) abort
let stops[i] = {}
let stops[i].line = a:lnum + s:count(beforeTabStop, "\n")
let stops[i].col = a:indent + len(matchstr(withoutOthers, '.*\(\n\|^\)\zs.*\ze'.s:sigil .'{'.i.'\D'))
let stops[i].placeholder = 0
let stops[i].mirrors = []
let stops[i].col = a:indent + len(matchstr(withoutOthers, '\_^.*\ze'.s:sigil .'{'.i.'\D'))
let stops[i].placeholder = 0
let stops[i].mirrors = []
if stops[i].line == a:lnum
let stops[i].col += a:col
endif

View File

@ -99,9 +99,8 @@ endfunction
function! s:parser_expr() dict abort
let str = join(self.text('`', 1))
let ret = eval(str)
call self.same('`')
return type(ret) == type('') ? ret : string(ret)
return snipmate#util#eval(str)
endfunction
function! s:parser_text(...) dict abort

View File

@ -8,3 +8,15 @@ function! snipmate#util#add_methods(sfile, namespace, methods) abort
endfor
return dict
endfunction
function! snipmate#util#eval(arg)
try
let ret = eval(a:arg)
catch
echohl ErrorMsg
echom 'SnipMate:Expression: ' . v:exception
echohl None
let ret = ''
endtry
return type(ret) == type('') ? ret : string(ret)
endfunction