This commit is contained in:
Adam Stankiewicz
2021-04-14 11:59:14 +02:00
parent 3c5fca7621
commit 9e45c07a8d
47 changed files with 466 additions and 300 deletions

View File

@@ -12,28 +12,14 @@ function! s:L2U_Setup()
" Keep track of whether LaTeX-to-Unicode is activated
" (used when filetype changes)
if !has_key(b:, "l2u_enabled")
let b:l2u_enabled = 0
endif
if !has_key(b:, "l2u_autodetect_enable")
let b:l2u_autodetect_enable = 1
endif
let b:l2u_enabled = get(b:, "l2u_enabled", 0)
let b:l2u_autodetect_enable = get(b:, "l2u_autodetect_enable", 1)
" Did we install the L2U tab mappings?
if !has_key(b:, "l2u_tab_set")
let b:l2u_tab_set = 0
endif
if !has_key(b:, "l2u_cmdtab_set")
let b:l2u_cmdtab_set = 0
endif
if !has_key(b:, "l2u_keymap_set")
let b:l2u_keymap_set = 0
endif
" Did we activate the L2U as-you-type substitutions?
if !has_key(b:, "l2u_autosub_set")
let b:l2u_autosub_set = 0
endif
" Did we install the L2U tab/as-you-type/keymap... mappings?
let b:l2u_tab_set = get(b:, "l2u_tab_set", 0)
let b:l2u_cmdtab_set = get(b:, "l2u_cmdtab_set", 0)
let b:l2u_autosub_set = get(b:, "l2u_autosub_set", 0)
let b:l2u_keymap_set = get(b:, "l2u_keymap_set", 0)
" Following are some flags used to pass information between the function which
" attempts the LaTeX-to-Unicode completion and the fallback function
@@ -77,17 +63,19 @@ function! s:L2U_SetupGlobal()
let g:latex_to_unicode_suggestions = 0
endif
" A hack to forcibly get out of completion mode: feed
" this string with feedkeys()
if has("win32") || has("win64")
let s:l2u_esc_sequence = "\u0006"
else
let s:l2u_esc_sequence = "\u0091\b"
end
" Forcibly get out of completion mode: feed
" this string with feedkeys(s:l2u_esc_sequence, 'n')
let s:l2u_esc_sequence = " \b"
" Trigger for the previous mapping of <Tab>
let s:l2u_fallback_trigger = "\u0091L2UFallbackTab"
" Trigger for the previous mapping of <CR>
let s:l2u_fallback_trigger_cr = "\u0091L2UFallbackCR"
" Trigger for autosub completion cleanup autocommand
let s:l2u_autosub_cleanup_trigger = "\u0091L2UAutosubCleanup"
endfunction
" Each time the filetype changes, we may need to enable or
@@ -203,7 +191,7 @@ function! s:L2U_ismatch()
if col0 == -1
return 0
endif
let base = l[col0 : col1-1]
let base = l[col0:col1-2]
return has_key(g:l2u_symbols_dict, base)
endfunction
@@ -258,8 +246,14 @@ function! LaTeXtoUnicode#completefunc(findstart, base)
let b:l2u_in_fallback = 0
return -3
endif
" make sure that the options are still set
" (it may happen that <C-X><C-U> itself triggers the fallback before
" restarting, thus reseetting them; this happens when the prompt is
" waiting for ^U^N^P during a partial completion)
call s:L2U_SetCompleteopt()
" setup the cleanup/fallback operations when we're done
call s:L2U_InsertCompleteDoneAutocommand()
call s:L2U_InsertInsertLeaveAutocommand()
" set info for the callback
let b:l2u_found_completion = 1
" analyse current line
@@ -345,48 +339,83 @@ function! LaTeXtoUnicode#PutLiteral(k)
return ''
endfunction
function! LaTeXtoUnicode#PutLiteralCR()
call feedkeys('
', 'ni')
return ''
endfunction
" Function which saves the current insert-mode mapping of a key sequence `s`
" <Tab> mapping into the Fallback trigger)
" and associates it with another key sequence `k` (e.g. stores the current
" <Tab> mapping into the Fallback trigger).
" It returns the previous maparg dictionary, so that the previous mapping can
" be reinstated if needed.
function! s:L2U_SetFallbackMapping(s, k)
let mmdict = maparg(a:s, 'i', 0, 1)
if empty(mmdict)
return
exe 'inoremap <buffer> ' . a:k . ' ' . a:s
return mmdict
endif
let rhs = mmdict["rhs"]
return
if rhs =~# '^<Plug>L2U'
return mmdict
endif
if mmdict["silent"]
let pre = pre . '<silent>'
endif
if mmdict["expr"]
let pre = pre . '<expr>'
endif
let pre = '<buffer>'
let pre = pre . (mmdict["silent"] ? '<silent>' : '')
let pre = pre . (mmdict["expr"] ? '<expr>' : '')
if mmdict["noremap"]
let cmd = 'inoremap '
else
let cmd = 'imap '
" general solution.
" This is a nasty hack used to prevent infinite recursion. It's not a
" general solution. Also, it doesn't work with <CR> since that stops
" parsing of the <C-R>=... expression, so we need to special-case it.
" Also, if the original mapping was intended to be recursive, this
" will break it.
let rhs = substitute(rhs, '\c' . a:s, "\<C-R>=LaTeXtoUnicode#PutLiteral('" . a:s . "')\<CR>", 'g')
if mmdict["expr"]
if a:s != "<CR>"
let rhs = substitute(rhs, '\c' . a:s, "\<C-R>=LaTeXtoUnicode#PutLiteral('" . a:s . "')\<CR>", 'g')
else
let rhs = substitute(rhs, '\c' . a:s, "\<C-R>=LaTeXtoUnicode#PutLiteralCR()\<CR>", 'g')
endif
" Make the mapping silent even if it wasn't originally
if !mmdict["silent"]
let pre = pre . '<silent>'
endif
endif
endif
exe cmd . pre . ' ' . a:k . ' ' . rhs
return mmdict
endfunction
" Reinstate a mapping from the maparg dict returned by SetFallbackMapping
" (only if buffer-local, since otherwise it should still be available)
function! s:L2U_ReinstateMapping(mmdict)
if empty(a:mmdict) || !a:mmdict["buffer"]
return ''
endif
let lhs = a:mmdict["lhs"]
let rhs = a:mmdict["rhs"]
if rhs =~# '^<Plug>L2U'
return ''
endif
let pre = '<buffer>'
let pre = pre . (a:mmdict["silent"] ? '<silent>' : '')
let pre = pre . (a:mmdict["expr"] ? '<expr>' : '')
let cmd = a:mmdict["noremap"] ? 'inoremap ' : 'imap '
exe cmd . pre . ' ' . lhs . ' ' . rhs
endfunction
" This is the function which is mapped to <Tab>
function! LaTeXtoUnicode#Tab()
" the <Tab> is passed through to the fallback mapping if the completion
" isn't an exact match before the cursor when suggestions are disabled
if pumvisible() && !b:l2u_tab_completing && (get(g:, "latex_to_unicode_suggestions", 1) || !s:L2U_ismatch())
" menu is present, and it hasn't been raised by the L2U tab, and there
" isn't an exact match before the cursor
if pumvisible() && !b:l2u_tab_completing && !s:L2U_ismatch()
call feedkeys(s:l2u_fallback_trigger)
return ''
endif
" ensure that we start completion with some reasonable options
call s:L2U_SetCompleteopt()
" reset the in_fallback info
let b:l2u_in_fallback = 0
@@ -497,7 +526,7 @@ function! s:L2U_RestoreCompleteopt()
endif
endfunction
augroup L2UTab
function! s:L2U_InsertCompleteDoneAutocommand()
augroup L2UCompleteDone
autocmd! * <buffer>
" Every time a L2U completion finishes, the fallback may be invoked
@@ -505,11 +534,25 @@ function! s:L2U_InsertCompleteDoneAutocommand()
augroup END
endfunction
augroup L2UTab
function! s:L2U_RemoveCompleteDoneAutocommand()
augroup L2UCompleteDone
autocmd! * <buffer>
augroup END
endfunction
function s:L2U_InsertLeaveClenup()
call s:L2U_ResetLastCompletionInfo()
augroup L2UInsertLeave
autocmd! * <buffer>
augroup END
endfunction
function! s:L2U_InsertInsertLeaveAutocommand()
augroup L2UInsertLeave
autocmd! * <buffer>
autocmd InsertLeave <buffer> call s:L2U_InsertLeaveClenup()
augroup END
endfunction
" Setup the L2U tab mapping
function! s:L2U_SetTab(wait_insert_enter)
@@ -537,12 +580,12 @@ function! s:L2U_SetTab(wait_insert_enter)
return
endif
if get(b:, "prev_completefunc", "") != "LaTeXtoUnicode#completefunc"
let b:prev_completefunc = &completefunc
" Backup the previous completefunc (the check is probably not really needed)
if get(b:, "l2u_prev_completefunc", "") != "LaTeXtoUnicode#completefunc"
let b:l2u_prev_completefunc = &completefunc
endif
setlocal completefunc=LaTeXtoUnicode#completefunc
call s:L2U_SetFallbackMapping('<Tab>', s:l2u_fallback_trigger)
let b:l2u_prev_map_tab = s:L2U_SetFallbackMapping('<Tab>', s:l2u_fallback_trigger)
imap <buffer> <Tab> <Plug>L2UTab
inoremap <buffer><expr> <Plug>L2UTab LaTeXtoUnicode#Tab()
@@ -560,10 +603,10 @@ function! s:L2U_UnsetTab()
endif
if !b:l2u_tab_set
return
exec "setlocal completefunc=" . get(b:, "prev_completefunc", "")
endif
exec "setlocal completefunc=" . get(b:, "l2u_prev_completefunc", "")
iunmap <buffer> <Tab>
call s:L2U_SetFallbackMapping(s:l2u_fallback_trigger, '<Tab>')
if empty(maparg("<Tab>", "i"))
call s:L2U_ReinstateMapping(b:l2u_prev_map_tab)
endif
iunmap <buffer> <Plug>L2UTab
@@ -572,13 +615,25 @@ endfunction
endfunction
" Function which looks for viable LaTeX-to-Unicode supstitutions as you type
function! LaTeXtoUnicode#AutoSub(...)
" avoid recursive calls
if get(b:, "l2u_in_autosub", 0)
return ''
endif
let vc = a:0 == 0 ? v:char : a:1
" for some reason function keys seem to be passed as characters 149 (F1-F12)
" or 186 (F13-F37, these are entered with shift/ctrl). In such cases, we
" can't really do any better than giving up.
if char2nr(vc) == 149 || char2nr(vc) == 186
return ''
endif
let b:l2u_in_autosub = 1
let col1 = col('.')
let lnum = line('.')
if col1 == 1
call feedkeys(a:2, 'n')
if a:0 > 1
call feedkeys(a:2, 't')
endif
let b:l2u_in_autosub = 0
return ''
endif
@@ -586,21 +641,42 @@ function! LaTeXtoUnicode#AutoSub(...)
let l = getline(lnum)[0 : col1-1-bs] . v:char
let col0 = match(l, '\\\%([_^]\?[A-Za-z]\+\%' . col1 . 'c\%([^A-Za-z]\|$\)\|[_^]\%([0-9()=+-]\)\%' . col1 .'c\%(.\|$\)\)')
if col0 == -1
call feedkeys(a:2, 'n')
if a:0 > 1
call feedkeys(a:2, 't')
endif
let b:l2u_in_autosub = 0
return ''
let base = l[col0 : -1-bs]
endif
let base = l[col0 : col1-1-bs]
let unicode = get(g:l2u_symbols_dict, base, '')
if empty(unicode)
call feedkeys(a:2, 'n')
if a:0 > 1
call feedkeys(a:2, 't')
endif
let b:l2u_in_autosub = 0
return ''
endif
" create a temporary mapping to reset b:l2u_in_autosub when done
" (when invoked, it removes itself)
exec 'imap <buffer> ' . s:l2u_autosub_cleanup_trigger . ' <Plug>L2UAutosubReset'
inoremap <buffer><expr> <Plug>L2UAutosubReset <SID>L2U_AutosubReset()
" perform the substitution, wrapping it in undo breakpoints so that
" we can revert it as a whole
call feedkeys("\<C-G>u", 'n')
call feedkeys(repeat("\b", len(base) + bs) . unicode . vc . s:l2u_esc_sequence, 'nt')
call feedkeys("\<C-G>u", 'n')
" enqueue the reset mechanism
call feedkeys(s:l2u_autosub_cleanup_trigger)
return ''
endfunction
function! s:L2U_AutosubReset()
" no longer doing substitution
let b:l2u_in_autosub = 0
" remove the mapping that triggered this function
exec 'iunmap <buffer> ' . s:l2u_autosub_cleanup_trigger
iunmap <buffer> <Plug>L2UAutosubReset
return ''
endfunction
@@ -619,8 +695,10 @@ function! s:L2U_SetAutoSub(wait_insert_enter)
endif
" Viable substitutions are searched at every character insertion via the
" autocmd InsertCharPre. The <Enter> key does not seem to be catched in
" this way though, so we use a mapping for that case.
let b:l2u_prev_map_cr = s:L2U_SetFallbackMapping('<CR>', s:l2u_fallback_trigger_cr)
inoremap <buffer><expr> <Plug>L2UAutoSub LaTeXtoUnicode#AutoSub("\n", "\<CR>")
imap <buffer> <CR> <Plug>L2UAutoSub
exec 'inoremap <buffer><expr> <Plug>L2UAutoSub LaTeXtoUnicode#AutoSub("\n", "' . s:l2u_fallback_trigger_cr . '")'
augroup L2UAutoSub
@@ -637,7 +715,11 @@ function! s:L2U_UnsetAutoSub()
return
endif
iunmap <buffer> <CR>
if empty(maparg("<CR>", "i"))
call s:L2U_ReinstateMapping(b:l2u_prev_map_cr)
endif
iunmap <buffer> <Plug>L2UAutoSub
exe 'iunmap <buffer> ' . s:l2u_fallback_trigger_cr
augroup L2UAutoSub
autocmd! * <buffer>

View File

@@ -1989,7 +1989,6 @@ fu! csv#AnalyzeColumn(...) "{{{3
endif
let title="Nr\tCount\t % \tValue"
endif
echohl Title
echo printf("%s", title)
echohl Normal
@@ -2311,7 +2310,7 @@ fu! csv#CommandDefinitions() "{{{3
call csv#LocalCmd("NewDelimiter", ':call csv#NewDelimiter(<q-args>, 1, line(''$''))',
\ '-nargs=1')
call csv#LocalCmd("Duplicates", ':call csv#CheckDuplicates(<q-args>)',
\ '-nargs=1 -complete=custom,csv#CompleteColumnNr')
\ '-nargs=? -complete=custom,csv#CompleteColumnNr')
call csv#LocalCmd('Transpose', ':call csv#Transpose(<line1>, <line2>)',
\ '-range=%')
call csv#LocalCmd('CSVTabularize', ':call csv#Tabularize(<bang>0,<line1>,<line2>)',
@@ -2499,12 +2498,16 @@ fu! csv#CompleteColumnNr(A,L,P) "{{{3
return join(range(1,csv#MaxColumns()), "\n")
endfu
fu! csv#CheckDuplicates(list) "{{{3
let string = a:list
if string =~ '\d\s\?-\s\?\d'
let string = substitute(string, '\(\d\+\)\s\?-\s\?\(\d\+\)',
\ '\=join(range(submatch(1),submatch(2)), ",")', '')
if empty(a:list)
let list=[csv#WColumn()]
else
let string = a:list
if string =~ '\d\s\?-\s\?\d'
let string = substitute(string, '\(\d\+\)\s\?-\s\?\(\d\+\)',
\ '\=join(range(submatch(1),submatch(2)), ",")', '')
endif
let list=split(string, ',')
endif
let list=split(string, ',')
call csv#DuplicateRows(list)
endfu
fu! csv#Transpose(line1, line2) "{{{3

View File

@@ -336,6 +336,7 @@ function! s:download(branch)
\ )
if v:shell_error == 0
call system('unzip -o -d ' . s:script_root_dir . "/fsac " . zip)
call system('find ' . s:script_root_dir . '/fsac' . ' -type f -exec chmod 777 \{\} \;')
echom "[FSAC] Updated FsAutoComplete to version " . a:branch . ""
else
echom "[FSAC] Failed to update FsAutoComplete"

View File

@@ -315,7 +315,7 @@ function! go#config#FmtAutosave() abort
endfunction
function! go#config#ImportsAutosave() abort
return get(g:, 'go_imports_autosave', 0)
return get(g:, 'go_imports_autosave', 1)
endfunction
function! go#config#SetFmtAutosave(value) abort
@@ -359,11 +359,11 @@ function! go#config#DeclsMode() abort
endfunction
function! go#config#FmtCommand() abort
return get(g:, "go_fmt_command", "gofmt")
return get(g:, "go_fmt_command", go#config#GoplsEnabled() ? 'gopls' : 'gofmt')
endfunction
function! go#config#ImportsMode() abort
return get(g:, "go_imports_mode", "goimports")
return get(g:, "go_imports_mode", go#config#GoplsEnabled() ? 'gopls' : 'goimports')
endfunction
function! go#config#FmtOptions() abort
@@ -388,7 +388,7 @@ function! go#config#RenameCommand() abort
endfunction
function! go#config#GorenameBin() abort
return get(g:, "go_gorename_bin", "gopls")
return get(g:, "go_gorename_bin", 'gopls')
endfunction
function! go#config#GorenamePrefill() abort

View File

@@ -2,7 +2,7 @@ if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'autoload/graphql.v
finish
endif
" Copyright (c) 2016-2020 Jon Parise <jon@indelible.org>
" Copyright (c) 2016-2021 Jon Parise <jon@indelible.org>
"
" Permission is hereby granted, free of charge, to any person obtaining a copy
" of this software and associated documentation files (the "Software"), to

View File

@@ -1321,7 +1321,7 @@ endif
if !has_key(g:polyglot_is_disabled, 'html')
au BufNewFile,BufRead,BufWritePost *.html call polyglot#detect#Html()
au BufNewFile,BufRead *.htm,*.html.hl,*.inc,*.st,*.xht,*.xhtml setf html
au BufNewFile,BufRead *.htm,*.html.hl,*.inc,*.xht,*.xhtml setf html
endif
if !has_key(g:polyglot_is_disabled, 'hollywood')
@@ -2000,7 +2000,7 @@ if !has_key(g:polyglot_is_disabled, 'rspec')
endif
if !has_key(g:polyglot_is_disabled, 'ruby')
au BufNewFile,BufRead *.axlsx,*.builder,*.cap,*.eye,*.fcgi,*.gemspec,*.god,*.jbuilder,*.mspec,*.opal,*.pluginspec,*.podspec,*.rabl,*.rake,*.rant,*.rb,*.rbi,*.rbuild,*.rbw,*.rbx,*.rjs,*.ru,*.ruby,*.rxml,*.spec,*.thor,*.watchr,{.,}Brewfile,{.,}Guardfile,{.,}autotest,{.,}irbrc,{.,}pryrc,{.,}simplecov,Appraisals,Berksfile,Buildfile,Capfile,Cheffile,Dangerfile,Deliverfile,Fastfile,Gemfile,Gemfile.lock,Guardfile,Jarfile,KitchenSink,Mavenfile,Podfile,Puppetfile,Rakefile,Routefile,Snapfile,Thorfile,Vagrantfile,[Rr]antfile,buildfile,vagrantfile setf ruby
au BufNewFile,BufRead *.axlsx,*.builder,*.cap,*.eye,*.fcgi,*.gemspec,*.god,*.jbuilder,*.mspec,*.opal,*.pluginspec,*.podspec,*.prawn,*.rabl,*.rake,*.rant,*.rb,*.rbi,*.rbuild,*.rbw,*.rbx,*.rjs,*.ru,*.ruby,*.rxml,*.spec,*.thor,*.watchr,{.,}Brewfile,{.,}Guardfile,{.,}autotest,{.,}irbrc,{.,}pryrc,{.,}simplecov,Appraisals,Berksfile,Buildfile,Capfile,Cheffile,Dangerfile,Deliverfile,Fastfile,Gemfile,Guardfile,Jarfile,KitchenSink,Mavenfile,Podfile,Puppetfile,Rakefile,Routefile,Snapfile,Thorfile,Vagrantfile,[Rr]antfile,buildfile,vagrantfile setf ruby
au BufNewFile,BufRead [Rr]akefile* call s:StarSetf('ruby')
au BufNewFile,BufRead *.erb,*.erb.deface,*.rhtml setf eruby
endif
@@ -2592,7 +2592,7 @@ if !has_key(g:polyglot_is_disabled, 'ant')
endif
if !has_key(g:polyglot_is_disabled, 'xml')
au BufNewFile,BufRead *.adml,*.admx,*.ant,*.axml,*.builds,*.ccproj,*.ccxml,*.cdxml,*.clixml,*.cproject,*.cscfg,*.csdef,*.csl,*.csproj,*.csproj.user,*.ct,*.depproj,*.dita,*.ditamap,*.ditaval,*.dll.config,*.dotsettings,*.filters,*.fsproj,*.fxml,*.glade,*.gml,*.gmx,*.grxml,*.gst,*.iml,*.ivy,*.jelly,*.jsproj,*.kml,*.launch,*.mdpolicy,*.mjml,*.mm,*.mod,*.mxml,*.natvis,*.ncl,*.ndproj,*.nproj,*.nuspec,*.odd,*.osm,*.pkgproj,*.pluginspec,*.proj,*.props,*.psc1,*.pt,*.rdf,*.res,*.resx,*.rs,*.rss,*.sch,*.scxml,*.sfproj,*.shproj,*.srdf,*.storyboard,*.sublime-snippet,*.targets,*.tml,*.tpm,*.ui,*.urdf,*.ux,*.vbproj,*.vcxproj,*.vsixmanifest,*.vssettings,*.vstemplate,*.vxml,*.wixproj,*.workflow,*.wpl,*.wsdl,*.wsf,*.wxi,*.wxl,*.wxs,*.x3d,*.xacro,*.xaml,*.xib,*.xlf,*.xliff,*.xmi,*.xml,*.xml.dist,*.xproj,*.xsd,*.xspec,*.xul,*.zcml,*/etc/blkid.tab,*/etc/blkid.tab.old,*/etc/xdg/menus/*.menu,*fglrxrc,{.,}classpath,{.,}cproject,{.,}project,App.config,NuGet.config,Settings.StyleCop,Web.Debug.config,Web.Release.config,Web.config,packages.config setf xml
au BufNewFile,BufRead *.adml,*.admx,*.ant,*.axml,*.builds,*.ccproj,*.ccxml,*.cdxml,*.clixml,*.cproject,*.cscfg,*.csdef,*.csl,*.csproj,*.csproj.user,*.ct,*.depproj,*.dita,*.ditamap,*.ditaval,*.dll.config,*.dotsettings,*.filters,*.fsproj,*.fxml,*.glade,*.gml,*.gmx,*.grxml,*.gst,*.iml,*.ivy,*.jelly,*.jsproj,*.kml,*.launch,*.mdpolicy,*.mjml,*.mm,*.mod,*.mxml,*.natvis,*.ncl,*.ndproj,*.nproj,*.nuspec,*.odd,*.osm,*.pkgproj,*.pluginspec,*.proj,*.props,*.psc1,*.pt,*.rdf,*.res,*.resx,*.rs,*.rss,*.sch,*.scxml,*.sfproj,*.shproj,*.srdf,*.storyboard,*.sublime-snippet,*.targets,*.tml,*.tpm,*.ui,*.urdf,*.ux,*.vbproj,*.vcxproj,*.vsixmanifest,*.vssettings,*.vstemplate,*.vxml,*.wixproj,*.workflow,*.wpl,*.wsdl,*.wsf,*.wxi,*.wxl,*.wxs,*.x3d,*.xacro,*.xaml,*.xib,*.xlf,*.xliff,*.xmi,*.xml,*.xml.dist,*.xmp,*.xproj,*.xsd,*.xspec,*.xul,*.zcml,*/etc/blkid.tab,*/etc/blkid.tab.old,*/etc/xdg/menus/*.menu,*fglrxrc,{.,}classpath,{.,}cproject,{.,}project,App.config,NuGet.config,Settings.StyleCop,Web.Debug.config,Web.Release.config,Web.config,packages.config setf xml
endif
if !has_key(g:polyglot_is_disabled, 'csv')

View File

@@ -229,7 +229,7 @@ let s:globs = {
\ 'hollywood': '*.hws',
\ 'hostconf': '',
\ 'hostsaccess': '',
\ 'html': '*.html,*.htm,*.html.hl,*.inc,*.st,*.xht,*.xhtml',
\ 'html': '*.html,*.htm,*.html.hl,*.inc,*.xht,*.xhtml',
\ 'html.handlebars': '*.handlebars,*.hbs,*.hdbs,*.hb',
\ 'html.mustache': '*.mustache,*.hogan,*.hulk,*.hjs',
\ 'html.twig': '*.twig',
@@ -462,7 +462,7 @@ let s:globs = {
\ 'rrst': '*.rrst,*.srst',
\ 'rst': '*.rst,*.rest,*.rest.txt,*.rst.txt',
\ 'rtf': '*.rtf',
\ 'ruby': '*.rb,*.builder,*.eye,*.fcgi,*.gemspec,*.god,*.jbuilder,*.mspec,*.pluginspec,*.podspec,*.rabl,*.rake,*.rbi,*.rbuild,*.rbw,*.rbx,*.ru,*.ruby,*.spec,*.thor,*.watchr,*.rxml,*.rjs,*.rant,*.axlsx,*.cap,*.opal,.irbrc,.pryrc,.simplecov,Appraisals,Berksfile,Buildfile,Capfile,Dangerfile,Deliverfile,Fastfile,Gemfile,Gemfile.lock,Guardfile,Jarfile,Mavenfile,Podfile,Puppetfile,Rakefile,Snapfile,Thorfile,Vagrantfile,buildfile,[Rr]antfile,.autotest,Cheffile,KitchenSink,Routefile,.Guardfile,.Brewfile,vagrantfile,[Rr]akefile*,*_spec.rb',
\ 'ruby': '*.rb,*.builder,*.eye,*.fcgi,*.gemspec,*.god,*.jbuilder,*.mspec,*.pluginspec,*.podspec,*.prawn,*.rabl,*.rake,*.rbi,*.rbuild,*.rbw,*.rbx,*.ru,*.ruby,*.spec,*.thor,*.watchr,*.rxml,*.rjs,*.rant,*.axlsx,*.cap,*.opal,.irbrc,.pryrc,.simplecov,Appraisals,Berksfile,Buildfile,Capfile,Dangerfile,Deliverfile,Fastfile,Gemfile,Guardfile,Jarfile,Mavenfile,Podfile,Puppetfile,Rakefile,Snapfile,Thorfile,Vagrantfile,buildfile,[Rr]antfile,.autotest,Cheffile,KitchenSink,Routefile,.Guardfile,.Brewfile,vagrantfile,[Rr]akefile*,*_spec.rb',
\ 'rust': '*.rs,*.rs.in',
\ 'samba': 'smb.conf',
\ 'sas': '*.sas',
@@ -612,7 +612,7 @@ let s:globs = {
\ 'xhtml': '*.xhtml,*.xht',
\ 'xinetd': '',
\ 'xmath': '*.msc,*.msf',
\ 'xml': '*.xml,*.adml,*.admx,*.ant,*.axml,*.builds,*.ccproj,*.ccxml,*.clixml,*.cproject,*.cscfg,*.csdef,*.csl,*.csproj,*.ct,*.depproj,*.dita,*.ditamap,*.ditaval,*.dll.config,*.dotsettings,*.filters,*.fsproj,*.fxml,*.glade,*.gml,*.gmx,*.grxml,*.gst,*.iml,*.ivy,*.jelly,*.jsproj,*.kml,*.launch,*.mdpolicy,*.mjml,*.mm,*.mod,*.mxml,*.natvis,*.ncl,*.ndproj,*.nproj,*.nuspec,*.odd,*.osm,*.pkgproj,*.pluginspec,*.proj,*.props,*.psc1,*.pt,*.rdf,*.res,*.resx,*.rs,*.rss,*.sch,*.scxml,*.sfproj,*.shproj,*.srdf,*.storyboard,*.sublime-snippet,*.targets,*.tml,*.ui,*.urdf,*.ux,*.vbproj,*.vcxproj,*.vsixmanifest,*.vssettings,*.vstemplate,*.vxml,*.wixproj,*.workflow,*.wsdl,*.wsf,*.wxi,*.wxl,*.wxs,*.x3d,*.xacro,*.xaml,*.xib,*.xlf,*.xliff,*.xmi,*.xml.dist,*.xproj,*.xsd,*.xspec,*.xul,*.zcml,*.cdxml,*.tpm,*.csproj.user,*.wpl,.classpath,.cproject,.project,App.config,NuGet.config,Settings.StyleCop,Web.Debug.config,Web.Release.config,Web.config,packages.config,*fglrxrc',
\ 'xml': '*.xml,*.adml,*.admx,*.ant,*.axml,*.builds,*.ccproj,*.ccxml,*.clixml,*.cproject,*.cscfg,*.csdef,*.csl,*.csproj,*.ct,*.depproj,*.dita,*.ditamap,*.ditaval,*.dll.config,*.dotsettings,*.filters,*.fsproj,*.fxml,*.glade,*.gml,*.gmx,*.grxml,*.gst,*.iml,*.ivy,*.jelly,*.jsproj,*.kml,*.launch,*.mdpolicy,*.mjml,*.mm,*.mod,*.mxml,*.natvis,*.ncl,*.ndproj,*.nproj,*.nuspec,*.odd,*.osm,*.pkgproj,*.pluginspec,*.proj,*.props,*.psc1,*.pt,*.rdf,*.res,*.resx,*.rs,*.rss,*.sch,*.scxml,*.sfproj,*.shproj,*.srdf,*.storyboard,*.sublime-snippet,*.targets,*.tml,*.ui,*.urdf,*.ux,*.vbproj,*.vcxproj,*.vsixmanifest,*.vssettings,*.vstemplate,*.vxml,*.wixproj,*.workflow,*.wsdl,*.wsf,*.wxi,*.wxl,*.wxs,*.x3d,*.xacro,*.xaml,*.xib,*.xlf,*.xliff,*.xmi,*.xml.dist,*.xmp,*.xproj,*.xsd,*.xspec,*.xul,*.zcml,*.cdxml,*.tpm,*.csproj.user,*.wpl,.classpath,.cproject,.project,App.config,NuGet.config,Settings.StyleCop,Web.Debug.config,Web.Release.config,Web.config,packages.config,*fglrxrc',
\ 'xml.twig': '*.xml.twig',
\ 'xmodmap': '*Xmodmap,*xmodmap*',
\ 'xpm': '*.xpm,*.pm',

View File

@@ -3,7 +3,7 @@ if polyglot#init#is_disabled(expand('<sfile>:p'), 'requirements', 'autoload/requ
endif
" the Requirements File Format syntax support for Vim
" Version: 1.5.3
" Version: 1.6.0
" Author: raimon <raimon49@hotmail.com>
" License: MIT LICENSE
" The MIT License (MIT)

View File

@@ -12,11 +12,13 @@ function! zig#fmt#Format() abort
" Save cursor position and many other things.
let view = winsaveview()
let current_buf = bufnr('')
if !executable('zig')
echohl Error | echomsg "no zig binary found in PATH" | echohl None
return
endif
let bin_path = get(g:, 'zig_bin_path', 'zig')
let stderr_file = tempname()
let cmdline = printf('%s fmt --stdin 2> %s', bin_path, stderr_file)
let cmdline = 'zig fmt --stdin'
let current_buf = bufnr('')
" The formatted code is output on stdout, the errors go on stderr.
if exists('*systemlist')
@@ -42,7 +44,7 @@ function! zig#fmt#Format() abort
call setloclist(0, [], 'r')
lclose
elseif get(g:, 'zig_fmt_parse_errors', 1)
let errors = s:parse_errors(expand('%'), readfile(stderr_file))
let errors = s:parse_errors(expand('%'), out)
call setloclist(0, [], 'r', {
\ 'title': 'Errors',
@@ -53,11 +55,9 @@ function! zig#fmt#Format() abort
" Prevent the loclist from becoming too long.
let win_height = min([max_win_height, len(errors)])
" Open the loclist, but only if there's at least one error to show.
execute 'lwindow ' . win_height
execute 'silent! lwindow ' . win_height
endif
call delete(stderr_file)
call winrestview(view)
if err != 0