mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated vim plugins. Nerd tree is on the right by default
This commit is contained in:
@ -9,7 +9,7 @@ catch /.*/
|
||||
echoe "you're missing tlib. See install instructions at ".expand('<sfile>:h:h').'/README.md'
|
||||
endtry
|
||||
|
||||
fun! Filename(...)
|
||||
fun! Filename(...) abort
|
||||
let filename = expand('%:t:r')
|
||||
if filename == '' | return a:0 == 2 ? a:2 : '' | endif
|
||||
return !a:0 || a:1 == '' ? filename : substitute(a:1, '$1', filename, 'g')
|
||||
@ -17,7 +17,7 @@ endf
|
||||
|
||||
let s:cache = {}
|
||||
|
||||
function! snipMate#expandSnip(snip, version, col)
|
||||
function! snipMate#expandSnip(snip, version, col) abort
|
||||
let lnum = line('.')
|
||||
let col = a:col
|
||||
let line = getline(lnum)
|
||||
@ -76,11 +76,11 @@ function! snipMate#expandSnip(snip, version, col)
|
||||
return b:snip_state.set_stop(0)
|
||||
endfunction
|
||||
|
||||
function! snipMate#placeholder_str(num, stops)
|
||||
function! snipMate#placeholder_str(num, stops) abort
|
||||
return snipMate#sniplist_str(a:stops[a:num].placeholder, a:stops)[0]
|
||||
endfunction
|
||||
|
||||
function! snipMate#sniplist_str(snippet, stops)
|
||||
function! snipMate#sniplist_str(snippet, stops) abort
|
||||
let lines = ['']
|
||||
let pos = 0
|
||||
let add_to = 1
|
||||
@ -108,7 +108,7 @@ function! snipMate#sniplist_str(snippet, stops)
|
||||
return lines
|
||||
endfunction
|
||||
|
||||
function! s:build_stops(snippet, stops, lnum, col, indent)
|
||||
function! s:build_stops(snippet, stops, lnum, col, indent) abort
|
||||
let stops = a:stops
|
||||
let line = a:lnum
|
||||
let col = a:col
|
||||
@ -146,7 +146,7 @@ function! s:build_stops(snippet, stops, lnum, col, indent)
|
||||
return stop_count
|
||||
endfunction
|
||||
|
||||
function! s:build_loc_info(snippet, stops, line, col, indent)
|
||||
function! s:build_loc_info(snippet, stops, line, col, indent) abort
|
||||
let stops = a:stops
|
||||
let line = a:line
|
||||
let col = a:col
|
||||
@ -183,7 +183,7 @@ function! s:build_loc_info(snippet, stops, line, col, indent)
|
||||
return [line, col]
|
||||
endfunction
|
||||
|
||||
function! s:add_mirror(stops, id, line, col, item)
|
||||
function! s:add_mirror(stops, id, line, col, item) abort
|
||||
let stops = a:stops
|
||||
let item = a:item
|
||||
let stops[a:id].mirrors = get(stops[a:id], 'mirrors', [])
|
||||
@ -201,7 +201,7 @@ endfunction
|
||||
" ['triggername', 'name', 'contents']
|
||||
" if triggername is not set 'default' is assumed
|
||||
" TODO: better error checking
|
||||
fun! snipMate#ReadSnippetsFile(file)
|
||||
fun! snipMate#ReadSnippetsFile(file) abort
|
||||
let result = []
|
||||
let new_scopes = []
|
||||
if !filereadable(a:file) | return [result, new_scopes] | endif
|
||||
@ -245,7 +245,7 @@ fun! snipMate#ReadSnippetsFile(file)
|
||||
return [result, new_scopes]
|
||||
endf
|
||||
|
||||
function! s:GetScopes()
|
||||
function! s:GetScopes() abort
|
||||
let ret = exists('b:snipMate.scope_aliases') ? copy(b:snipMate.scope_aliases) : {}
|
||||
let global = get(g:snipMate, 'scope_aliases', {})
|
||||
for alias in keys(global)
|
||||
@ -262,7 +262,7 @@ endfunction
|
||||
" adds scope aliases to list.
|
||||
" returns new list
|
||||
" the aliases of aliases are added recursively
|
||||
fun! s:AddScopeAliases(list)
|
||||
fun! s:AddScopeAliases(list) abort
|
||||
let did = {}
|
||||
let scope_aliases = s:GetScopes()
|
||||
let new = a:list
|
||||
@ -282,7 +282,7 @@ endf
|
||||
|
||||
au SourceCmd *.snippet,*.snippets call s:source_snippet()
|
||||
|
||||
function! s:info_from_filename(file)
|
||||
function! s:info_from_filename(file) abort
|
||||
let parts = split(fnamemodify(a:file, ':r'), '/')
|
||||
let snipidx = len(parts) - index(reverse(copy(parts)), 'snippets') - 1
|
||||
let rtp_prefix = join(parts[(snipidx -
|
||||
@ -293,7 +293,7 @@ function! s:info_from_filename(file)
|
||||
return [rtp_prefix, trigger, desc]
|
||||
endfunction
|
||||
|
||||
function! s:source_snippet()
|
||||
function! s:source_snippet() abort
|
||||
let file = expand('<afile>:p')
|
||||
let [rtp_prefix, trigger, desc] = s:info_from_filename(file)
|
||||
let new_snips = []
|
||||
@ -316,7 +316,7 @@ function! s:source_snippet()
|
||||
call extend(s:lookup_state.snips, new_snips)
|
||||
endfunction
|
||||
|
||||
function! s:CachedSnips(file)
|
||||
function! s:CachedSnips(file) abort
|
||||
let mtime = getftime(a:file)
|
||||
if has_key(s:cache, a:file) && s:cache[a:file].mtime >= mtime
|
||||
return s:cache[a:file].contents
|
||||
@ -327,15 +327,14 @@ function! s:CachedSnips(file)
|
||||
return s:cache[a:file].contents
|
||||
endfunction
|
||||
|
||||
function! s:snippet_filenames(scope, trigger)
|
||||
function! s:snippet_filenames(scope, trigger) abort
|
||||
let mid = ['', '_*', '/*']
|
||||
return join(map(extend(mid, map(filter(copy(mid), 'v:key != 1'),
|
||||
\ "'/' . a:trigger . '*' . v:val")),
|
||||
\ "'snippets/' . a:scope . v:val . '.snippet'"
|
||||
let mid += map(copy(mid[1:]), "'/' . a:trigger . '*' . v:val")
|
||||
return join(map(mid, "'snippets/' . a:scope . v:val . '.snippet'"
|
||||
\ . ". (v:key < 3 ? 's' : '')"))
|
||||
endfunction
|
||||
|
||||
function! snipMate#SetByPath(dict, trigger, path, snippet, bang, snipversion)
|
||||
function! snipMate#SetByPath(dict, trigger, path, snippet, bang, snipversion) abort
|
||||
let d = a:dict
|
||||
if !has_key(d, a:trigger) || a:bang
|
||||
let d[a:trigger] = {}
|
||||
@ -344,7 +343,7 @@ function! snipMate#SetByPath(dict, trigger, path, snippet, bang, snipversion)
|
||||
endfunction
|
||||
|
||||
" default triggers based on paths
|
||||
function! snipMate#DefaultPool(scopes, trigger, result)
|
||||
function! snipMate#DefaultPool(scopes, trigger, result) abort
|
||||
let scopes = s:AddScopeAliases(a:scopes)
|
||||
let scopes_done = []
|
||||
let rtp_save = &rtp
|
||||
@ -377,7 +376,7 @@ endfunction
|
||||
" scopes: list of scopes. usually this is the filetype. eg ['c','cpp']
|
||||
" trigger may contain glob patterns. Thus use '*' to get all triggers
|
||||
"
|
||||
fun! snipMate#GetSnippets(scopes, trigger)
|
||||
fun! snipMate#GetSnippets(scopes, trigger) abort
|
||||
let result = {}
|
||||
|
||||
for F in values(g:snipMateSources)
|
||||
@ -389,7 +388,7 @@ endf
|
||||
" adds leading tab
|
||||
" and replaces leading spaces by tabs
|
||||
" see ftplugin/snippet.vim
|
||||
fun! snipMate#RetabSnip() range
|
||||
fun! snipMate#RetabSnip() range abort
|
||||
let leadingTab = expand('%:e') == 'snippets'
|
||||
|
||||
let lines = getline(a:firstline, a:lastline)
|
||||
@ -424,7 +423,7 @@ fun! snipMate#RetabSnip() range
|
||||
endfor
|
||||
endf
|
||||
|
||||
fun! snipMate#OpenSnippetFiles()
|
||||
fun! snipMate#OpenSnippetFiles() abort
|
||||
let dict = snipMate#GetSnippetFiles(0, snipMate#ScopesByFile(), '*')
|
||||
" sort by files wether they exist - put existing files first
|
||||
let exists = []
|
||||
@ -445,13 +444,13 @@ fun! snipMate#OpenSnippetFiles()
|
||||
endfor
|
||||
endf
|
||||
|
||||
fun! snipMate#ScopesByFile()
|
||||
fun! snipMate#ScopesByFile() abort
|
||||
" duplicates are removed in AddScopeAliases
|
||||
return filter(funcref#Call(g:snipMate.get_scopes), "v:val != ''")
|
||||
endf
|
||||
|
||||
" used by both: completion and insert snippet
|
||||
fun! snipMate#GetSnippetsForWordBelowCursor(word, exact)
|
||||
fun! snipMate#GetSnippetsForWordBelowCursor(word, exact) abort
|
||||
" Setup lookups: '1.2.3' becomes [1.2.3] + [3, 2.3]
|
||||
let parts = split(a:word, '\W\zs')
|
||||
" Since '\W\zs' results in splitting *after* a non-keyword character, the
|
||||
@ -499,7 +498,7 @@ endf
|
||||
|
||||
" snippets: dict containing snippets by name
|
||||
" usually this is just {'default' : snippet_contents }
|
||||
fun! s:ChooseSnippet(snippets)
|
||||
fun! s:ChooseSnippet(snippets) abort
|
||||
let snippet = []
|
||||
let keys = keys(a:snippets)
|
||||
let i = 1
|
||||
@ -521,22 +520,22 @@ fun! s:ChooseSnippet(snippets)
|
||||
return funcref#Call(a:snippets[keys(a:snippets)[idx]])
|
||||
endf
|
||||
|
||||
fun! snipMate#WordBelowCursor()
|
||||
fun! snipMate#WordBelowCursor() abort
|
||||
return matchstr(getline('.'), '\S\+\%' . col('.') . 'c')
|
||||
endf
|
||||
|
||||
fun! snipMate#GetSnippetsForWordBelowCursorForComplete(word)
|
||||
fun! snipMate#GetSnippetsForWordBelowCursorForComplete(word) abort
|
||||
let snippets = map(snipMate#GetSnippetsForWordBelowCursor(a:word, 0), 'v:val[0]')
|
||||
return filter(snippets, 'v:val =~# "\\V\\^' . escape(a:word, '"\') . '"')
|
||||
endf
|
||||
|
||||
fun! snipMate#CanBeTriggered()
|
||||
fun! snipMate#CanBeTriggered() abort
|
||||
let word = snipMate#WordBelowCursor()
|
||||
let matches = snipMate#GetSnippetsForWordBelowCursorForComplete(word)
|
||||
return len(matches) > 0
|
||||
endf
|
||||
|
||||
fun! snipMate#ShowAvailableSnips()
|
||||
fun! snipMate#ShowAvailableSnips() abort
|
||||
let col = col('.')
|
||||
let word = snipMate#WordBelowCursor()
|
||||
let matches = snipMate#GetSnippetsForWordBelowCursorForComplete(word)
|
||||
@ -552,7 +551,7 @@ fun! snipMate#ShowAvailableSnips()
|
||||
endf
|
||||
|
||||
" Pass an argument to force snippet expansion instead of triggering or jumping
|
||||
function! snipMate#TriggerSnippet(...)
|
||||
function! snipMate#TriggerSnippet(...) abort
|
||||
if exists('g:SuperTabMappingForward')
|
||||
if g:SuperTabMappingForward == "<tab>"
|
||||
let SuperTabPlug = maparg('<Plug>SuperTabForward', 'i')
|
||||
@ -610,7 +609,7 @@ function! snipMate#TriggerSnippet(...)
|
||||
\ : "\<c-r>=snipMate#ShowAvailableSnips()\<cr>"
|
||||
endfunction
|
||||
|
||||
fun! snipMate#BackwardsSnippet()
|
||||
fun! snipMate#BackwardsSnippet() abort
|
||||
if exists('b:snip_state') | return b:snip_state.jump_stop(1) | endif
|
||||
|
||||
if exists('g:SuperTabMappingForward')
|
||||
|
@ -9,7 +9,7 @@
|
||||
" will create a snippet on the fly which looks like this:
|
||||
" abc(${1:a}, ${2:b}, ${3:c=None})
|
||||
|
||||
fun! snipMate_python_demo#Activate()
|
||||
fun! snipMate_python_demo#Activate() abort
|
||||
if !exists('g:snipMateSources')
|
||||
let g:snipMateSources = {}
|
||||
endif
|
||||
@ -17,7 +17,7 @@ fun! snipMate_python_demo#Activate()
|
||||
let g:snipMateSources['python'] = funcref#Function('snipMate_python_demo#FunctionsFromCurrentFileAndTags')
|
||||
endf
|
||||
|
||||
fun! s:Add(dict, line, source, trigger)
|
||||
fun! s:Add(dict, line, source, trigger) abort
|
||||
let matched = matchlist(a:line,'def\s\+\([^( \t]\+\)[ \t]*(\([^)]*\)')
|
||||
if len(matched) > 2
|
||||
let name = matched[1]
|
||||
@ -34,7 +34,7 @@ fun! s:Add(dict, line, source, trigger)
|
||||
let sd[a:source] = name.'('.join(args,', ').')'
|
||||
endif
|
||||
endf
|
||||
fun! snipMate_python_demo#FunctionsFromCurrentFileAndTags(scopes, trigger, result)
|
||||
fun! snipMate_python_demo#FunctionsFromCurrentFileAndTags(scopes, trigger, result) abort
|
||||
" getting all might be too much
|
||||
if a:trigger == '*' | return | endif
|
||||
if index(a:scopes, 'python') < 0 | return | endif
|
||||
|
@ -1,25 +1,25 @@
|
||||
function! s:sfile()
|
||||
function! s:sfile() abort
|
||||
return expand('<sfile>')
|
||||
endfunction
|
||||
|
||||
let s:state_proto = {}
|
||||
|
||||
function! snipmate#jumping#state()
|
||||
function! snipmate#jumping#state() abort
|
||||
return copy(s:state_proto)
|
||||
endfunction
|
||||
|
||||
function! s:listize_mirror(mirrors)
|
||||
function! s:listize_mirror(mirrors) abort
|
||||
return map(copy(a:mirrors), '[v:val.line, v:val.col]')
|
||||
endfunction
|
||||
|
||||
" Removes snippet state info
|
||||
function! s:state_remove() dict
|
||||
function! s:state_remove() dict abort
|
||||
" Remove all autocmds in group snipmate_changes in the current buffer
|
||||
unlet! b:snip_state
|
||||
silent! au! snipmate_changes * <buffer>
|
||||
endfunction
|
||||
|
||||
function! s:state_find_next_stop(backwards) dict
|
||||
function! s:state_find_next_stop(backwards) dict abort
|
||||
let self.stop_no += a:backwards? -1 : 1
|
||||
while !has_key(self.stops, self.stop_no)
|
||||
if self.stop_no == self.stop_count
|
||||
@ -33,7 +33,7 @@ function! s:state_find_next_stop(backwards) dict
|
||||
endfunction
|
||||
|
||||
" Update state information to correspond to the given tab stop
|
||||
function! s:state_set_stop(backwards) dict
|
||||
function! s:state_set_stop(backwards) dict abort
|
||||
call self.find_next_stop(a:backwards)
|
||||
let self.cur_stop = self.stops[self.stop_no]
|
||||
let self.stop_len = (type(self.cur_stop.placeholder) == type(0))
|
||||
@ -54,7 +54,7 @@ function! s:state_set_stop(backwards) dict
|
||||
endfunction
|
||||
|
||||
" Jump to the next/previous tab stop
|
||||
function! s:state_jump_stop(backwards) dict
|
||||
function! s:state_jump_stop(backwards) dict abort
|
||||
" Update changes just in case
|
||||
" This seems to be only needed because insert completion does not trigger
|
||||
" the CursorMovedI event
|
||||
@ -72,7 +72,7 @@ function! s:state_jump_stop(backwards) dict
|
||||
return self.set_stop(a:backwards)
|
||||
endfunction
|
||||
|
||||
function! s:state_remove_nested(...) dict
|
||||
function! s:state_remove_nested(...) dict abort
|
||||
let id = a:0 ? a:1 : self.stop_no
|
||||
if type(self.stops[id].placeholder) == type([])
|
||||
for i in self.stops[id].placeholder
|
||||
@ -90,7 +90,7 @@ function! s:state_remove_nested(...) dict
|
||||
endfunction
|
||||
|
||||
" Select the placeholder for the current tab stop
|
||||
function! s:state_select_word() dict
|
||||
function! s:state_select_word() dict abort
|
||||
let len = self.stop_len
|
||||
if !len | return '' | endif
|
||||
let l = col('.') != 1 ? 'l' : ''
|
||||
@ -103,7 +103,7 @@ endfunction
|
||||
" Update the snippet as text is typed. The self.update_mirrors() function does
|
||||
" the actual work.
|
||||
" If the cursor moves outside of a placeholder, call self.remove()
|
||||
function! s:state_update_changes() dict
|
||||
function! s:state_update_changes() dict abort
|
||||
let change_len = col('$') - self.prev_len
|
||||
let self.changed = self.changed || change_len != 0
|
||||
let self.end_col += change_len
|
||||
@ -122,7 +122,7 @@ function! s:state_update_changes() dict
|
||||
endfunction
|
||||
|
||||
" Actually update the mirrors for any changed text
|
||||
function! s:state_update_mirrors(change) dict
|
||||
function! s:state_update_mirrors(change) dict abort
|
||||
let newWordLen = self.end_col - self.start_col
|
||||
let newWord = strpart(getline('.'), self.start_col - 1, newWordLen)
|
||||
let changeLen = a:change
|
||||
@ -159,7 +159,7 @@ function! s:state_update_mirrors(change) dict
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:state_find_update_objects(item) dict
|
||||
function! s:state_find_update_objects(item) dict abort
|
||||
let item = a:item
|
||||
let item.update_objects = []
|
||||
|
||||
@ -179,7 +179,7 @@ function! s:state_find_update_objects(item) dict
|
||||
return item.update_objects
|
||||
endfunction
|
||||
|
||||
function! s:state_update(item, change_len) dict
|
||||
function! s:state_update(item, change_len) dict abort
|
||||
let item = a:item
|
||||
if exists('item.update_objects')
|
||||
let to_update = item.update_objects
|
||||
|
@ -2,7 +2,7 @@ let s:sigil = nr2char(31)
|
||||
let snipmate#legacy#sigil = s:sigil
|
||||
|
||||
" Prepare snippet to be processed by s:BuildTabStops
|
||||
function! snipmate#legacy#process_snippet(snip)
|
||||
function! snipmate#legacy#process_snippet(snip) abort
|
||||
let snippet = a:snip
|
||||
let esc_bslash = '\%(\\\@<!\%(\\\\\)*\)\@<='
|
||||
|
||||
@ -76,7 +76,7 @@ endfunction
|
||||
" the matches of "$#", to be replaced with the placeholder. This list is
|
||||
" composed the same way as the parent; the first item is the line number,
|
||||
" and the second is the column.
|
||||
function! snipmate#legacy#build_stops(snip, lnum, col, indent)
|
||||
function! snipmate#legacy#build_stops(snip, lnum, col, indent) abort
|
||||
let stops = {}
|
||||
let i = 0
|
||||
let withoutVars = substitute(a:snip, s:sigil . '\d\+', '', 'g')
|
||||
@ -118,7 +118,7 @@ function! snipmate#legacy#build_stops(snip, lnum, col, indent)
|
||||
endfunction
|
||||
|
||||
" Counts occurences of haystack in needle
|
||||
function! s:count(haystack, needle)
|
||||
function! s:count(haystack, needle) abort
|
||||
let counter = 0
|
||||
let index = stridx(a:haystack, a:needle)
|
||||
while index != -1
|
||||
|
@ -1,12 +1,12 @@
|
||||
" Snippet definition parsing code
|
||||
|
||||
function! s:sfile()
|
||||
function! s:sfile() abort
|
||||
return expand('<sfile>')
|
||||
endfunction
|
||||
|
||||
let s:parser_proto = {}
|
||||
|
||||
function! s:new_parser(text)
|
||||
function! s:new_parser(text) abort
|
||||
let ret = copy(s:parser_proto)
|
||||
let ret.input = a:text
|
||||
let ret.len = strlen(ret.input)
|
||||
@ -18,12 +18,12 @@ function! s:new_parser(text)
|
||||
return ret
|
||||
endfunction
|
||||
|
||||
function! s:parser_advance(...) dict
|
||||
function! s:parser_advance(...) dict abort
|
||||
let self.pos += a:0 ? a:1 : 1
|
||||
let self.next = self.input[self.pos]
|
||||
endfunction
|
||||
|
||||
function! s:parser_same(tok) dict
|
||||
function! s:parser_same(tok) dict abort
|
||||
if self.next == a:tok
|
||||
call self.advance()
|
||||
return 1
|
||||
@ -32,7 +32,7 @@ function! s:parser_same(tok) dict
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:parser_id() dict
|
||||
function! s:parser_id() dict abort
|
||||
if self.input[(self.pos):(self.pos+5)] == 'VISUAL'
|
||||
call self.advance(6)
|
||||
return 'VISUAL'
|
||||
@ -45,7 +45,7 @@ function! s:parser_id() dict
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! s:parser_add_var(var) dict
|
||||
function! s:parser_add_var(var) dict abort
|
||||
let id = a:var[0]
|
||||
if !has_key(self.vars, id)
|
||||
let self.vars[id] = { 'instances' : [] }
|
||||
@ -53,7 +53,7 @@ function! s:parser_add_var(var) dict
|
||||
call add(self.vars[id].instances, a:var)
|
||||
endfunction
|
||||
|
||||
function! s:parser_var() dict
|
||||
function! s:parser_var() dict abort
|
||||
let ret = []
|
||||
if self.same('{')
|
||||
let id = self.id()
|
||||
@ -70,7 +70,7 @@ function! s:parser_var() dict
|
||||
return ret
|
||||
endfunction
|
||||
|
||||
function! s:parser_varend() dict
|
||||
function! s:parser_varend() dict abort
|
||||
let ret = []
|
||||
if self.same(':')
|
||||
call extend(ret, self.placeholder())
|
||||
@ -81,11 +81,11 @@ function! s:parser_varend() dict
|
||||
return ret
|
||||
endfunction
|
||||
|
||||
function! s:parser_placeholder() dict
|
||||
function! s:parser_placeholder() dict abort
|
||||
return self.parse('}')
|
||||
endfunction
|
||||
|
||||
function! s:parser_subst() dict
|
||||
function! s:parser_subst() dict abort
|
||||
let ret = {}
|
||||
let ret.pat = join(self.text('/', 1))
|
||||
if self.same('/')
|
||||
@ -97,14 +97,14 @@ function! s:parser_subst() dict
|
||||
return ret
|
||||
endfunction
|
||||
|
||||
function! s:parser_expr() dict
|
||||
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)
|
||||
endfunction
|
||||
|
||||
function! s:parser_text(...) dict
|
||||
function! s:parser_text(...) dict abort
|
||||
let res = []
|
||||
let val = ''
|
||||
if a:0 == 2 && a:2
|
||||
@ -140,7 +140,7 @@ function! s:parser_text(...) dict
|
||||
return res
|
||||
endfunction
|
||||
|
||||
function! s:parser_parse(...) dict
|
||||
function! s:parser_parse(...) dict abort
|
||||
let ret = a:0 ? [] : self.value
|
||||
while self.pos < self.len
|
||||
if self.same('$')
|
||||
@ -186,7 +186,7 @@ call extend(s:parser_proto, snipmate#util#add_methods(s:sfile(), 'parser',
|
||||
\ [ 'advance', 'same', 'id', 'add_var', 'var', 'varend',
|
||||
\ 'placeholder', 'subst', 'expr', 'text', 'parse' ]), 'error')
|
||||
|
||||
function! s:indent(count)
|
||||
function! s:indent(count) abort
|
||||
if &expandtab
|
||||
let shift = repeat(' ', (&sts > 0) ? &sts : &sw)
|
||||
else
|
||||
@ -195,7 +195,7 @@ function! s:indent(count)
|
||||
return repeat(shift, a:count)
|
||||
endfunction
|
||||
|
||||
function! s:visual_placeholder(var, indent)
|
||||
function! s:visual_placeholder(var, indent) abort
|
||||
let arg = get(a:var, 1, {})
|
||||
if type(arg) == type({})
|
||||
let pat = get(arg, 'pat', '')
|
||||
@ -212,7 +212,7 @@ function! s:visual_placeholder(var, indent)
|
||||
return content
|
||||
endfunction
|
||||
|
||||
function! snipmate#parse#snippet(text)
|
||||
function! snipmate#parse#snippet(text) abort
|
||||
let parser = s:new_parser(a:text)
|
||||
call parser.parse()
|
||||
unlet! b:snipmate_visual
|
||||
|
@ -1,6 +1,6 @@
|
||||
" The next function was based on s:function and s:add_methods in fugitive
|
||||
" <https://github.com/tpope/vim-fugitive/blob/master/plugin/fugitive.vim>
|
||||
function! snipmate#util#add_methods(sfile, namespace, methods)
|
||||
function! snipmate#util#add_methods(sfile, namespace, methods) abort
|
||||
let dict = {}
|
||||
for name in a:methods
|
||||
let dict[name] = function(join([matchstr(a:sfile, '<SNR>\d\+'),
|
||||
|
Reference in New Issue
Block a user