mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-18 16:43:26 -05:00
Run scripts/build with changes
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'requirements', 'autoload/coc/source/requirements.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
""
|
||||
" https://github.com/neoclide/coc.nvim/wiki/Create-custom-source
|
||||
function! coc#source#requirements#init() abort
|
||||
return {
|
||||
\ 'shortcut': 'pip',
|
||||
\ 'priority': 9,
|
||||
\ 'filetypes': ['requirements'],
|
||||
\ }
|
||||
endfunction
|
||||
|
||||
""
|
||||
" https://github.com/neoclide/coc.nvim/wiki/Create-custom-source
|
||||
"
|
||||
" Completion pip option and PYPI package names.
|
||||
" Note: completion PYPI package names need install pip-cache from PYPI,
|
||||
" and run `pip-cache update` first to generate cache.
|
||||
function! coc#source#requirements#complete(opt, cb) abort
|
||||
call a:cb(g:requirements#items)
|
||||
endfunction
|
||||
" vim: et sw=4 ts=4 sts=4:
|
||||
216
autoload/csv.vim
216
autoload/csv.vim
@@ -224,11 +224,11 @@ endfu
|
||||
|
||||
fu! csv#RemoveAutoHighlight() "{{{3
|
||||
exe "aug CSV_HI".bufnr('')
|
||||
exe "au! CursorMoved <buffer=".bufnr('').">"
|
||||
exe "au! "
|
||||
aug end
|
||||
exe "aug! CSV_HI".bufnr('')
|
||||
" Remove any existing highlighting
|
||||
HiColumn!
|
||||
call csv#HiCol('', 1)
|
||||
endfu
|
||||
|
||||
fu! csv#DoAutoCommands() "{{{3
|
||||
@@ -246,9 +246,8 @@ fu! csv#DoAutoCommands() "{{{3
|
||||
endif
|
||||
" undo autocommand:
|
||||
let b:undo_ftplugin .= '| exe "sil! au! CSV_HI'.bufnr('').' CursorMoved <buffer> "'
|
||||
let b:undo_ftplugin .= '| exe "sil! aug! CSV_HI'.bufnr('').'"'
|
||||
let b:undo_ftplugin .= '| call csv#RemoveAutoHighlight()'
|
||||
let b:undo_ftplugin = 'exe "sil! HiColumn!" |' . b:undo_ftplugin
|
||||
|
||||
if has("gui_running") && !exists("#CSV_Menu#FileType")
|
||||
augroup CSV_Menu
|
||||
au!
|
||||
@@ -443,10 +442,14 @@ fu! csv#HiCol(colnr, bang) "{{{3
|
||||
if exists("s:matchid")
|
||||
" ignore errors, that come from already deleted matches
|
||||
sil! call matchdelete(s:matchid)
|
||||
if a:bang
|
||||
unlet! s:matchid
|
||||
return
|
||||
endif
|
||||
endif
|
||||
" Additionally, filter all matches, that could have been used earlier
|
||||
let matchlist=getmatches()
|
||||
call filter(matchlist, 'v:val["group"] !~ s:hiGroup')
|
||||
call filter(matchlist, 'v:val["group"] !~? s:hiGroup')
|
||||
call setmatches(matchlist)
|
||||
if a:bang
|
||||
return
|
||||
@@ -455,6 +458,10 @@ fu! csv#HiCol(colnr, bang) "{{{3
|
||||
elseif !a:bang
|
||||
exe ":2match " . s:hiGroup . ' /' . pat . '/'
|
||||
endif
|
||||
" Remove Highlighting once switching away from the buffer
|
||||
exe "aug CSV_HI".bufnr('')
|
||||
exe "au BufWinLeave <buffer=".bufnr('')."> call csv#RemoveAutoHighlight()"
|
||||
aug end
|
||||
endfu
|
||||
fu! csv#GetDelimiter(first, last, ...) "{{{3
|
||||
" This depends on the locale. Hopefully it works
|
||||
@@ -482,12 +489,16 @@ fu! csv#GetDelimiter(first, last, ...) "{{{3
|
||||
" :silent :s does not work with lazyredraw
|
||||
let _lz = &lz
|
||||
set nolz
|
||||
" substitute without output when cmdheight=0
|
||||
let _cmdheight = &cmdheight
|
||||
set cmdheight=1
|
||||
for i in values(Delim)
|
||||
redir => temp[i]
|
||||
" use very non-magic
|
||||
exe ":silent! :". first. ",". last. 's/\V' . i . "/&/nge"
|
||||
redir END
|
||||
endfor
|
||||
let &cmdheight = _cmdheight
|
||||
let &lz = _lz
|
||||
let Delim = map(temp, 'matchstr(substitute(v:val, "\n", "", ""), "^\\s*\\d\\+")')
|
||||
let Delim = filter(temp, 'v:val=~''\d''')
|
||||
@@ -779,7 +790,11 @@ fu! csv#CalculateColumnWidth(row, silent) "{{{3
|
||||
" does not work with fixed width columns
|
||||
" row for the row for which to calculate the width
|
||||
let b:col_width=[]
|
||||
let vts_save=""
|
||||
if has( 'vartabs' ) && b:delimiter == "\t"
|
||||
if &l:vts
|
||||
let vts_save=&vts
|
||||
endif
|
||||
setlocal vts=
|
||||
endif
|
||||
try
|
||||
@@ -800,6 +815,9 @@ fu! csv#CalculateColumnWidth(row, silent) "{{{3
|
||||
" delete buffer content in variable b:csv_list,
|
||||
" this was only necessary for calculating the max width
|
||||
unlet! b:csv_list s:columnize_count s:decimal_column
|
||||
if vts_save
|
||||
let &l:vts=vts_save
|
||||
endif
|
||||
endfu
|
||||
fu! csv#Columnize(field) "{{{3
|
||||
" Internal function, not called from external,
|
||||
@@ -867,7 +885,7 @@ fu! csv#Columnize(field) "{{{3
|
||||
if get(s:decimal_column, colnr, 0) == 0
|
||||
call csv#CheckHeaderLine()
|
||||
call csv#NumberFormat()
|
||||
let data = csv#CopyCol('', colnr+1, '')[s:csv_fold_headerline : -1]
|
||||
let data = csv#CopyCol('', colnr+1, '', 0)[s:csv_fold_headerline : -1]
|
||||
let pat1 = escape(s:nr_format[1], '.').'\zs[^'.s:nr_format[1].']*\ze'.
|
||||
\ (has_delimiter ? b:delimiter : '').'$'
|
||||
let pat2 = '\d\+\ze\%(\%('.escape(s:nr_format[1], '.'). '\d\+\)\|'.
|
||||
@@ -1001,9 +1019,9 @@ fu! csv#SplitHeaderLine(lines, bang, hor) "{{{3
|
||||
setl scrollopt=ver scrollbind cursorbind
|
||||
noa 0
|
||||
if a:lines[-1:] is? '!'
|
||||
let a=csv#CopyCol('',a:lines,'')
|
||||
let a=csv#CopyCol('',a:lines,'', 0)
|
||||
else
|
||||
let a=csv#CopyCol('',1, a:lines-1)
|
||||
let a=csv#CopyCol('',1, a:lines-1, 0)
|
||||
endif
|
||||
" Does it make sense to use the preview window?
|
||||
"vert sil! pedit |wincmd w | enew!
|
||||
@@ -1240,7 +1258,7 @@ fu! csv#Sort(bang, line1, line2, colnr) range "{{{3
|
||||
\' r'. flag. ' /' . pat . '/'
|
||||
call winrestview(wsv)
|
||||
endfun
|
||||
fu! csv#CopyCol(reg, col, cnt) "{{{3
|
||||
fu! csv#CopyCol(reg, col, cnt, bang) "{{{3
|
||||
" Return Specified Column into register reg
|
||||
let col = a:col == "0" ? csv#WColumn() : a:col+0
|
||||
let mcol = csv#MaxColumns()
|
||||
@@ -1254,11 +1272,18 @@ fu! csv#CopyCol(reg, col, cnt) "{{{3
|
||||
let cnt_cols = col + a:cnt - 1
|
||||
endif
|
||||
let a = []
|
||||
let first = 1
|
||||
call csv#CheckHeaderLine()
|
||||
if a:bang && first <= s:csv_fold_headerline
|
||||
" don't take the header line into consideration
|
||||
let first = s:csv_fold_headerline + 1
|
||||
endif
|
||||
|
||||
" Don't get lines, that are currently filtered away
|
||||
if !exists("b:csv_filter") || empty(b:csv_filter)
|
||||
let a=getline(1, '$')
|
||||
let a=getline(first, '$')
|
||||
else
|
||||
for line in range(1, line('$'))
|
||||
for line in range(first, line('$'))
|
||||
if foldlevel(line)
|
||||
continue
|
||||
else
|
||||
@@ -1686,7 +1711,7 @@ fu! csv#DoForEachColumn(start, stop, bang) range "{{{3
|
||||
endif
|
||||
|
||||
for item in range(a:start, a:stop, 1)
|
||||
if foldlevel(line)
|
||||
if foldlevel(item)
|
||||
" Filter out folded lines (from dynamic filter)
|
||||
continue
|
||||
endif
|
||||
@@ -1719,7 +1744,7 @@ fu! csv#DoForEachColumn(start, stop, bang) range "{{{3
|
||||
endfor
|
||||
endif
|
||||
for j in range(1, columns, 1)
|
||||
let t=substitute(t, '%s', fields[j-1], '')
|
||||
let t=substitute(t, '%s', get(fields, j-1, ''), '')
|
||||
endfor
|
||||
call add(result, t)
|
||||
endfor
|
||||
@@ -1738,7 +1763,7 @@ fu! csv#PrepareDoForEachColumn(start, stop, bang) range"{{{3
|
||||
let post = exists("g:csv_post_convert") ? g:csv_post_convert : ''
|
||||
let g:csv_post_convert=input('Post convert text: ', post)
|
||||
let convert = exists("g:csv_convert") ? g:csv_convert : ''
|
||||
let g:csv_convert=input("Converted text, use %s for column input:\n", convert)
|
||||
let g:csv_convert=input("How to convert data (use %s for column input):\n", convert)
|
||||
call csv#DoForEachColumn(a:start, a:stop, a:bang)
|
||||
endfun
|
||||
fu! csv#EscapeValue(val) "{{{3
|
||||
@@ -1986,7 +2011,7 @@ fu! csv#AnalyzeColumn(...) "{{{3
|
||||
|
||||
" Initialize csv#fold_headerline
|
||||
call csv#CheckHeaderLine()
|
||||
let data = csv#CopyCol('', colnr, '')[s:csv_fold_headerline : -1]
|
||||
let data = csv#CopyCol('', colnr, '', 0)[s:csv_fold_headerline : -1]
|
||||
let qty = len(data)
|
||||
let res = {}
|
||||
for item in data
|
||||
@@ -2259,100 +2284,45 @@ fu! csv#CSVMappings() "{{{3
|
||||
endif
|
||||
endfu
|
||||
fu! csv#CommandDefinitions() "{{{3
|
||||
call csv#LocalCmd("WhatColumn", ':echo csv#WColumn(<bang>0)',
|
||||
\ '-bang')
|
||||
call csv#LocalCmd("NrColumns", ':call csv#NrColumns(<q-bang>)', '-bang')
|
||||
call csv#LocalCmd("HiColumn", ':call csv#HiCol(<q-args>,<bang>0)',
|
||||
\ '-bang -nargs=?')
|
||||
call csv#LocalCmd("SearchInColumn",
|
||||
\ ':call csv#SearchColumn(<q-args>)', '-nargs=*')
|
||||
call csv#LocalCmd("DeleteColumn", ':call csv#DeleteColumn(<q-args>)',
|
||||
\ '-nargs=? -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("ArrangeColumn",
|
||||
\ ':call csv#ArrangeCol(<line1>, <line2>, <bang>0, -1, <q-args>)',
|
||||
\ '-range -bang -bar -nargs=?')
|
||||
call csv#LocalCmd("SmplVarCol",
|
||||
\ ':echo csv#EvalColumn(<q-args>, "csv#SmplVarianceColumn", <line1>,<line2>)',
|
||||
\ '-nargs=? -range=% -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("PopVarCol",
|
||||
\ ':echo csv#EvalColumn(<q-args>, "csv#PopVarianceColumn", <line1>,<line2>)',
|
||||
\ '-nargs=? -range=% -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("SmplStdCol",
|
||||
\ ':echo csv#EvalColumn(<q-args>, "csv#SmplStdDevColumn", <line1>,<line2>)',
|
||||
\ '-nargs=? -range=% -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("PopStdCol",
|
||||
\ ':echo csv#EvalColumn(<q-args>, "csv#PopStdDevColumn", <line1>,<line2>)',
|
||||
\ '-nargs=? -range=% -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("UnArrangeColumn",
|
||||
\':call csv#PrepUnArrangeCol(<line1>, <line2>)',
|
||||
\ '-bar -range')
|
||||
call csv#LocalCmd("CSVInit", ':call csv#Init(<line1>,<line2>,<bang>0)',
|
||||
\ '-bang -range=%')
|
||||
call csv#LocalCmd('Header',
|
||||
\ ':call csv#SplitHeaderLine(<q-args>,<bang>0,1)',
|
||||
\ '-nargs=? -bang')
|
||||
call csv#LocalCmd('VHeader',
|
||||
\ ':call csv#SplitHeaderLine(<q-args>,<bang>0,0)',
|
||||
\ '-nargs=? -bang')
|
||||
call csv#LocalCmd("HeaderToggle",
|
||||
\ ':call csv#SplitHeaderToggle(1)', '')
|
||||
call csv#LocalCmd("VHeaderToggle",
|
||||
\ ':call csv#SplitHeaderToggle(0)', '')
|
||||
call csv#LocalCmd("Sort",
|
||||
\ ':call csv#Sort(<bang>0, <line1>,<line2>,<q-args>)',
|
||||
\ '-nargs=* -bang -range=% -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("Column",
|
||||
\ ':call csv#CopyCol(empty(<q-reg>)?''"'':<q-reg>,<q-count>,<q-args>)',
|
||||
\ '-count -register -nargs=?')
|
||||
call csv#LocalCmd("MoveColumn",
|
||||
\ ':call csv#MoveColumn(<line1>,<line2>,<f-args>)',
|
||||
\ '-range=% -nargs=* -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("SumCol",
|
||||
\ ':echo csv#EvalColumn(<q-args>, "csv#SumColumn", <line1>,<line2>)',
|
||||
\ '-nargs=? -range=% -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("MaxCol",
|
||||
\ ':echo csv#EvalColumn(<q-args>, "csv#MaxColumn", <line1>,<line2>, 1)',
|
||||
\ '-nargs=? -range=% -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("MinCol",
|
||||
\ ':echo csv#EvalColumn(<q-args>, "csv#MaxColumn", <line1>,<line2>, 0)',
|
||||
\ '-nargs=? -range=% -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("CountCol",
|
||||
\ ':echo csv#EvalColumn(<q-args>, "csv#CountColumn", <line1>,<line2>)',
|
||||
\ '-nargs=? -range=% -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("AvgCol",
|
||||
\ ':echo csv#EvalColumn(<q-args>, "csv#AvgColumn", <line1>,<line2>)',
|
||||
\ '-nargs=? -range=% -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd('SumRow', ':call csv#SumCSVRow(<q-count>, <q-args>)',
|
||||
\ '-nargs=? -range')
|
||||
call csv#LocalCmd("ConvertData",
|
||||
\ ':call csv#PrepareDoForEachColumn(<line1>,<line2>,<bang>0)',
|
||||
\ '-bang -nargs=? -range=%')
|
||||
call csv#LocalCmd("Filters", ':call csv#OutputFilters(<bang>0)',
|
||||
\ '-nargs=0 -bang')
|
||||
call csv#LocalCmd("Analyze", ':call csv#AnalyzeColumn(<f-args>)',
|
||||
\ '-nargs=*' )
|
||||
call csv#LocalCmd("VertFold", ':call csv#Vertfold(<bang>0,<q-args>)',
|
||||
\ '-bang -nargs=? -range=% -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("AddColumn", ':call csv#AddColumn(<line1>,<line2>,<f-args>)', '-range=% -nargs=* -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("Analyze", ':call csv#AnalyzeColumn(<f-args>)', '-nargs=*' )
|
||||
call csv#LocalCmd("ArrangeColumn", ':call csv#ArrangeCol(<line1>, <line2>, <bang>0, -1, <q-args>)', '-range -bang -bar -nargs=?')
|
||||
call csv#LocalCmd("AvgCol", ':echo csv#EvalColumn(<q-args>, "csv#AvgColumn", <line1>,<line2>)', '-nargs=? -range=% -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("CSVFixed", ':call csv#InitCSVFixedWidth()', '')
|
||||
call csv#LocalCmd("NewRecord", ':call csv#NewRecord(<line1>,
|
||||
\ <line2>, <q-args>)', '-nargs=? -range')
|
||||
call csv#LocalCmd("NewDelimiter", ':call csv#NewDelimiter(<q-args>, 1, line(''$''))',
|
||||
\ '-nargs=1')
|
||||
call csv#LocalCmd("Duplicates", ':call csv#CheckDuplicates(<q-args>)',
|
||||
\ '-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>)',
|
||||
\ '-bang -range=%')
|
||||
call csv#LocalCmd("AddColumn",
|
||||
\ ':call csv#AddColumn(<line1>,<line2>,<f-args>)',
|
||||
\ '-range=% -nargs=* -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("DupColumn",
|
||||
\ ':call csv#DupColumn(<line1>,<line2>,<f-args>)',
|
||||
\ '-range=% -nargs=* -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd('Substitute', ':call csv#SubstituteInColumn(<q-args>,<line1>,<line2>)',
|
||||
\ '-nargs=1 -range=%')
|
||||
call csv#LocalCmd("CSVInit", ':call csv#Init(<line1>,<line2>,<bang>0)', '-bang -range=%')
|
||||
call csv#LocalCmd("Column", ':call csv#CopyCol(empty(<q-reg>)?''"'':<q-reg>,<q-count>,<q-args>, <bang>0)', '-bang -count -register -nargs=?')
|
||||
call csv#LocalCmd("ConvertData", ':call csv#PrepareDoForEachColumn(<line1>,<line2>,<bang>0)', '-bang -nargs=0 -range=%')
|
||||
call csv#LocalCmd("CountCol", ':echo csv#EvalColumn(<q-args>, "csv#CountColumn", <line1>,<line2>)', '-nargs=? -range=% -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("DeleteColumn", ':call csv#DeleteColumn(<q-args>)', '-nargs=? -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("DupColumn", ':call csv#DupColumn(<line1>,<line2>,<f-args>)', '-range=% -nargs=* -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("Duplicates", ':call csv#CheckDuplicates(<q-args>)', '-nargs=? -complete=custom,csv#CompleteColumnNr')
|
||||
call csv#LocalCmd("Filters", ':call csv#OutputFilters(<bang>0)', '-nargs=0 -bang')
|
||||
call csv#LocalCmd("HeaderToggle", ':call csv#SplitHeaderToggle(1)', '')
|
||||
call csv#LocalCmd("HiColumn", ':call csv#HiCol(<q-args>,<bang>0)', '-bang -nargs=?')
|
||||
call csv#LocalCmd("MaxCol", ':echo csv#EvalColumn(<q-args>, "csv#MaxColumn", <line1>,<line2>, 1)', '-nargs=? -range=% -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("MinCol", ':echo csv#EvalColumn(<q-args>, "csv#MaxColumn", <line1>,<line2>, 0)', '-nargs=? -range=% -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("MoveColumn", ':call csv#MoveColumn(<line1>,<line2>,<f-args>)', '-range=% -nargs=* -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("NewDelimiter", ':call csv#NewDelimiter(<q-args>, 1, line(''$''))', '-nargs=1')
|
||||
call csv#LocalCmd("NewRecord", ':call csv#NewRecord(<line1>, <line2>, <q-args>)', '-nargs=? -range')
|
||||
call csv#LocalCmd("NrColumns", ':call csv#NrColumns(<q-bang>)', '-bang')
|
||||
call csv#LocalCmd("PopStdCol", ':echo csv#EvalColumn(<q-args>, "csv#PopStdDevColumn", <line1>,<line2>)', '-nargs=? -range=% -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("PopVarCol", ':echo csv#EvalColumn(<q-args>, "csv#PopVarianceColumn", <line1>,<line2>)', '-nargs=? -range=% -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("SearchInColumn", ':call csv#SearchColumn(<q-args>)', '-nargs=*')
|
||||
call csv#LocalCmd("SmplStdCol", ':echo csv#EvalColumn(<q-args>, "csv#SmplStdDevColumn", <line1>,<line2>)', '-nargs=? -range=% -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("SmplVarCol", ':echo csv#EvalColumn(<q-args>, "csv#SmplVarianceColumn", <line1>,<line2>)', '-nargs=? -range=% -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("Sort", ':call csv#Sort(<bang>0, <line1>,<line2>,<q-args>)', '-nargs=* -bang -range=% -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("SumCol", ':echo csv#EvalColumn(<q-args>, "csv#SumColumn", <line1>,<line2>)', '-nargs=? -range=% -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("UnArrangeColumn", ':call csv#PrepUnArrangeCol(<line1>, <line2>)', '-bar -range')
|
||||
call csv#LocalCmd("VHeaderToggle", ':call csv#SplitHeaderToggle(0)', '')
|
||||
call csv#LocalCmd("VertFold", ':call csv#Vertfold(<bang>0,<q-args>)', '-bang -nargs=? -range=% -complete=custom,csv#SortComplete')
|
||||
call csv#LocalCmd("WhatColumn", ':echo csv#WColumn(<bang>0)', '-bang')
|
||||
call csv#LocalCmd('CSVTabularize', ':call csv#Tabularize(<bang>0,<line1>,<line2>)', '-bang -range=%')
|
||||
call csv#LocalCmd('ColumnWidth', ':call csv#ColumnWidth()', '')
|
||||
call csv#LocalCmd('Header', ':call csv#SplitHeaderLine(<q-args>,<bang>0,1)', '-nargs=? -bang')
|
||||
call csv#LocalCmd('Substitute', ':call csv#SubstituteInColumn(<q-args>,<line1>,<line2>)', '-nargs=1 -range=%')
|
||||
call csv#LocalCmd('SumRow', ':call csv#SumCSVRow(<q-count>, <q-args>)', '-nargs=? -range')
|
||||
call csv#LocalCmd('Transpose', ':call csv#Transpose(<line1>, <line2>)', '-range=%')
|
||||
call csv#LocalCmd('VHeader', ':call csv#SplitHeaderLine(<q-args>,<bang>0,0)', '-nargs=? -bang')
|
||||
endfu
|
||||
fu! csv#ColumnWidth()
|
||||
let w=CSVWidth()
|
||||
@@ -2636,21 +2606,21 @@ fu! csv#Tabularize(bang, first, last) "{{{3
|
||||
endif
|
||||
let _c = winsaveview()
|
||||
" Table delimiter definition "{{{4
|
||||
if !exists("s:td")
|
||||
let s:td = {
|
||||
\ 'hbar': (&enc =~# 'utf-8' ? '─' : '-'),
|
||||
\ 'vbar': (&enc =~# 'utf-8' ? '│' : '|'),
|
||||
\ 'scol': (&enc =~# 'utf-8' ? '├' : '|'),
|
||||
\ 'ecol': (&enc =~# 'utf-8' ? '┤' : '|'),
|
||||
\ 'ltop': (&enc =~# 'utf-8' ? '┌' : '+'),
|
||||
\ 'rtop': (&enc =~# 'utf-8' ? '┐' : '+'),
|
||||
\ 'lbot': (&enc =~# 'utf-8' ? '└' : '+'),
|
||||
\ 'rbot': (&enc =~# 'utf-8' ? '┘' : '+'),
|
||||
\ 'cros': (&enc =~# 'utf-8' ? '┼' : '+'),
|
||||
\ 'dhor': (&enc =~# 'utf-8' ? '┬' : '-'),
|
||||
\ 'uhor': (&enc =~# 'utf-8' ? '┴' : '-')
|
||||
let use_unicode = &enc =~# 'utf-8' && get(g:, 'csv_table_use_ascii', 0) == 0
|
||||
let s:td = {
|
||||
\ 'hbar': (use_unicode ? '─' : '-'),
|
||||
\ 'vbar': (use_unicode ? '│' : '|'),
|
||||
\ 'scol': (use_unicode ? '├' : '|'),
|
||||
\ 'ecol': (use_unicode ? '┤' : '|'),
|
||||
\ 'ltop': (use_unicode ? '┌' : '+'),
|
||||
\ 'rtop': (use_unicode ? '┐' : '+'),
|
||||
\ 'lbot': (use_unicode ? '└' : '+'),
|
||||
\ 'rbot': (use_unicode ? '┘' : '+'),
|
||||
\ 'cros': (use_unicode ? '┼' : '+'),
|
||||
\ 'dhor': (use_unicode ? '┬' : '-'),
|
||||
\ 'uhor': (use_unicode ? '┴' : '-')
|
||||
\ }
|
||||
endif "}}}4
|
||||
"}}}4
|
||||
if match(getline(a:first), '^'.s:td.ltop) > -1
|
||||
" Already tabularized, done
|
||||
call csv#Warn("Looks already Tabularized, aborting!")
|
||||
@@ -2994,7 +2964,7 @@ fu! csv#EvalColumn(nr, func, first, last, ...) range "{{{3
|
||||
let stop += s:csv_fold_headerline
|
||||
endif
|
||||
|
||||
let column = csv#CopyCol('', col, '')[start : stop]
|
||||
let column = csv#CopyCol('', col, '', 0)[start : stop]
|
||||
let column = csv#GetCells(column)
|
||||
" Delete empty values
|
||||
" Leave this up to the function that does something
|
||||
@@ -3113,7 +3083,7 @@ fu! CSVField(x, y, ...) "{{{3
|
||||
let orig = !empty(a:0)
|
||||
let y = (y < 0 ? 0 : y)
|
||||
let x = (x > (csv#MaxColumns()) ? (csv#MaxColumns()) : x)
|
||||
let col = csv#CopyCol('',x,'')
|
||||
let col = csv#CopyCol('',x,'',0)
|
||||
if !orig
|
||||
" remove leading and trainling whitespace and the delimiter
|
||||
return matchstr(col[y], '^\s*\zs.\{-}\ze\s*'.b:delimiter.'\?$')
|
||||
|
||||
@@ -72,7 +72,7 @@ endfunction
|
||||
|
||||
function! s:in_embedded_view()
|
||||
let groups = map(synstack(line('.'), col('.')), "synIDattr(v:val, 'name')")
|
||||
for group in ['elixirPhoenixESigil', 'elixirLiveViewSigil', 'elixirSurfaceSigil']
|
||||
for group in ['elixirPhoenixESigil', 'elixirLiveViewSigil', 'elixirSurfaceSigil', 'elixirHeexSigil']
|
||||
if index(groups, group) >= 0
|
||||
return 1
|
||||
endif
|
||||
@@ -383,7 +383,7 @@ endfunction
|
||||
" function, etc... so we need to first figure out what the innermost structure
|
||||
" is then forward execution to the proper handler
|
||||
function! elixir#indent#handle_inside_block(context)
|
||||
let start_pattern = '\C\%(\<with\>\|\<if\>\|\<case\>\|\<cond\>\|\<try\>\|\<receive\>\|\<fn\>\|{\|\[\|(\)'
|
||||
let start_pattern = '\C\%(\<with\>\|\<if\>\|\<case\>\|\<cond\>\|\<try\>\|\<receive\>\|\<fn\>\|\<quote\>\|{\|\[\|(\)'
|
||||
let end_pattern = '\C\%(\<end\>\|\]\|}\|)\)'
|
||||
" hack - handle do: better
|
||||
let block_info = searchpairpos(start_pattern, '', end_pattern, 'bnW', "line('.') == " . line('.') . " || elixir#indent#searchpair_back_skip() || getline(line('.')) =~ 'do:'", max([0, a:context.lnum - g:elixir_indent_max_lookbehind]))
|
||||
@@ -398,6 +398,7 @@ function! elixir#indent#handle_inside_block(context)
|
||||
let never_match = ''
|
||||
let config = {
|
||||
\'f': {'aligned_clauses': s:keyword('end'), 'pattern_match_clauses': never_match},
|
||||
\'q': {'aligned_clauses': s:keyword('end'), 'pattern_match_clauses': never_match},
|
||||
\'c': {'aligned_clauses': s:keyword('end'), 'pattern_match_clauses': never_match},
|
||||
\'t': {'aligned_clauses': s:keyword('end\|catch\|rescue\|after\|else'), 'pattern_match_clauses': s:keyword('catch\|rescue\|else')},
|
||||
\'r': {'aligned_clauses': s:keyword('end\|after'), 'pattern_match_clauses': s:keyword('after')},
|
||||
|
||||
@@ -153,5 +153,5 @@ function! fish#Complete(findstart, base)
|
||||
endfunction
|
||||
|
||||
function! fish#errorformat()
|
||||
return '%Afish: %m,%-G%*\\ ^,%-Z%f (line %l):%s'
|
||||
return '%E%f (line %l):%m,%C%p^%.%#,%-C%.%#'
|
||||
endfunction
|
||||
|
||||
@@ -167,7 +167,10 @@ let s:config_keys_camel =
|
||||
\ {'key': 'ExcludeProjectDirectories', 'default': []},
|
||||
\ {'key': 'keywordsAutocomplete', 'default': 1},
|
||||
\ {'key': 'ExternalAutocomplete', 'default': 0},
|
||||
\ {'key': 'FullNameExternalAutocomplete', 'default': 0},
|
||||
\ {'key': 'Linter', 'default': 1},
|
||||
\ {'key': 'LinterConfig'},
|
||||
\ {'key': 'IndentationSize', 'default': 4},
|
||||
\ {'key': 'UnionCaseStubGeneration', 'default': 1},
|
||||
\ {'key': 'UnionCaseStubGenerationBody'},
|
||||
\ {'key': 'RecordStubGeneration', 'default': 1},
|
||||
@@ -175,18 +178,39 @@ let s:config_keys_camel =
|
||||
\ {'key': 'InterfaceStubGeneration', 'default': 1},
|
||||
\ {'key': 'InterfaceStubGenerationObjectIdentifier', 'default': 'this'},
|
||||
\ {'key': 'InterfaceStubGenerationMethodBody'},
|
||||
\ {'key': 'AddPrivateAccessModifier', 'default': 0},
|
||||
\ {'key': 'UnusedOpensAnalyzer', 'default': 1},
|
||||
\ {'key': 'UnusedOpensAnalyzerExclusions', 'default': []},
|
||||
\ {'key': 'UnusedDeclarationsAnalyzer', 'default': 1},
|
||||
\ {'key': 'UnusedDeclarationsAnalyzerExclusions', 'default': []},
|
||||
\ {'key': 'SimplifyNameAnalyzer', 'default': 0},
|
||||
\ {'key': 'SimplifyNameAnalyzerExclusions', 'default': []},
|
||||
\ {'key': 'UnnecessaryParenthesesAnalyzer', 'default': 0},
|
||||
\ {'key': 'ResolveNamespaces', 'default': 1},
|
||||
\ {'key': 'EnableReferenceCodeLens', 'default': 1},
|
||||
\ {'key': 'EnableAnalyzers', 'default': 0},
|
||||
\ {'key': 'AnalyzersPath'},
|
||||
\ {'key': 'ExcludeAnalyzers'},
|
||||
\ {'key': 'IncludeAnalyzers'},
|
||||
\ {'key': 'DisableInMemoryProjectReferences', 'default': 0},
|
||||
\ {'key': 'LineLens', 'default': {'enabled': 'never', 'prefix': ''}},
|
||||
\ {'key': 'UseSdkScripts', 'default': 1},
|
||||
\ {'key': 'dotNetRoot'},
|
||||
\ {'key': 'fsiExtraParameters', 'default': []},
|
||||
\ {'key': 'fsiExtraParameters'},
|
||||
\ {'key': 'fsiExtraInteractiveParameters', 'default': ['--readline-']},
|
||||
\ {'key': 'fsiExtraSharedParameters', 'default': []},
|
||||
\ {'key': 'fsiCompilerToolLocations', 'default': []},
|
||||
\ {'key': 'TooltipMode', 'default': 'full'},
|
||||
\ {'key': 'GenerateBinlog', 'default': 0},
|
||||
\ {'key': 'AbstractClassStubGeneration', 'default': 1},
|
||||
\ {'key': 'AbstractClassStubGenerationObjectIdentifier', 'default': 'this'},
|
||||
\ {'key': 'AbstractClassStubGenerationMethodBody', 'default': 'failwith "Not Implemented"'},
|
||||
"\ {'key': 'CodeLenses', TODO},
|
||||
"\ {'key': 'PipelineHints', TODO}
|
||||
"\ {'key': 'InlayHints', TODO}
|
||||
"\ {'key': 'Fsac', TODO}
|
||||
"\ {'key': 'Notifications', TODO}
|
||||
"\ {'key': 'Debug', TODO}
|
||||
\ ]
|
||||
let s:config_keys = []
|
||||
|
||||
@@ -238,7 +262,7 @@ function! fsharp#loadConfig()
|
||||
endif
|
||||
|
||||
if !exists('g:fsharp#fsautocomplete_command')
|
||||
let g:fsharp#fsautocomplete_command = ['fsautocomplete', '--background-service-enabled']
|
||||
let g:fsharp#fsautocomplete_command = ['fsautocomplete']
|
||||
endif
|
||||
if !exists('g:fsharp#use_recommended_server_config')
|
||||
let g:fsharp#use_recommended_server_config = 1
|
||||
@@ -411,6 +435,10 @@ endfunction
|
||||
|
||||
let s:workspace = []
|
||||
|
||||
function! fsharp#getLoadedProjects()
|
||||
return copy(s:workspace)
|
||||
endfunction
|
||||
|
||||
function! fsharp#handle_notifyWorkspace(payload) abort
|
||||
let content = json_decode(a:payload.content)
|
||||
if content.Kind == 'projectLoading'
|
||||
@@ -532,7 +560,16 @@ endfunction
|
||||
|
||||
function! s:get_fsi_command()
|
||||
let cmd = g:fsharp#fsi_command
|
||||
for prm in g:fsharp#fsi_extra_parameters
|
||||
if exists("g:fsharp#fsi_extra_parameters")
|
||||
echom "[Ionide-vim]: `g:fsharp#fsi_extra_parameters` is being deprecated. Migrate to `g:fsharp#fsi_extra_interactive_parameters` and `g:fsharp_extra_shared_parameters`."
|
||||
for prm in g:fsharp#fsi_extra_parameters
|
||||
let cmd = cmd . " " . prm
|
||||
endfor
|
||||
endif
|
||||
for prm in g:fsharp#fsi_extra_interactive_parameters
|
||||
let cmd = cmd . " " . prm
|
||||
endfor
|
||||
for prm in g:fsharp#fsi_extra_shared_parameters
|
||||
let cmd = cmd . " " . prm
|
||||
endfor
|
||||
return cmd
|
||||
@@ -584,7 +621,7 @@ function! fsharp#openFsi(returnFocus)
|
||||
if a:returnFocus | call s:win_gotoid_safe(current_win) | endif
|
||||
return s:fsi_buffer
|
||||
else
|
||||
echom "[FSAC] Your (neo)vim does not support terminal".
|
||||
echom "[FSAC] Your (neo)vim does not support terminal."
|
||||
return 0
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -141,32 +141,6 @@ function! go#config#ListAutoclose() abort
|
||||
return get(g:, 'go_list_autoclose', 1)
|
||||
endfunction
|
||||
|
||||
function! go#config#InfoMode() abort
|
||||
return get(g:, 'go_info_mode', 'gopls')
|
||||
endfunction
|
||||
|
||||
function! go#config#GuruScope() abort
|
||||
let scope = get(g:, 'go_guru_scope', [])
|
||||
|
||||
if !empty(scope)
|
||||
" strip trailing slashes for each path in scope. bug:
|
||||
" https://github.com/golang/go/issues/14584
|
||||
let scopes = go#util#StripTrailingSlash(scope)
|
||||
endif
|
||||
|
||||
return scope
|
||||
endfunction
|
||||
|
||||
function! go#config#SetGuruScope(scope) abort
|
||||
if empty(a:scope)
|
||||
if exists('g:go_guru_scope')
|
||||
unlet g:go_guru_scope
|
||||
endif
|
||||
else
|
||||
let g:go_guru_scope = a:scope
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! go#config#EchoCommandInfo() abort
|
||||
return get(g:, 'go_echo_command_info', 1)
|
||||
endfunction
|
||||
@@ -204,6 +178,10 @@ function! go#config#Debug() abort
|
||||
return get(g:, 'go_debug', [])
|
||||
endfunction
|
||||
|
||||
function! go#config#DebugLogDelay() abort
|
||||
return get(g:, 'go_debug_log_delay', 10)
|
||||
endfunction
|
||||
|
||||
function! go#config#DebugWindows() abort
|
||||
return get(g:, 'go_debug_windows', {
|
||||
\ 'vars': 'leftabove 30vnew',
|
||||
|
||||
@@ -2,7 +2,7 @@ if polyglot#init#is_disabled(expand('<sfile>:p'), 'graphql', 'autoload/graphql.v
|
||||
finish
|
||||
endif
|
||||
|
||||
" Copyright (c) 2016-2021 Jon Parise <jon@indelible.org>
|
||||
" Copyright (c) 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
|
||||
@@ -25,6 +25,12 @@ endif
|
||||
" Language: GraphQL
|
||||
" Maintainer: Jon Parise <jon@indelible.org>
|
||||
|
||||
" Look up the named variable in buffer scope and then in global scope.
|
||||
" Returns default if the named variable can't be found in either.
|
||||
function! graphql#var(name, default) abort
|
||||
return get(b:, a:name, get(g:, a:name, a:default))
|
||||
endfunction
|
||||
|
||||
function! graphql#has_syntax_group(group) abort
|
||||
try
|
||||
silent execute 'silent highlight ' . a:group
|
||||
@@ -35,5 +41,5 @@ function! graphql#has_syntax_group(group) abort
|
||||
endfunction
|
||||
|
||||
function! graphql#javascript_tags() abort
|
||||
return get(g:, 'graphql_javascript_tags', ['gql', 'graphql', 'Relay.QL'])
|
||||
return graphql#var('graphql_javascript_tags', ['gql', 'graphql', 'Relay.QL'])
|
||||
endfunction
|
||||
|
||||
@@ -109,9 +109,11 @@ function! jsonnet#Format()
|
||||
call setfperm(expand('%'), l:originalFPerm)
|
||||
endif
|
||||
" the file has been changed outside of vim, enable reedit
|
||||
mkview
|
||||
silent edit!
|
||||
let &fileformat = l:originalFileFormat
|
||||
let &syntax = &syntax
|
||||
silent loadview
|
||||
elseif g:jsonnet_fmt_fail_silently == 0
|
||||
" FixMe: We could leverage the errors coming from the `jsonnetfmt` and
|
||||
" give immediate feedback to the user at every save time.
|
||||
@@ -126,4 +128,63 @@ function! jsonnet#Format()
|
||||
call winrestview(l:curw)
|
||||
endfunction
|
||||
|
||||
function! jsonnet#GetVisualSelection()
|
||||
" Source: https://stackoverflow.com/a/6271254
|
||||
" Why is this not a built-in Vim script function?!
|
||||
let [line_start, column_start] = getpos("'<")[1:2]
|
||||
let [line_end, column_end] = getpos("'>")[1:2]
|
||||
let lines = getline(line_start, line_end)
|
||||
if len(lines) == 0
|
||||
return ''
|
||||
endif
|
||||
let lines[-1] = lines[-1][: column_end - (&selection == 'inclusive' ? 1 : 2)]
|
||||
let lines[0] = lines[0][column_start - 1:]
|
||||
return join(lines, "\n")
|
||||
endfun
|
||||
|
||||
" Format calls `jsonnetfmt ... ` on a Visual selection
|
||||
function! jsonnet#FormatVisual()
|
||||
" Get current visual selection
|
||||
let l:selection = jsonnet#GetVisualSelection()
|
||||
|
||||
" Get the command first so we can test it
|
||||
let l:binName = g:jsonnet_fmt_command
|
||||
|
||||
" Check if the user has installed command binary.
|
||||
let l:binPath = jsonnet#CheckBinPath(l:binName)
|
||||
if empty(l:binPath)
|
||||
return
|
||||
endif
|
||||
|
||||
" Populate the final command.
|
||||
let l:command = l:binPath
|
||||
let l:command = l:command . ' -e '
|
||||
let l:command = l:command . g:jsonnet_fmt_options
|
||||
|
||||
" Execute the compiled jsonnetfmt command and save the return value
|
||||
let l:out = jsonnet#System(l:command . " \"" . l:selection . "\"")
|
||||
let l:errorCode = v:shell_error
|
||||
|
||||
" Save register contents
|
||||
let reg = '"'
|
||||
let save_cb = &cb
|
||||
let regInfo = getreginfo(reg)
|
||||
try
|
||||
" Set register to formatted output
|
||||
call setreg(reg,l:out)
|
||||
" Paste formatted output
|
||||
silent exe 'norm! gv'.(reg == '"' ? '' : '"' . reg).'p`['
|
||||
finally
|
||||
" Restore register contents
|
||||
let &cb = save_cb
|
||||
call setreg(reg, regInfo)
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" Evaluate jsonnet into vsplit
|
||||
function! jsonnet#Eval()
|
||||
let output = system(g:jsonnet_command . ' ' . shellescape(expand('%')))
|
||||
vnew
|
||||
setlocal nobuflisted buftype=nofile bufhidden=wipe noswapfile ft=jsonnet
|
||||
put! = output
|
||||
endfunction
|
||||
|
||||
@@ -3,7 +3,7 @@ if polyglot#init#is_disabled(expand('<sfile>:p'), 'julia', 'autoload/julia_latex
|
||||
endif
|
||||
|
||||
" This file is autogenerated from the script 'generate_latex_symbols_table.jl'
|
||||
" The symbols are based on Julia version 1.9.0-DEV.16
|
||||
" The symbols are based on Julia version 1.12.0-DEV.387
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
@@ -17,6 +17,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\copyright': '©',
|
||||
\ '\:copyright:': '©',
|
||||
\ '\ordfeminine': 'ª',
|
||||
\ '\guillemotleft': '«',
|
||||
\ '\neg': '¬',
|
||||
\ '\circledR': '®',
|
||||
\ '\:registered:': '®',
|
||||
@@ -29,6 +30,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\cdotp': '·',
|
||||
\ '\^1': '¹',
|
||||
\ '\ordmasculine': 'º',
|
||||
\ '\guillemotright': '»',
|
||||
\ '\1/4': '¼',
|
||||
\ '\1/2': '½',
|
||||
\ '\3/4': '¾',
|
||||
@@ -160,10 +162,10 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\Iota': 'Ι',
|
||||
\ '\Kappa': 'Κ',
|
||||
\ '\Lambda': 'Λ',
|
||||
\ '\upMu': 'Μ',
|
||||
\ '\upNu': 'Ν',
|
||||
\ '\Mu': 'Μ',
|
||||
\ '\Nu': 'Ν',
|
||||
\ '\Xi': 'Ξ',
|
||||
\ '\upOmicron': 'Ο',
|
||||
\ '\Omicron': 'Ο',
|
||||
\ '\Pi': 'Π',
|
||||
\ '\Rho': 'Ρ',
|
||||
\ '\Sigma': 'Σ',
|
||||
@@ -177,7 +179,6 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\beta': 'β',
|
||||
\ '\gamma': 'γ',
|
||||
\ '\delta': 'δ',
|
||||
\ '\upepsilon': 'ε',
|
||||
\ '\varepsilon': 'ε',
|
||||
\ '\zeta': 'ζ',
|
||||
\ '\eta': 'η',
|
||||
@@ -188,7 +189,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\mu': 'μ',
|
||||
\ '\nu': 'ν',
|
||||
\ '\xi': 'ξ',
|
||||
\ '\upomicron': 'ο',
|
||||
\ '\omicron': 'ο',
|
||||
\ '\pi': 'π',
|
||||
\ '\rho': 'ρ',
|
||||
\ '\varsigma': 'ς',
|
||||
@@ -199,20 +200,20 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\chi': 'χ',
|
||||
\ '\psi': 'ψ',
|
||||
\ '\omega': 'ω',
|
||||
\ '\upvarbeta': 'ϐ',
|
||||
\ '\varbeta': 'ϐ',
|
||||
\ '\vartheta': 'ϑ',
|
||||
\ '\phi': 'ϕ',
|
||||
\ '\varpi': 'ϖ',
|
||||
\ '\upoldKoppa': 'Ϙ',
|
||||
\ '\upoldkoppa': 'ϙ',
|
||||
\ '\oldKoppa': 'Ϙ',
|
||||
\ '\oldkoppa': 'ϙ',
|
||||
\ '\Stigma': 'Ϛ',
|
||||
\ '\upstigma': 'ϛ',
|
||||
\ '\stigma': 'ϛ',
|
||||
\ '\Digamma': 'Ϝ',
|
||||
\ '\digamma': 'ϝ',
|
||||
\ '\Koppa': 'Ϟ',
|
||||
\ '\upkoppa': 'ϟ',
|
||||
\ '\koppa': 'ϟ',
|
||||
\ '\Sampi': 'Ϡ',
|
||||
\ '\upsampi': 'ϡ',
|
||||
\ '\sampi': 'ϡ',
|
||||
\ '\varkappa': 'ϰ',
|
||||
\ '\varrho': 'ϱ',
|
||||
\ '\varTheta': 'ϴ',
|
||||
@@ -659,6 +660,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\measeq': '≞',
|
||||
\ '\questeq': '≟',
|
||||
\ '\ne': '≠',
|
||||
\ '\neq': '≠',
|
||||
\ '\equiv': '≡',
|
||||
\ '\nequiv': '≢',
|
||||
\ '\Equiv': '≣',
|
||||
@@ -804,7 +806,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\nsqsubseteq': '⋢',
|
||||
\ '\nsqsupseteq': '⋣',
|
||||
\ '\sqsubsetneq': '⋤',
|
||||
\ '\sqspne': '⋥',
|
||||
\ '\sqsupsetneq': '⋥',
|
||||
\ '\lnsim': '⋦',
|
||||
\ '\gnsim': '⋧',
|
||||
\ '\precnsim': '⋨',
|
||||
@@ -1151,6 +1153,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\threedangle': '⟀',
|
||||
\ '\whiteinwhitetriangle': '⟁',
|
||||
\ '\perp': '⟂',
|
||||
\ '\veedot': '⟇',
|
||||
\ '\bsolhsub': '⟈',
|
||||
\ '\suphsol': '⟉',
|
||||
\ '\wedgedot': '⟑',
|
||||
@@ -1273,6 +1276,8 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\UpEquilibrium': '⥮',
|
||||
\ '\ReverseUpEquilibrium': '⥯',
|
||||
\ '\RoundImplies': '⥰',
|
||||
\ '\leftarrowless': '⥷',
|
||||
\ '\leftarrowsubset': '⥺',
|
||||
\ '\Vvert': '⦀',
|
||||
\ '\Elroang': '⦆',
|
||||
\ '\ddfnc': '⦙',
|
||||
@@ -3386,6 +3391,10 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:hindu_temple:': '🛕',
|
||||
\ '\:hut:': '🛖',
|
||||
\ '\:elevator:': '🛗',
|
||||
\ '\:wireless:': '🛜',
|
||||
\ '\:playground_slide:': '🛝',
|
||||
\ '\:wheel:': '🛞',
|
||||
\ '\:ring_buoy:': '🛟',
|
||||
\ '\:airplane_departure:': '🛫',
|
||||
\ '\:airplane_arriving:': '🛬',
|
||||
\ '\:scooter:': '🛴',
|
||||
@@ -3409,6 +3418,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:large_green_square:': '🟩',
|
||||
\ '\:large_purple_square:': '🟪',
|
||||
\ '\:large_brown_square:': '🟫',
|
||||
\ '\:heavy_equals_sign:': '🟰',
|
||||
\ '\:pinched_fingers:': '🤌',
|
||||
\ '\:white_heart:': '🤍',
|
||||
\ '\:brown_heart:': '🤎',
|
||||
@@ -3516,6 +3526,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:cold_face:': '🥶',
|
||||
\ '\:ninja:': '🥷',
|
||||
\ '\:disguised_face:': '🥸',
|
||||
\ '\:face_holding_back_tears:': '🥹',
|
||||
\ '\:pleading_face:': '🥺',
|
||||
\ '\:sari:': '🥻',
|
||||
\ '\:lab_coat:': '🥼',
|
||||
@@ -3594,6 +3605,7 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:mate_drink:': '🧉',
|
||||
\ '\:ice_cube:': '🧊',
|
||||
\ '\:bubble_tea:': '🧋',
|
||||
\ '\:troll:': '🧌',
|
||||
\ '\:standing_person:': '🧍',
|
||||
\ '\:kneeling_person:': '🧎',
|
||||
\ '\:deaf_person:': '🧏',
|
||||
@@ -3650,9 +3662,14 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:briefs:': '🩲',
|
||||
\ '\:shorts:': '🩳',
|
||||
\ '\:thong_sandal:': '🩴',
|
||||
\ '\:light_blue_heart:': '🩵',
|
||||
\ '\:grey_heart:': '🩶',
|
||||
\ '\:pink_heart:': '🩷',
|
||||
\ '\:drop_of_blood:': '🩸',
|
||||
\ '\:adhesive_bandage:': '🩹',
|
||||
\ '\:stethoscope:': '🩺',
|
||||
\ '\:x-ray:': '🩻',
|
||||
\ '\:crutch:': '🩼',
|
||||
\ '\:yo-yo:': '🪀',
|
||||
\ '\:kite:': '🪁',
|
||||
\ '\:parachute:': '🪂',
|
||||
@@ -3660,6 +3677,8 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:magic_wand:': '🪄',
|
||||
\ '\:pinata:': '🪅',
|
||||
\ '\:nesting_dolls:': '🪆',
|
||||
\ '\:maracas:': '🪇',
|
||||
\ '\:flute:': '🪈',
|
||||
\ '\:ringed_planet:': '🪐',
|
||||
\ '\:chair:': '🪑',
|
||||
\ '\:razor:': '🪒',
|
||||
@@ -3685,6 +3704,13 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:headstone:': '🪦',
|
||||
\ '\:placard:': '🪧',
|
||||
\ '\:rock:': '🪨',
|
||||
\ '\:mirror_ball:': '🪩',
|
||||
\ '\:identification_card:': '🪪',
|
||||
\ '\:low_battery:': '🪫',
|
||||
\ '\:hamsa:': '🪬',
|
||||
\ '\:folding_hand_fan:': '🪭',
|
||||
\ '\:hair_pick:': '🪮',
|
||||
\ '\:khanda:': '🪯',
|
||||
\ '\:fly:': '🪰',
|
||||
\ '\:worm:': '🪱',
|
||||
\ '\:beetle:': '🪲',
|
||||
@@ -3692,14 +3718,50 @@ function! julia_latex_symbols#get_dict()
|
||||
\ '\:potted_plant:': '🪴',
|
||||
\ '\:wood:': '🪵',
|
||||
\ '\:feather:': '🪶',
|
||||
\ '\:lotus:': '🪷',
|
||||
\ '\:coral:': '🪸',
|
||||
\ '\:empty_nest:': '🪹',
|
||||
\ '\:nest_with_eggs:': '🪺',
|
||||
\ '\:hyacinth:': '🪻',
|
||||
\ '\:jellyfish:': '🪼',
|
||||
\ '\:wing:': '🪽',
|
||||
\ '\:goose:': '🪿',
|
||||
\ '\:anatomical_heart:': '🫀',
|
||||
\ '\:lungs:': '🫁',
|
||||
\ '\:people_hugging:': '🫂',
|
||||
\ '\:pregnant_man:': '🫃',
|
||||
\ '\:pregnant_person:': '🫄',
|
||||
\ '\:person_with_crown:': '🫅',
|
||||
\ '\:moose:': '🫎',
|
||||
\ '\:donkey:': '🫏',
|
||||
\ '\:blueberries:': '🫐',
|
||||
\ '\:bell_pepper:': '🫑',
|
||||
\ '\:olive:': '🫒',
|
||||
\ '\:flatbread:': '🫓',
|
||||
\ '\:tamale:': '🫔',
|
||||
\ '\:fondue:': '🫕',
|
||||
\ '\:teapot:': '🫖'}
|
||||
\ '\:teapot:': '🫖',
|
||||
\ '\:pouring_liquid:': '🫗',
|
||||
\ '\:beans:': '🫘',
|
||||
\ '\:jar:': '🫙',
|
||||
\ '\:ginger_root:': '🫚',
|
||||
\ '\:pea_pod:': '🫛',
|
||||
\ '\:melting_face:': '🫠',
|
||||
\ '\:saluting_face:': '🫡',
|
||||
\ '\:face_with_open_eyes_and_hand_over_mouth:': '🫢',
|
||||
\ '\:face_with_peeking_eye:': '🫣',
|
||||
\ '\:face_with_diagonal_mouth:': '🫤',
|
||||
\ '\:dotted_line_face:': '🫥',
|
||||
\ '\:biting_lip:': '🫦',
|
||||
\ '\:bubbles:': '🫧',
|
||||
\ '\:shaking_face:': '🫨',
|
||||
\ '\:hand_with_index_finger_and_thumb_crossed:': '🫰',
|
||||
\ '\:rightwards_hand:': '🫱',
|
||||
\ '\:leftwards_hand:': '🫲',
|
||||
\ '\:palm_down_hand:': '🫳',
|
||||
\ '\:palm_up_hand:': '🫴',
|
||||
\ '\:index_pointing_at_the_viewer:': '🫵',
|
||||
\ '\:heart_hands:': '🫶',
|
||||
\ '\:leftwards_pushing_hand:': '🫷',
|
||||
\ '\:rightwards_pushing_hand:': '🫸'}
|
||||
endfunction
|
||||
|
||||
@@ -3,6 +3,11 @@ if polyglot#init#is_disabled(expand('<sfile>:p'), 'ledger', 'autoload/ledger.vim
|
||||
endif
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists ('b:is_hledger')
|
||||
let b:is_hledger = g:ledger_is_hledger
|
||||
endif
|
||||
|
||||
" vim:ts=2:sw=2:sts=2:foldmethod=marker
|
||||
function! ledger#transaction_state_toggle(lnum, ...) abort
|
||||
if a:0 == 1
|
||||
@@ -509,7 +514,10 @@ function! ledger#align_commodity() abort
|
||||
endif
|
||||
if pos < 0
|
||||
" Find the position after the first digits
|
||||
let pos = matchend(rhs, '\m\d[^[:space:]]*')
|
||||
let pos = matchend(rhs, '\m\d[^[:space:]]*') - 1
|
||||
if pos >= 0
|
||||
let pos = strchars(rhs[:pos])
|
||||
endif
|
||||
endif
|
||||
" Go to the column that allows us to align the decimal separator at g:ledger_align_at:
|
||||
if pos >= 0
|
||||
@@ -643,7 +651,7 @@ endf
|
||||
" Build a ledger command to process the given file.
|
||||
function! s:ledger_cmd(file, args) abort
|
||||
let l:options = g:ledger_extra_options
|
||||
if len(g:ledger_date_format) > 0 && !g:ledger_is_hledger
|
||||
if len(g:ledger_date_format) > 0 && !b:is_hledger
|
||||
let l:options = join([l:options, '--date-format', g:ledger_date_format,
|
||||
\ '--input-date-format', g:ledger_date_format])
|
||||
endif
|
||||
@@ -670,7 +678,7 @@ endf
|
||||
" Use current line as input to ledger entry and replace with output. If there
|
||||
" are errors, they are echoed instead.
|
||||
function! ledger#entry() abort
|
||||
let l:output = systemlist(s:ledger_cmd(g:ledger_main, join(['entry', getline('.')])))
|
||||
let l:output = split(system(s:ledger_cmd(g:ledger_main, join(['entry', getline('.')]))), '\n')
|
||||
" Filter out warnings
|
||||
let l:output = filter(l:output, "v:val !~? '^Warning: '")
|
||||
" Errors may occur
|
||||
@@ -694,7 +702,7 @@ endfunc
|
||||
" Returns:
|
||||
" Ledger's output as a String.
|
||||
function! ledger#report(file, args) abort
|
||||
let l:output = systemlist(s:ledger_cmd(a:file, a:args))
|
||||
let l:output = split(system(s:ledger_cmd(a:file, a:args)), '\n')
|
||||
if v:shell_error " If there are errors, show them in a quickfix/location list.
|
||||
call s:quickfix_populate(l:output)
|
||||
call s:quickfix_toggle('Errors', 'Unable to parse errors')
|
||||
@@ -741,7 +749,7 @@ function! ledger#register(file, args) abort
|
||||
\ "--prepend-format='%(filename):%(beg_line) '",
|
||||
\ a:args
|
||||
\ ]))
|
||||
call s:quickfix_populate(systemlist(l:cmd))
|
||||
call s:quickfix_populate(split(system(l:cmd), '\n'))
|
||||
call s:quickfix_toggle('Register report')
|
||||
endf
|
||||
|
||||
@@ -760,7 +768,7 @@ function! ledger#reconcile(file, account, target_amount) abort
|
||||
\ shellescape(a:account)
|
||||
\ ]))
|
||||
let l:file = expand(a:file) " Needed for #show_balance() later
|
||||
call s:quickfix_populate(systemlist(l:cmd))
|
||||
call s:quickfix_populate(split(system(l:cmd), '\n'))
|
||||
if s:quickfix_toggle('Reconcile ' . a:account, 'Nothing to reconcile')
|
||||
let g:ledger_target_amount = a:target_amount
|
||||
" Show updated account balance upon saving, as long as the quickfix window is open
|
||||
@@ -804,7 +812,7 @@ function! ledger#show_balance(file, ...) abort
|
||||
\ "--format='%(scrub(get_at(display_total, 0)))|%(scrub(get_at(display_total, 1)))|%(quantity(scrub(get_at(display_total, 1))))'",
|
||||
\ (empty(g:ledger_default_commodity) ? '' : '-X ' . shellescape(g:ledger_default_commodity))
|
||||
\ ]))
|
||||
let l:output = systemlist(l:cmd)
|
||||
let l:output = split(system(l:cmd), '\n')
|
||||
" Errors may occur, for example, when the account has multiple commodities
|
||||
" and g:ledger_default_commodity is empty.
|
||||
if v:shell_error
|
||||
|
||||
18
autoload/neomake/makers/ft/pony.vim
Normal file
18
autoload/neomake/makers/ft/pony.vim
Normal file
@@ -0,0 +1,18 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'pony', 'autoload/neomake/makers/ft/pony.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! neomake#makers#ft#pony#EnabledMakers()
|
||||
return ['ponyc']
|
||||
endfunction
|
||||
|
||||
function! neomake#makers#ft#pony#ponyc()
|
||||
" This is currently a hack. Ponyc itself uses the project directory as
|
||||
" the target to build. Using %:p:h like this fetches the parent
|
||||
" directory of the current file which might cause supurious errors on
|
||||
" package imports if the current file is nested under a sub-directory.
|
||||
return {
|
||||
\ 'args': ['--pass=expr', '%:p:h'],
|
||||
\ 'errorformat': '%f:%l:%c: %m'
|
||||
\ }
|
||||
endfunction
|
||||
27
autoload/nix.vim
Normal file
27
autoload/nix.vim
Normal file
@@ -0,0 +1,27 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'nix', 'autoload/nix.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! nix#find_drv_position()
|
||||
let line = search("description")
|
||||
if line == 0
|
||||
let line = search("name")
|
||||
endif
|
||||
if line == 0
|
||||
echo "error: could not find derivation"
|
||||
return
|
||||
endif
|
||||
|
||||
return expand("%") . ":" . line
|
||||
endfunction
|
||||
|
||||
function! nix#edit(attr)
|
||||
let output = system("nix-instantiate --eval ./. -A " . a:attr . ".meta.position")
|
||||
if match(output, "^error:") == -1
|
||||
let position = split(split(output, '"')[0], ":")
|
||||
execute "edit " . position[0]
|
||||
execute position[1]
|
||||
" Update default command to nix-build.
|
||||
let b:dispatch = 'nix-build --no-out-link -A ' . a:attr
|
||||
endif
|
||||
endfunction
|
||||
@@ -1771,11 +1771,11 @@ endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'prolog')
|
||||
au! BufNewFile,BufRead,BufWritePost *.pl call polyglot#detect#Pl()
|
||||
au BufNewFile,BufRead *.pdb,*.pro,*.prolog,*.yap setf prolog
|
||||
au BufNewFile,BufRead *.pdb,*.plt,*.pro,*.prolog,*.yap setf prolog
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'bzl')
|
||||
au BufNewFile,BufRead *.BUILD,*.bazel,*.bzl,*.star,BUCK,BUILD,BUILD.bazel,Tiltfile,WORKSPACE setf bzl
|
||||
au BufNewFile,BufRead *.BUILD,*.bazel,*.bzl,*.star,BUCK,BUILD,BUILD.bazel,MODULE.bazel,Tiltfile,WORKSPACE,WORKSPACE.bazel setf bzl
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'odin')
|
||||
@@ -1783,7 +1783,7 @@ if !has_key(g:polyglot_is_disabled, 'odin')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'dosini')
|
||||
au BufNewFile,BufRead *.dof,*.ini,*.lektorproject,*.prefs,*.pro,*.properties,*.url,*/etc/pacman.conf,*/etc/yum.conf,{.,}coveragerc,{.,}editorconfig,{.,}flake8,{.,}npmrc,{.,}pylintrc,buildozer.spec,pylintrc setf dosini
|
||||
au BufNewFile,BufRead *.cnf,*.dof,*.ini,*.lektorproject,*.prefs,*.pro,*.properties,*.url,*/etc/pacman.conf,*/etc/yum.conf,{.,}coveragerc,{.,}editorconfig,{.,}flake8,{.,}npmrc,{.,}pylintrc,HOSTS,buildozer.spec,hosts,pylintrc,vlcrc setf dosini
|
||||
au BufNewFile,BufRead php.ini-* call s:StarSetf('dosini')
|
||||
au BufNewFile,BufRead */etc/yum.repos.d/* call s:StarSetf('dosini')
|
||||
endif
|
||||
@@ -1794,7 +1794,7 @@ endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'visual-basic')
|
||||
au! BufNewFile,BufRead,BufWritePost *.bas call polyglot#detect#Bas()
|
||||
au BufNewFile,BufRead *.cls,*.ctl,*.dsm,*.frm,*.frx,*.sba,*.vba,*.vbs setf vb
|
||||
au BufNewFile,BufRead *.cls,*.ctl,*.dsm,*.frm,*.sba,*.vba,*.vbs setf vb
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'basic')
|
||||
@@ -1807,7 +1807,7 @@ endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'zig')
|
||||
au BufNewFile,BufRead *.zir setf zir
|
||||
au BufNewFile,BufRead *.zig,*.zir setf zig
|
||||
au BufNewFile,BufRead *.zig,*.zig.zon,*.zir setf zig
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'zephir')
|
||||
@@ -1891,7 +1891,7 @@ if !has_key(g:polyglot_is_disabled, 'tptp')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'toml')
|
||||
au BufNewFile,BufRead *.toml,*/.cargo/config,*/.cargo/credentials,Cargo.lock,Gopkg.lock,Pipfile,poetry.lock setf toml
|
||||
au BufNewFile,BufRead *.toml,*/.cargo/config,*/.cargo/credentials,Cargo.lock,Cargo.toml.orig,Gopkg.lock,Pipfile,pdm.lock,poetry.lock setf toml
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'tmux')
|
||||
@@ -1957,7 +1957,7 @@ if !has_key(g:polyglot_is_disabled, 'slim')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'sh')
|
||||
au BufNewFile,BufRead *.bash,*.bats,*.cgi,*.command,*.env,*.fcgi,*.ksh,*.sh,*.sh.in,*.tmux,*.tool,*.zsh-theme,*/etc/udev/cdsymlinks.conf,{.,}bash_aliases,{.,}bash_history,{.,}bash_logout,{.,}bash_profile,{.,}bashrc,{.,}cshrc,{.,}env,{.,}env.example,{.,}flaskenv,{.,}kshrc,{.,}login,{.,}profile,9fs,PKGBUILD,bash_aliases,bash_logout,bash_profile,bashrc,cshrc,gradlew,kshrc,login,man,profile setf sh
|
||||
au BufNewFile,BufRead *.bash,*.bats,*.cgi,*.command,*.fcgi,*.ksh,*.sh,*.sh.in,*.tmux,*.tool,*.trigger,*.zsh-theme,*/etc/udev/cdsymlinks.conf,{.,}bash_aliases,{.,}bash_functions,{.,}bash_history,{.,}bash_logout,{.,}bash_profile,{.,}bashrc,{.,}cshrc,{.,}envrc,{.,}flaskenv,{.,}kshrc,{.,}login,{.,}profile,{.,}tmux.conf,9fs,PKGBUILD,bash_aliases,bash_logout,bash_profile,bashrc,cshrc,gradlew,kshrc,login,man,profile,tmux.conf setf sh
|
||||
au BufNewFile,BufRead *.zsh,*/etc/zprofile,{.,}zfbfmarks,{.,}zlogin,{.,}zlogout,{.,}zprofile,{.,}zshenv,{.,}zshrc setf zsh
|
||||
au BufNewFile,BufRead .zsh* call s:StarSetf('zsh')
|
||||
au BufNewFile,BufRead .zlog* call s:StarSetf('zsh')
|
||||
@@ -2033,7 +2033,7 @@ if !has_key(g:polyglot_is_disabled, 'requirements')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'python')
|
||||
au BufNewFile,BufRead *.cgi,*.fcgi,*.gyp,*.gypi,*.lmi,*.ptl,*.py,*.py3,*.pyde,*.pyi,*.pyp,*.pyt,*.pyw,*.rpy,*.smk,*.spec,*.tac,*.wsgi,*.xpy,{.,}gclient,{.,}pythonrc,{.,}pythonstartup,DEPS,SConscript,SConstruct,Snakefile,wscript setf python
|
||||
au BufNewFile,BufRead *.cgi,*.fcgi,*.gyp,*.gypi,*.lmi,*.ptl,*.py,*.py3,*.pyde,*.pyi,*.pyp,*.pyt,*.pyw,*.rpy,*.spec,*.tac,*.wsgi,*.xpy,{.,}gclient,{.,}pythonrc,{.,}pythonstartup,DEPS,SConscript,SConstruct,wscript setf python
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'purescript')
|
||||
@@ -2053,6 +2053,10 @@ if !has_key(g:polyglot_is_disabled, 'protobuf')
|
||||
au BufNewFile,BufRead *.proto setf proto
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'prisma')
|
||||
au BufNewFile,BufRead *.prisma setf prisma
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'powershell')
|
||||
au BufNewFile,BufRead *.ps1,*.psd1,*.psm1,*.pssc setf ps1
|
||||
au BufNewFile,BufRead *.ps1xml setf ps1xml
|
||||
@@ -2216,7 +2220,7 @@ if !has_key(g:polyglot_is_disabled, 'perl')
|
||||
au! BufNewFile,BufRead,BufWritePost *.t call polyglot#detect#T()
|
||||
au! BufNewFile,BufRead,BufWritePost *.pm call polyglot#detect#Pm()
|
||||
au! BufNewFile,BufRead,BufWritePost *.pl call polyglot#detect#Pl()
|
||||
au BufNewFile,BufRead *.al,*.cgi,*.fcgi,*.perl,*.ph,*.plx,*.psgi,{.,}gitolite.rc,Makefile.PL,Rexfile,ack,cpanfile,example.gitolite.rc setf perl
|
||||
au BufNewFile,BufRead *.al,*.cgi,*.fcgi,*.perl,*.ph,*.plx,*.psgi,{.,}gitolite.rc,{.,}latexmkrc,Makefile.PL,Rexfile,ack,cpanfile,example.gitolite.rc,latexmkrc setf perl
|
||||
au BufNewFile,BufRead *.pod setf pod
|
||||
au BufNewFile,BufRead *.comp,*.mason,*.mhtml setf mason
|
||||
au! BufNewFile,BufRead,BufWritePost *.tt2 call polyglot#detect#Tt2()
|
||||
@@ -2233,7 +2237,7 @@ if !has_key(g:polyglot_is_disabled, 'jsonnet')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'json')
|
||||
au BufNewFile,BufRead *.4DForm,*.4DProject,*.JSON-tmLanguage,*.avsc,*.geojson,*.gltf,*.har,*.ice,*.json,*.jsonl,*.jsonp,*.mcmeta,*.template,*.tfstate,*.tfstate.backup,*.topojson,*.webapp,*.webmanifest,*.yy,*.yyp,{.,}arcconfig,{.,}auto-changelog,{.,}c8rc,{.,}htmlhintrc,{.,}imgbotconfig,{.,}nycrc,{.,}tern-config,{.,}tern-project,{.,}watchmanconfig,Pipfile.lock,composer.lock,mcmod.info setf json
|
||||
au BufNewFile,BufRead *.4DForm,*.4DProject,*.JSON-tmLanguage,*.avsc,*.geojson,*.gltf,*.har,*.ice,*.json,*.jsonl,*.jsonp,*.mcmeta,*.sarif,*.template,*.tfstate,*.tfstate.backup,*.topojson,*.webapp,*.webmanifest,*.yy,*.yyp,{.,}all-contributorsrc,{.,}arcconfig,{.,}auto-changelog,{.,}c8rc,{.,}htmlhintrc,{.,}imgbotconfig,{.,}nycrc,{.,}tern-config,{.,}tern-project,{.,}watchmanconfig,MODULE.bazel.lock,Pipfile.lock,composer.lock,deno.lock,flake.lock,mcmod.info setf json
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'json5')
|
||||
@@ -2347,7 +2351,7 @@ endif
|
||||
if !has_key(g:polyglot_is_disabled, 'glsl')
|
||||
au! BufNewFile,BufRead,BufWritePost *.fs call polyglot#detect#Fs()
|
||||
au! BufNewFile,BufRead,BufWritePost *.frag call polyglot#detect#Frag()
|
||||
au BufNewFile,BufRead *.comp,*.fp,*.frg,*.fsh,*.fshader,*.geo,*.geom,*.glsl,*.glslf,*.glslv,*.gs,*.gshader,*.rchit,*.rmiss,*.shader,*.tesc,*.tese,*.vert,*.vrx,*.vsh,*.vshader setf glsl
|
||||
au BufNewFile,BufRead *.comp,*.fp,*.frg,*.fsh,*.fshader,*.geo,*.geom,*.glsl,*.glslf,*.glslv,*.gs,*.gshader,*.rchit,*.rmiss,*.shader,*.tesc,*.tese,*.vert,*.vrx,*.vs,*.vsh,*.vshader setf glsl
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'git')
|
||||
@@ -2538,7 +2542,7 @@ endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'c/c++')
|
||||
au! BufNewFile,BufRead,BufWritePost *.h call polyglot#detect#H()
|
||||
au BufNewFile,BufRead *.c++,*.cc,*.cp,*.cpp,*.cxx,*.h++,*.hh,*.hpp,*.hxx,*.inc,*.inl,*.ipp,*.ixx,*.moc,*.tcc,*.tlh,*.tpp setf cpp
|
||||
au BufNewFile,BufRead *.c++,*.cc,*.cp,*.cpp,*.cppm,*.cxx,*.h++,*.hh,*.hpp,*.hxx,*.inc,*.inl,*.ipp,*.ixx,*.moc,*.tcc,*.tlh,*.tpp,*.txx setf cpp
|
||||
au! BufNewFile,BufRead,BufWritePost *.h call polyglot#detect#H()
|
||||
au BufNewFile,BufRead *.c,*.cats,*.idc,*.qc,*enlightenment/*.cfg setf c
|
||||
endif
|
||||
@@ -2579,7 +2583,7 @@ if !has_key(g:polyglot_is_disabled, 'ant')
|
||||
endif
|
||||
|
||||
if !has_key(g:polyglot_is_disabled, 'xml')
|
||||
au BufNewFile,BufRead *.adml,*.admx,*.ant,*.axaml,*.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,*.hzp,*.iml,*.ivy,*.jelly,*.jsproj,*.kml,*.launch,*.mdpolicy,*.mjml,*.mod,*.mxml,*.natvis,*.ncl,*.ndproj,*.nproj,*.nuspec,*.odd,*.osm,*.pkgproj,*.pluginspec,*.proj,*.props,*.psc1,*.pt,*.qhelp,*.rdf,*.res,*.resx,*.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
|
||||
au BufNewFile,BufRead *.adml,*.admx,*.ant,*.axaml,*.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,*.hzp,*.iml,*.ivy,*.jelly,*.jsproj,*.kml,*.launch,*.mdpolicy,*.mjml,*.mod,*.mojo,*.mxml,*.natvis,*.ncl,*.ndproj,*.nproj,*.nuspec,*.odd,*.osm,*.pkgproj,*.pluginspec,*.proj,*.props,*.psc1,*.pt,*.qhelp,*.rdf,*.res,*.resx,*.rss,*.sch,*.scxml,*.sfproj,*.shproj,*.srdf,*.storyboard,*.sublime-snippet,*.sw,*.targets,*.tml,*.tpm,*.typ,*.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')
|
||||
|
||||
@@ -499,6 +499,9 @@ let s:interpreters = {
|
||||
\ 'python': 'python',
|
||||
\ 'python2': 'python',
|
||||
\ 'python3': 'python',
|
||||
\ 'py': 'python',
|
||||
\ 'pypy': 'python',
|
||||
\ 'pypy3': 'python',
|
||||
\ 'qmake': 'qmake',
|
||||
\ 'Rscript': 'r',
|
||||
\ 'racket': 'racket',
|
||||
@@ -510,6 +513,7 @@ let s:interpreters = {
|
||||
\ 'rake': 'ruby',
|
||||
\ 'jruby': 'ruby',
|
||||
\ 'rbx': 'ruby',
|
||||
\ 'rust-script': 'rust',
|
||||
\ 'scala': 'scala',
|
||||
\ 'ash': 'sh',
|
||||
\ 'bash': 'sh',
|
||||
@@ -531,6 +535,7 @@ let s:interpreters = {
|
||||
\ 'z3': 'smt2',
|
||||
\ 'deno': 'typescript',
|
||||
\ 'ts-node': 'typescript',
|
||||
\ 'tsx': 'typescript',
|
||||
\ 'zsh': 'zsh',
|
||||
\ }
|
||||
" DO NOT EDIT CODE ABOVE, IT IS GENERATED WITH MAKEFILE
|
||||
|
||||
@@ -55,7 +55,7 @@ let s:globs = {
|
||||
\ 'brewfile': 'Brewfile',
|
||||
\ 'bsdl': '*.bsdl,*bsd',
|
||||
\ 'bst': '*.bst',
|
||||
\ 'bzl': '*.bzl,*.star,*.bazel,*.BUILD,BUCK,BUILD,BUILD.bazel,Tiltfile,WORKSPACE',
|
||||
\ 'bzl': '*.bzl,*.star,*.bazel,*.BUILD,BUCK,BUILD,BUILD.bazel,MODULE.bazel,Tiltfile,WORKSPACE,WORKSPACE.bazel',
|
||||
\ 'bzr': 'bzr_log.*',
|
||||
\ 'c': '*.c,*.cats,*.h,*.idc,*.qc',
|
||||
\ 'cabal': '*.cabal',
|
||||
@@ -86,7 +86,7 @@ let s:globs = {
|
||||
\ 'conf': '*.conf,auto.master,config',
|
||||
\ 'config': 'configure.in,configure.ac,Pipfile',
|
||||
\ 'context': '*.mkii,*.mkiv,*.mkvi',
|
||||
\ 'cpp': '*.cpp,*.c++,*.cc,*.cp,*.cxx,*.h,*.h++,*.hh,*.hpp,*.hxx,*.inc,*.inl,*.ipp,*.ixx,*.tcc,*.tpp,*.moc,*.tlh',
|
||||
\ 'cpp': '*.cpp,*.c++,*.cc,*.cp,*.cppm,*.cxx,*.h,*.h++,*.hh,*.hpp,*.hxx,*.inc,*.inl,*.ipp,*.ixx,*.tcc,*.tpp,*.txx,*.moc,*.tlh',
|
||||
\ 'cql': '*.cql',
|
||||
\ 'crm': '*.crm',
|
||||
\ 'crontab': 'crontab,crontab.*',
|
||||
@@ -130,7 +130,7 @@ let s:globs = {
|
||||
\ 'dnsmasq': '',
|
||||
\ 'dockerfile': '*.Dockerfile,*.dock,Containerfile,Dockerfile,dockerfile,Dockerfile*',
|
||||
\ 'dosbatch': '*.bat,*.sys',
|
||||
\ 'dosini': '*.wrap,*.ini,*.dof,*.lektorproject,*.prefs,*.pro,*.properties,*.url,.coveragerc,.flake8,.pylintrc,buildozer.spec,pylintrc,.editorconfig,.npmrc,php.ini-*',
|
||||
\ 'dosini': '*.wrap,*.ini,*.cnf,*.dof,*.lektorproject,*.prefs,*.pro,*.properties,*.url,.coveragerc,.flake8,.pylintrc,HOSTS,buildozer.spec,hosts,pylintrc,vlcrc,.editorconfig,.npmrc,php.ini-*',
|
||||
\ 'dot': '*.dot,*.gv',
|
||||
\ 'dracula': '*.drac,*.drc,*lvs,*lpe,drac.*',
|
||||
\ 'dsdl': '*.sdl',
|
||||
@@ -153,7 +153,7 @@ let s:globs = {
|
||||
\ 'embeddedpuppet': '*.epp',
|
||||
\ 'ember-script': '*.em,*.emberscript',
|
||||
\ 'emblem': '*.emblem,*.em',
|
||||
\ 'erlang': '*.erl,*.app.src,*.es,*.escript,*.hrl,*.xrl,*.yrl,*.app,*.yaws,Emakefile,rebar.config,rebar.config.lock,rebar.lock',
|
||||
\ 'erlang': '*.erl,*.app,*.app.src,*.es,*.escript,*.hrl,*.xrl,*.yrl,*.yaws,Emakefile,rebar.config,rebar.config.lock,rebar.lock',
|
||||
\ 'eruby': '*.erb,*.erb.deface,*.rhtml',
|
||||
\ 'esmtprc': '*esmtprc',
|
||||
\ 'esqlc': '*.ec,*.EC',
|
||||
@@ -190,7 +190,7 @@ let s:globs = {
|
||||
\ 'gitsendemail': '.gitsendemail.*',
|
||||
\ 'gkrellmrc': 'gkrellmrc,gkrellmrc_?',
|
||||
\ 'gleam': '*.gleam',
|
||||
\ 'glsl': '*.glsl,*.fp,*.frag,*.frg,*.fs,*.fsh,*.fshader,*.geo,*.geom,*.glslf,*.glslv,*.gs,*.gshader,*.rchit,*.rmiss,*.shader,*.tesc,*.tese,*.vert,*.vrx,*.vsh,*.vshader,*.comp',
|
||||
\ 'glsl': '*.glsl,*.fp,*.frag,*.frg,*.fs,*.fsh,*.fshader,*.geo,*.geom,*.glslf,*.glslv,*.gs,*.gshader,*.rchit,*.rmiss,*.shader,*.tesc,*.tese,*.vert,*.vrx,*.vs,*.vsh,*.vshader,*.comp',
|
||||
\ 'gmpl': '*.mod',
|
||||
\ 'gnash': 'gnashrc,.gnashrc,gnashpluginrc,.gnashpluginrc',
|
||||
\ 'gnuplot': '*.gp,*.gnu,*.gnuplot,*.p,*.plot,*.plt,*.gpi',
|
||||
@@ -262,7 +262,7 @@ let s:globs = {
|
||||
\ 'jovial': '*.jov,*.j73,*.jovial',
|
||||
\ 'jproperties': '*.properties,*.properties_??,*.properties_??_??,*.properties_??_??_*',
|
||||
\ 'jq': '*.jq,.jqrc,.jqrc*',
|
||||
\ 'json': '*.json,*.4DForm,*.4DProject,*.avsc,*.geojson,*.gltf,*.har,*.ice,*.JSON-tmLanguage,*.jsonl,*.mcmeta,*.tfstate,*.tfstate.backup,*.topojson,*.webapp,*.webmanifest,*.yy,*.yyp,*.jsonp,*.template,.arcconfig,.auto-changelog,.c8rc,.htmlhintrc,.imgbotconfig,.nycrc,.tern-config,.tern-project,.watchmanconfig,Pipfile.lock,composer.lock,mcmod.info',
|
||||
\ 'json': '*.json,*.4DForm,*.4DProject,*.avsc,*.geojson,*.gltf,*.har,*.ice,*.JSON-tmLanguage,*.jsonl,*.mcmeta,*.sarif,*.tfstate,*.tfstate.backup,*.topojson,*.webapp,*.webmanifest,*.yy,*.yyp,*.jsonp,*.template,.all-contributorsrc,.arcconfig,.auto-changelog,.c8rc,.htmlhintrc,.imgbotconfig,.nycrc,.tern-config,.tern-project,.watchmanconfig,MODULE.bazel.lock,Pipfile.lock,composer.lock,deno.lock,flake.lock,mcmod.info',
|
||||
\ 'json5': '*.json5',
|
||||
\ 'jsonc': '*.cjson,*.jsonc,coc-settings.json,.eslintrc.json,.babelrc,.jshintrc,.jslintrc,.mocharc.json,coffeelint.json,tsconfig.json,jsconfig.json',
|
||||
\ 'jsonnet': '*.jsonnet,*.libsonnet',
|
||||
@@ -393,7 +393,7 @@ let s:globs = {
|
||||
\ 'passwd': '',
|
||||
\ 'pccts': '*.g',
|
||||
\ 'pdf': '*.pdf',
|
||||
\ 'perl': '*.pl,*.al,*.cgi,*.fcgi,*.perl,*.ph,*.plx,*.pm,*.psgi,*.t,Makefile.PL,Rexfile,ack,cpanfile,example.gitolite.rc,.gitolite.rc',
|
||||
\ 'perl': '*.pl,*.al,*.cgi,*.fcgi,*.perl,*.ph,*.plx,*.pm,*.psgi,*.t,.latexmkrc,Makefile.PL,Rexfile,ack,cpanfile,latexmkrc,example.gitolite.rc,.gitolite.rc',
|
||||
\ 'pest': '*.pest',
|
||||
\ 'pf': 'pf.conf',
|
||||
\ 'pfmain': 'main.cf',
|
||||
@@ -415,9 +415,10 @@ let s:globs = {
|
||||
\ 'povini': '.povrayrc',
|
||||
\ 'ppd': '*.ppd',
|
||||
\ 'ppwiz': '*.it,*.ih',
|
||||
\ 'prisma': '*.prisma',
|
||||
\ 'privoxy': '*.action',
|
||||
\ 'procmail': '.procmail,.procmailrc',
|
||||
\ 'prolog': '*.pl,*.pro,*.prolog,*.yap,*.pdb',
|
||||
\ 'prolog': '*.pl,*.plt,*.pro,*.prolog,*.yap,*.pdb',
|
||||
\ 'promela': '*.pml',
|
||||
\ 'proto': '*.proto',
|
||||
\ 'protocols': '',
|
||||
@@ -428,7 +429,7 @@ let s:globs = {
|
||||
\ 'puppet': '*.pp,Modulefile',
|
||||
\ 'purescript': '*.purs',
|
||||
\ 'pyrex': '*.pyx,*.pxd',
|
||||
\ 'python': '*.py,*.cgi,*.fcgi,*.gyp,*.gypi,*.lmi,*.py3,*.pyde,*.pyi,*.pyp,*.pyt,*.pyw,*.rpy,*.smk,*.spec,*.tac,*.wsgi,*.xpy,*.ptl,.gclient,DEPS,SConscript,SConstruct,Snakefile,wscript,.pythonrc,.pythonstartup',
|
||||
\ 'python': '*.py,*.cgi,*.fcgi,*.gyp,*.gypi,*.lmi,*.py3,*.pyde,*.pyi,*.pyp,*.pyt,*.pyw,*.rpy,*.spec,*.tac,*.wsgi,*.xpy,*.ptl,.gclient,DEPS,SConscript,SConstruct,wscript,.pythonrc,.pythonstartup',
|
||||
\ 'qmake': '*.pro,*.pri',
|
||||
\ 'qml': '*.qml,*.qbs',
|
||||
\ 'quake': '',
|
||||
@@ -482,7 +483,7 @@ let s:globs = {
|
||||
\ 'services': '',
|
||||
\ 'setserial': '',
|
||||
\ 'sexplib': '*.sexp',
|
||||
\ 'sh': '*.sh,*.bash,*.bats,*.cgi,*.command,*.env,*.fcgi,*.ksh,*.sh.in,*.tmux,*.tool,*.zsh-theme,.bash_aliases,.bash_history,.bash_logout,.bash_profile,.bashrc,.cshrc,.env,.env.example,.flaskenv,.kshrc,.login,.profile,9fs,PKGBUILD,bash_aliases,bash_logout,bash_profile,bashrc,cshrc,gradlew,kshrc,login,man,profile',
|
||||
\ 'sh': '*.sh,*.bash,*.bats,*.cgi,*.command,*.fcgi,*.ksh,*.sh.in,*.tmux,*.tool,*.trigger,*.zsh-theme,.bash_aliases,.bash_functions,.bash_history,.bash_logout,.bash_profile,.bashrc,.cshrc,.envrc,.flaskenv,.kshrc,.login,.profile,.tmux.conf,9fs,PKGBUILD,bash_aliases,bash_logout,bash_profile,bashrc,cshrc,gradlew,kshrc,login,man,profile,tmux.conf',
|
||||
\ 'sieve': '*.siv,*.sieve',
|
||||
\ 'sil': '*.sil',
|
||||
\ 'simula': '*.sim',
|
||||
@@ -554,7 +555,7 @@ let s:globs = {
|
||||
\ 'tilde': '*.t.html',
|
||||
\ 'tli': '*.tli',
|
||||
\ 'tmux': '.tmux*.conf',
|
||||
\ 'toml': '*.toml,Cargo.lock,Gopkg.lock,Pipfile,poetry.lock',
|
||||
\ 'toml': '*.toml,Cargo.lock,Cargo.toml.orig,Gopkg.lock,Pipfile,pdm.lock,poetry.lock',
|
||||
\ 'tpp': '*.tpp',
|
||||
\ 'tptp': '*.p,*.tptp,*.ax',
|
||||
\ 'trasys': '*.inp',
|
||||
@@ -582,7 +583,7 @@ let s:globs = {
|
||||
\ 'usserverlog': '*.usserver.log\c,usserver.log\c,usserver.*.log\c',
|
||||
\ 'usw2kagtlog': '*.usw2kagt.log\c,usw2kagt.log\c,usw2kagt.*.log\c',
|
||||
\ 'vala': '*.vala,*.vapi,*.valadoc',
|
||||
\ 'vb': '*.bas,*.cls,*.frm,*.frx,*.vba,*.vbs,*.dsm,*.ctl,*.sba',
|
||||
\ 'vb': '*.bas,*.cls,*.frm,*.vba,*.vbs,*.dsm,*.ctl,*.sba',
|
||||
\ 'vbnet': '*.vb,*.vbhtml',
|
||||
\ 'vcl': '*.vcl',
|
||||
\ 'velocity': '*.vm',
|
||||
@@ -613,7 +614,7 @@ let s:globs = {
|
||||
\ 'xhtml': '*.xhtml,*.xht',
|
||||
\ 'xinetd': '',
|
||||
\ 'xmath': '*.msc,*.msf',
|
||||
\ 'xml': '*.xml,*.adml,*.admx,*.ant,*.axaml,*.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,*.hzp,*.iml,*.ivy,*.jelly,*.jsproj,*.kml,*.launch,*.mdpolicy,*.mjml,*.mod,*.mxml,*.natvis,*.ncl,*.ndproj,*.nproj,*.nuspec,*.odd,*.osm,*.pkgproj,*.pluginspec,*.proj,*.props,*.psc1,*.pt,*.qhelp,*.rdf,*.res,*.resx,*.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': '*.xml,*.adml,*.admx,*.ant,*.axaml,*.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,*.hzp,*.iml,*.ivy,*.jelly,*.jsproj,*.kml,*.launch,*.mdpolicy,*.mjml,*.mod,*.mojo,*.mxml,*.natvis,*.ncl,*.ndproj,*.nproj,*.nuspec,*.odd,*.osm,*.pkgproj,*.pluginspec,*.proj,*.props,*.psc1,*.pt,*.qhelp,*.rdf,*.res,*.resx,*.rss,*.sch,*.scxml,*.sfproj,*.shproj,*.srdf,*.storyboard,*.sublime-snippet,*.sw,*.targets,*.tml,*.typ,*.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',
|
||||
@@ -629,7 +630,7 @@ let s:globs = {
|
||||
\ 'yaml.docker-compose': 'docker-compose*.yaml,docker-compose*.yml',
|
||||
\ 'z8a': '*.z8a',
|
||||
\ 'zephir': '*.zep',
|
||||
\ 'zig': '*.zig,*.zir',
|
||||
\ 'zig': '*.zig,*.zig.zon,*.zir',
|
||||
\ 'zimbu': '*.zu',
|
||||
\ 'zir': '*.zir',
|
||||
\ 'zsh': '*.zsh,.zshrc,.zshenv,.zlogin,.zprofile,.zlogout,.zlog*,.zcompdump*,.zfbfmarks,.zsh*',
|
||||
|
||||
@@ -1,536 +0,0 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'pony', 'autoload/pony.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Vim plugin file
|
||||
" Language: Pony
|
||||
" Maintainer: Jak Wings
|
||||
|
||||
" TODO: Make sure echomsg is off for release.
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
|
||||
"let s:skip = '<SID>InCommentOrLiteral(line("."), col("."))'
|
||||
let s:skip2 = '<SID>InLiteral(line("."), col(".")) || <SID>InComment(line("."), col(".")) == 1'
|
||||
let s:skip3 = '!<SID>InKeyword(line("."), col("."))'
|
||||
let s:skip4 = '!<SID>InBracket(line("."), col("."))'
|
||||
let s:cfstart = '\v<%(ifdef|if|match|while|for|repeat|try|with|recover|object|lambda|iftype)>'
|
||||
let s:cfmiddle = '\v<%(then|elseif|else|until|do|in|elseiftype)>|\|'
|
||||
let s:cfend = '\v<end>'
|
||||
let s:bstartp = '\v<%(ifdef|if|then|elseif|else|(match)|while|for|in|do|try|with|recover|repeat|until|(object)|lambda|iftype|elseiftype)>'
|
||||
|
||||
function! pony#Indent()
|
||||
if v:lnum <= 1
|
||||
return 0
|
||||
endif
|
||||
|
||||
call cursor(v:lnum, 1)
|
||||
let l:pnzpos = searchpos('.', 'cbnW')
|
||||
if l:pnzpos == [0, 0]
|
||||
return 0
|
||||
endif
|
||||
|
||||
if s:InComment2(l:pnzpos) > 1
|
||||
"echomsg 'Comment' (l:pnzpos[0] . '-' . v:lnum) -1
|
||||
return cindent(v:lnum)
|
||||
endif
|
||||
|
||||
if s:InLiteral2(l:pnzpos)
|
||||
"echomsg 'String' (l:pnzpos[0] . '-' . v:lnum) -1
|
||||
return -1
|
||||
endif
|
||||
|
||||
unlet! l:pnzpos
|
||||
|
||||
" NOTE: Lines started in comments and strings are checked already.
|
||||
|
||||
let l:pnblnum = s:PrevNonblank(v:lnum - 1)
|
||||
if l:pnblnum < 1
|
||||
return 0
|
||||
endif
|
||||
|
||||
let l:pnbline = getline(l:pnblnum)
|
||||
let l:pnbindent = indent(l:pnblnum)
|
||||
|
||||
let l:line = getline(v:lnum)
|
||||
let l:indent = l:pnbindent
|
||||
let l:shiftwidth = shiftwidth()
|
||||
|
||||
" FIXME?
|
||||
let l:continuing = 0
|
||||
" If the previous line ends with a unary or binary operator,
|
||||
if s:IsContinued(l:pnblnum)
|
||||
let l:contlnum = l:pnblnum
|
||||
let l:ppcontinued = 0
|
||||
let l:ppnblnum = s:PrevNonblank(l:pnblnum - 1)
|
||||
while s:IsContinued(l:ppnblnum)
|
||||
let l:ppcontinued += 1
|
||||
let l:contlnum = l:ppnblnum
|
||||
let l:ppnblnum = s:PrevNonblank(l:ppnblnum - 1)
|
||||
endwhile
|
||||
"echomsg 'Continued1' l:pnblnum l:contlnum
|
||||
" If the previous line is also continuing another line,
|
||||
if l:ppcontinued
|
||||
let l:continuing = 1
|
||||
if getline(l:contlnum) =~# '\v^\s*%(actor|class|struct|primitive|trait|type|interface)>'
|
||||
" reset the indent level.
|
||||
"echomsg 'Continuing0' (l:contlnum . '-' . v:lnum) (l:shiftwidth * 2)
|
||||
let l:indent = l:shiftwidth * 2
|
||||
else
|
||||
" keep using the previous indent.
|
||||
"echomsg 'Continuing1' (l:pnblnum . '-' . v:lnum) l:pnbindent
|
||||
let l:indent = l:pnbindent
|
||||
endif
|
||||
" if the previous line is part of the definition of a class,
|
||||
elseif l:pnbline =~# '\v^\s*%(actor|class|struct|primitive|trait|type|interface)>'
|
||||
" reset the indent level.
|
||||
"echomsg 'Continuing2' (l:pnblnum . '-' . v:lnum) (l:shiftwidth * 2)
|
||||
let l:continuing = 1
|
||||
let l:indent = l:shiftwidth * 2
|
||||
" if the previous line is part of the definition of a method,
|
||||
elseif l:pnbline =~# '\v^\s*%(fun|new|be)>'
|
||||
" reset the indent level.
|
||||
"echomsg 'Continuing3' (l:pnblnum . '-' . v:lnum) (l:pnbindent + l:shiftwidth)
|
||||
let l:continuing = 1
|
||||
let l:indent = l:pnbindent + l:shiftwidth
|
||||
" if the previous line is the start of a definition body,
|
||||
elseif l:pnbline =~# '=>\s*$'
|
||||
" indent this line.
|
||||
"echomsg 'Continuing4' (l:pnblnum . '-' . v:lnum) (l:pnbindent + l:shiftwidth)
|
||||
let l:continuing = 1
|
||||
let l:indent = l:pnbindent + l:shiftwidth
|
||||
else
|
||||
" indent this line twice as far.
|
||||
"echomsg 'Continuing5' (l:pnblnum . '-' . v:lnum) (l:pnbindent + l:shiftwidth * 2)
|
||||
let l:continuing = 1
|
||||
let l:indent = l:pnbindent + l:shiftwidth * 2
|
||||
endif
|
||||
|
||||
unlet! l:contlnum l:ppnblnum l:ppcontinued
|
||||
endif
|
||||
|
||||
" If this line starts a document string,
|
||||
if !l:continuing && l:line =~# '^\s*"""'
|
||||
let l:ppnblnum = s:PrevNonblank(l:pnblnum - 1)
|
||||
if s:IsContinued(l:ppnblnum)
|
||||
let l:contlnum = l:ppnblnum
|
||||
while s:IsContinued(l:ppnblnum)
|
||||
let l:contlnum = l:ppnblnum
|
||||
let l:ppnblnum = s:PrevNonblank(l:ppnblnum - 1)
|
||||
endwhile
|
||||
if getline(l:contlnum) =~# '\v^\s*%(actor|class|struct|primitive|trait|type|interface)>'
|
||||
" reset the indent level.
|
||||
"echomsg 'DocString' (l:contlnum . '-' . v:lnum) l:shiftwidth
|
||||
return l:shiftwidth
|
||||
endif
|
||||
endif
|
||||
|
||||
unlet! l:contlnum l:ppnblnum
|
||||
endif
|
||||
|
||||
" If the previous line contains an unmatched opening bracket
|
||||
if !l:continuing && l:pnbline =~# '[{[(]'
|
||||
" if the line ends with an opening bracket,
|
||||
if l:pnbline =~# '[{[(]\s*$' && !s:InCommentOrLiteral(l:pnblnum, col([l:pnblnum, '$']) - 1)
|
||||
" indent this line.
|
||||
let l:indent += l:shiftwidth
|
||||
else
|
||||
" find the unmatched opening bracket,
|
||||
let l:start = [0, 0]
|
||||
let l:end = col([l:pnblnum, '$']) - 1
|
||||
call cursor(l:pnblnum, l:end)
|
||||
while l:end > 0
|
||||
let l:start = s:OuterPos(l:start, searchpairpos('(', '', ')', 'bnW', s:skip4, l:pnblnum))
|
||||
let l:start = s:OuterPos(l:start, searchpairpos('\[', '', '\]', 'bnW', s:skip4, l:pnblnum))
|
||||
let l:start = s:OuterPos(l:start, searchpairpos('{', '', '}', 'bnW', s:skip4, l:pnblnum))
|
||||
if l:start == [0, 0]
|
||||
break
|
||||
endif
|
||||
" find the matched closing bracket on the same line,
|
||||
call cursor(l:start[0], l:start[1])
|
||||
let l:c = s:CharAtCursor(l:start[0], l:start[1])
|
||||
if searchpair(escape(l:c, '['), '', escape(tr(l:c, '([{', ')]}'), ']'),
|
||||
\ 'znW', s:skip4, l:pnblnum) < 1
|
||||
" the unmatched opening bracket is found,
|
||||
break
|
||||
endif
|
||||
let l:end = l:start[1]
|
||||
let l:start = [0, 0]
|
||||
endwhile
|
||||
if l:start != [0, 0]
|
||||
" indent this line.
|
||||
"echomsg 'Open bracket' (l:pnblnum . '-' . v:lnum) (l:indent + l:shiftwidth)
|
||||
let l:indent += l:shiftwidth
|
||||
endif
|
||||
endif
|
||||
|
||||
unlet! l:start l:end l:c
|
||||
endif
|
||||
|
||||
" If there is a matched closing bracket on the previous line,
|
||||
" NOTE:
|
||||
" >|[
|
||||
" | (1 -
|
||||
" | 1) * 2]
|
||||
" | command
|
||||
" ^
|
||||
if !l:continuing
|
||||
call cursor(l:pnblnum, 1)
|
||||
" find the last closing bracket,
|
||||
let l:end = [0, 0]
|
||||
let l:end = s:OuterPos(l:end, searchpairpos('(', '', ')', 'zncr', s:skip4, l:pnblnum))
|
||||
let l:end = s:OuterPos(l:end, searchpairpos('\[', '', '\]', 'zncr', s:skip4, l:pnblnum))
|
||||
let l:end = s:OuterPos(l:end, searchpairpos('{', '', '}', 'zncr', s:skip4, l:pnblnum))
|
||||
if l:end != [0, 0]
|
||||
" find the matched opening bracket on another line,
|
||||
let l:c = s:CharAtCursor(l:end[0], l:end[1])
|
||||
let l:start = searchpairpos(escape(tr(l:c, ')]}', '([{'), '['), '', escape(l:c, ']'), 'nbW', s:skip4)
|
||||
if l:start[0] != l:end[0]
|
||||
" and then this line has the same indent as the line the matched bracket stays.
|
||||
"echomsg 'Matched bracket' (l:start[0] . '-' . v:lnum) indent(l:start[0])
|
||||
let l:indent = indent(l:start[0])
|
||||
endif
|
||||
endif
|
||||
|
||||
unlet! l:start l:end l:c
|
||||
endif
|
||||
|
||||
" If there is a matched closing bracket on this line,
|
||||
" NOTE:
|
||||
" |[
|
||||
" >| (1 -
|
||||
" | 1) * 2
|
||||
" |]
|
||||
" ^ ^
|
||||
if l:line =~# '^\s*[)\]}]'
|
||||
" find the first closing bracket,
|
||||
call cursor(v:lnum, 1)
|
||||
let l:end = [0, 0]
|
||||
let l:end = s:InnerPos(l:end, searchpairpos('(', '', ')', 'zncW', s:skip4, v:lnum))
|
||||
let l:end = s:InnerPos(l:end, searchpairpos('\[', '', '\]', 'zncW', s:skip4, v:lnum))
|
||||
let l:end = s:InnerPos(l:end, searchpairpos('{', '', '}', 'zncW', s:skip4, v:lnum))
|
||||
if l:end != [0, 0]
|
||||
" find the matched opening bracket on another line,
|
||||
let l:c = s:CharAtCursor(l:end[0], l:end[1])
|
||||
let l:start = searchpairpos(escape(tr(l:c, ')]}', '([{'), '['), '', escape(l:c, ']'), 'nbW', s:skip4)
|
||||
if l:start[0] != l:end[0]
|
||||
" and then this line has the same indent as the line the matched bracket stays.
|
||||
"echomsg 'Closing Bracket' (l:start[0] . '-' . v:lnum) indent(l:start[0])
|
||||
let l:indent = indent(l:start[0])
|
||||
endif
|
||||
endif
|
||||
|
||||
unlet! l:start l:end l:c
|
||||
endif
|
||||
|
||||
" If this line starts the definition of a method, closure or match case,
|
||||
if l:line =~# '^\s*=>'
|
||||
" find the start of the definition,
|
||||
call cursor(v:lnum, 1)
|
||||
let l:start = searchpairpos('\v<%(new|be|fun|lambda)>|\|', '', '=>\zs', 'bnW', s:skip3)
|
||||
if l:start != [0, 0]
|
||||
" then this line has the same indent as the start.
|
||||
"echomsg 'Method body' (l:start[0] . '-' . v:lnum) indent(l:start[0])
|
||||
return indent(l:start[0])
|
||||
endif
|
||||
|
||||
unlet! l:start
|
||||
endif
|
||||
|
||||
" If this line starts a class definition or starts an alias,
|
||||
if l:line =~# '\v^\s*%(actor|class|struct|primitive|trait|interface|use|type)>'
|
||||
" reset the indent level.
|
||||
return 0
|
||||
endif
|
||||
|
||||
" If this line starts a method definition,
|
||||
if l:line =~# '\v^\s*%(new|be|fun)>'
|
||||
call cursor(v:lnum, 1)
|
||||
let l:start = searchpairpos(s:cfstart, s:cfmiddle, s:cfend, 'bW', s:skip3)
|
||||
if l:start != [0, 0]
|
||||
let l:start = searchpos(s:bstartp, 'zcnpW', l:start[0])
|
||||
" see if it is in an object block,
|
||||
if l:start[2] == 3
|
||||
"echomsg 'Method in object' (l:start[0] . '-' . v:lnum) (l:shiftwidth + indent(l:start[0]))
|
||||
return l:shiftwidth + indent(l:start[0])
|
||||
endif
|
||||
endif
|
||||
return l:shiftwidth
|
||||
endif
|
||||
|
||||
" If this line starts a match case,
|
||||
call cursor(v:lnum, 1)
|
||||
if l:line =~# '^\s*|' && s:InKeyword(searchpos('|', 'znW', v:lnum))
|
||||
" find the start or the previous case of the match block,
|
||||
let l:start = searchpairpos(s:cfstart, s:cfmiddle, s:cfend, 'bnW', s:skip3)
|
||||
if l:start != [0, 0]
|
||||
" then this line has the same indent as the start.
|
||||
"echomsg 'Match case' (l:start[0] . '-' . v:lnum) indent(l:start[0])
|
||||
return indent(l:start[0])
|
||||
endif
|
||||
|
||||
unlet! l:start
|
||||
endif
|
||||
|
||||
" If this line ends (part of) a control flow,
|
||||
if l:line =~# '\v^\s*%(end|elseif|else|then|in|do|until|elseiftype)>'
|
||||
" find the start or middle of the control block,
|
||||
call cursor(v:lnum, 1)
|
||||
let l:start = searchpairpos(s:cfstart, s:cfmiddle, s:cfend, 'bnW', s:skip3)
|
||||
if l:start != [0, 0]
|
||||
" then this line has the same indent as the start.
|
||||
"echomsg 'Block end' (l:start[0] . '-' . v:lnum) indent(l:start[0])
|
||||
return indent(l:start[0])
|
||||
endif
|
||||
|
||||
unlet! l:start
|
||||
endif
|
||||
|
||||
" If the previous line starts a class definition,
|
||||
if l:pnbline =~# '\v^\s*%(actor|class|struct|primitive|trait|type|interface)>'
|
||||
" reset the indent level.
|
||||
if s:IsContinued(l:pnblnum)
|
||||
return l:shiftwidth * 2
|
||||
else
|
||||
return l:shiftwidth
|
||||
endif
|
||||
endif
|
||||
|
||||
" If the previous line starts a method definition,
|
||||
if l:pnbline =~# '\v^\s*%(new|be|fun)>'
|
||||
return l:pnbindent + l:shiftwidth
|
||||
endif
|
||||
|
||||
" If the previous line starts (part of) a control flow,
|
||||
call cursor(l:pnblnum, 1)
|
||||
while 1
|
||||
" find the start of the control block,
|
||||
let l:start = searchpos(s:bstartp, 'zcepW', l:pnblnum)
|
||||
if l:start[2] == 0
|
||||
break
|
||||
endif
|
||||
if !s:InKeyword(l:start[0:1])
|
||||
call cursor(l:pnblnum, l:start[1] + 3)
|
||||
continue
|
||||
endif
|
||||
let l:index = l:start[2]
|
||||
" find the end of the control block on the same line,
|
||||
let l:end = searchpair(s:cfstart, '', s:cfend, 'znW', s:skip3, l:pnblnum)
|
||||
" if the control block is not ended,
|
||||
if l:end < 1
|
||||
" if this line is a case for a match,
|
||||
if l:index == 2 && l:line =~# '^\s*|'
|
||||
" then this line has the same indent as the start of the match block.
|
||||
return l:pnbindent
|
||||
else
|
||||
" then indent this line.
|
||||
"echomsg 'Block start' (l:pnblnum . '-' . v:lnum) (l:pnbindent + l:shiftwidth)
|
||||
return l:pnbindent + l:shiftwidth
|
||||
endif
|
||||
endif
|
||||
endwhile
|
||||
|
||||
unlet! l:start l:end l:index
|
||||
|
||||
return l:indent
|
||||
endfunction
|
||||
|
||||
function! s:PrevNonblank(lnum)
|
||||
let l:lnum = prevnonblank(a:lnum)
|
||||
while l:lnum > 0 && (s:InComment2(l:lnum, 1) || s:InLiteral2(l:lnum, 1))
|
||||
let l:lnum = prevnonblank(l:lnum - 1)
|
||||
endwhile
|
||||
return l:lnum
|
||||
endfunction
|
||||
|
||||
" NOTE:
|
||||
" v
|
||||
" |1 /* comment */
|
||||
" |2
|
||||
function! s:IsContinued(lnum)
|
||||
let l:lnum = s:PrevNonblank(a:lnum)
|
||||
if l:lnum < 1
|
||||
return 0
|
||||
endif
|
||||
let l:line = getline(l:lnum)
|
||||
let l:width = strwidth(substitute(l:line, '\s*$', '', ''))
|
||||
" FIXME?
|
||||
" | 1 + //
|
||||
" | //
|
||||
" | 2
|
||||
return !s:InCommentOrLiteral(a:lnum, l:width)
|
||||
\ && (l:line =~# '\v<%(and|or|xor|is|isnt|as|not|consume|addressof|digestof)\s*$'
|
||||
\ || l:line =~# '\v%([=\-.]\>|[<!=>]\=\~?|\<\<\~?|\>\>\~?|\<:|[+\-*/%<>]\~?|[.,|:@~])\s*$'
|
||||
\ )
|
||||
endfunction
|
||||
|
||||
function! s:InCommentOrLiteral(...)
|
||||
return call('s:InComment', a:000) || call('s:InLiteral', a:000)
|
||||
endfunction
|
||||
|
||||
function! s:InKeyword(...)
|
||||
let [l:lnum, l:col] = (type(a:1) == type([]) ? a:1 : a:000)
|
||||
for id in s:Or(synstack(l:lnum, l:col), [])
|
||||
if synIDattr(id, 'name') =~# '^ponyKw'
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function! s:InBracket(...)
|
||||
let [l:lnum, l:col] = (type(a:1) == type([]) ? a:1 : a:000)
|
||||
for id in s:Or(synstack(l:lnum, l:col), [])
|
||||
if synIDattr(id, 'name') ==# 'ponyBracket'
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function! s:InComment(...)
|
||||
let [l:lnum, l:col] = (type(a:1) == type([]) ? a:1 : a:000)
|
||||
let l:stack = synstack(l:lnum, l:col)
|
||||
let l:i = len(l:stack)
|
||||
while l:i > 0
|
||||
let l:sname = synIDattr(l:stack[l:i - 1], 'name')
|
||||
if l:sname =~# '^ponyNestedCommentX\?$'
|
||||
return 1 + l:i - (l:sname =~# 'X$')
|
||||
elseif l:sname =~# '^ponyCommentX\?$'
|
||||
return 1
|
||||
endif
|
||||
let l:i -= 1
|
||||
endwhile
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function! s:InLiteral(...)
|
||||
let [l:lnum, l:col] = (type(a:1) == type([]) ? a:1 : a:000)
|
||||
let l:stack = synstack(l:lnum, l:col)
|
||||
let l:i = len(l:stack)
|
||||
while l:i > 0
|
||||
let l:sname = synIDattr(l:stack[l:i - 1], 'name')
|
||||
if l:sname =~# '^ponyDocumentStringX\?$'
|
||||
return 3
|
||||
elseif l:sname =~# '^ponyStringX\?$'
|
||||
return 2
|
||||
elseif l:sname =~# '^ponyCharacterX\?$'
|
||||
return 1
|
||||
endif
|
||||
let l:i -= 1
|
||||
endwhile
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
" NOTE:
|
||||
" |// //inside
|
||||
" ^^^^^^^^^^
|
||||
" |/* /*inside*/ */
|
||||
" ^^^^^^^^^^^^^^
|
||||
function! s:InComment2(...)
|
||||
let [l:lnum, l:col] = (type(a:1) == type([]) ? a:1 : a:000)
|
||||
let l:stack = synstack(l:lnum, l:col)
|
||||
let l:i = len(l:stack)
|
||||
while l:i > 0
|
||||
let l:sname = synIDattr(l:stack[l:i - 1], 'name')
|
||||
if l:sname ==# 'ponyNestedComment'
|
||||
return 1 + l:i
|
||||
elseif l:sname ==# 'ponyComment'
|
||||
return 1
|
||||
elseif l:sname =~# '\v^pony%(Nested)?CommentX$'
|
||||
return 0
|
||||
endif
|
||||
let l:i -= 1
|
||||
endwhile
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
" NOTE:
|
||||
" |"inside"
|
||||
" ^^^^^^
|
||||
" |"""inside"""""
|
||||
" ^^^^^^^^^^^^
|
||||
function! s:InLiteral2(...)
|
||||
let [l:lnum, l:col] = (type(a:1) == type([]) ? a:1 : a:000)
|
||||
let l:stack = synstack(l:lnum, l:col)
|
||||
let l:i = len(l:stack)
|
||||
while l:i > 0
|
||||
let l:sname = synIDattr(l:stack[l:i - 1], 'name')
|
||||
if l:sname ==# 'ponyDocumentString'
|
||||
return 3
|
||||
elseif l:sname ==# 'ponyString'
|
||||
return 2
|
||||
elseif l:sname ==# 'ponyCharacter'
|
||||
return 1
|
||||
elseif l:sname =~# '\v^pony%(DocumentString|String|Character)X$'
|
||||
return 0
|
||||
endif
|
||||
let l:i -= 1
|
||||
endwhile
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
function! s:CharAtCursor(...)
|
||||
let [l:lnum, l:col] = (type(a:1) == type([]) ? a:1 : a:000)
|
||||
return matchstr(getline(l:lnum), '\%' . l:col . 'c.')
|
||||
endfunction
|
||||
|
||||
function! s:Or(x, y)
|
||||
return !empty(a:x) ? a:x : a:y
|
||||
endfunction
|
||||
|
||||
function! s:InnerPos(x, y)
|
||||
if a:x == [0, 0]
|
||||
return a:y
|
||||
elseif a:y == [0, 0]
|
||||
return a:x
|
||||
else
|
||||
return a:x[1] < a:y[1] ? a:x : a:y
|
||||
end
|
||||
endfunction
|
||||
|
||||
function! s:OuterPos(x, y)
|
||||
if a:x == [0, 0]
|
||||
return a:y
|
||||
elseif a:y == [0, 0]
|
||||
return a:x
|
||||
else
|
||||
return a:x[1] > a:y[1] ? a:x : a:y
|
||||
end
|
||||
endfunction
|
||||
|
||||
function! pony#ClearTrailingSpace(all, alt, ...)
|
||||
let l:force = (a:0 > 0 ? a:1 : 0)
|
||||
if !l:force && (&readonly || !&modifiable || !&modified)
|
||||
return
|
||||
endif
|
||||
if a:all
|
||||
for lnum in range(1, line('$'))
|
||||
let l:line = getline(lnum)
|
||||
let l:end = col([lnum, '$']) - 1
|
||||
if l:end > 0 && l:line =~# '\s$' && !s:InLiteral(lnum, l:end)
|
||||
if a:alt
|
||||
call setline(lnum, substitute(l:line, '\S\@<=\s\s*$', '', ''))
|
||||
else
|
||||
call setline(lnum, substitute(l:line, '\s\+$', '', ''))
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
else
|
||||
let l:lnum = line('.')
|
||||
let l:end = col('$') - 1
|
||||
let l:line = getline(l:lnum)
|
||||
if l:line =~# '\s$' && !s:InLiteral(l:lnum, l:end)
|
||||
if a:alt
|
||||
call setline(l:lnum, substitute(l:line, '\s\+$', '', ''))
|
||||
else
|
||||
call setline(l:lnum, substitute(l:line, '\S\@<=\s\s*$', '', ''))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
@@ -3,46 +3,31 @@ if polyglot#init#is_disabled(expand('<sfile>:p'), 'requirements', 'autoload/requ
|
||||
endif
|
||||
|
||||
""
|
||||
" @section Introduction, intro
|
||||
" @library
|
||||
" <doc/@plugin(name).txt> is generated by <https://github.com/google/vimdoc>.
|
||||
" See <README.md> for more information about installation and screenshots.
|
||||
" Refer https://github.com/vim/vim/blob/75e27d78f5370e7d2e0898326d9b080937e7b090/runtime/scripts.vim#L33-L71
|
||||
"
|
||||
" When a file's shebang is "pip install -r" or "pip-compile",
|
||||
" set its filetype to |requirements|.
|
||||
function! requirements#shebang() abort
|
||||
let s:line1 = getline(1)
|
||||
|
||||
""
|
||||
" Update cache.
|
||||
function! requirements#update_cache() abort
|
||||
let s:items = []
|
||||
let l:pip_items = split(system('COMP_WORDS="pip install -" COMP_CWORD=2 PIP_AUTO_COMPLETE=1 pip'))
|
||||
let l:pypi_items = split(system('pip-cache pkgnames'))
|
||||
for l:item in l:pip_items
|
||||
let s:items += [{'word': l:item, 'menu': 'pip'}]
|
||||
endfor
|
||||
for l:item in l:pypi_items
|
||||
let s:items += [{'word': l:item, 'menu': 'pypi'}]
|
||||
endfor
|
||||
call writefile([json_encode(s:items)], s:cache)
|
||||
if s:line1 =~# "^#!"
|
||||
if s:line1 =~# '^#!\s*\S*\<env\s'
|
||||
let s:line1 = substitute(s:line1, '\S\+=\S\+', '', 'g')
|
||||
let s:line1 = substitute(s:line1, '\(-[iS]\|--ignore-environment\|--split-string\)', '', '')
|
||||
let s:line1 = substitute(s:line1, '\<env\s\+', '', '')
|
||||
endif
|
||||
if s:line1 =~# '^#!\s*\a:[/\\]'
|
||||
let s:name = substitute(s:line1, '^#!.*[/\\]\(\i\+\).*', '\1', '')
|
||||
elseif s:line1 =~# '^#!.*\<env\>'
|
||||
let s:name = substitute(s:line1, '^#!.*\<env\>\s\+\(\i\+\).*', '\1', '')
|
||||
elseif s:line1 =~# '^#!\s*[^/\\ ]*\>\([^/\\]\|$\)'
|
||||
let s:name = substitute(s:line1, '^#!\s*\([^/\\ ]*\>\).*', '\1', '')
|
||||
else
|
||||
let s:name = substitute(s:line1, '^#!\s*\S*[/\\]\(\i\+\).*', '\1', '')
|
||||
endif
|
||||
if s:name =~# '^pip'
|
||||
set ft=requirements
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
if exists('*stdpath')
|
||||
let s:cache_dir_home = stdpath('cache')
|
||||
else
|
||||
let s:cache_dir_home = $HOME . '/.cache/nvim'
|
||||
endif
|
||||
let s:cache_dir = s:cache_dir_home . '/requirements.vim'
|
||||
call mkdir(s:cache_dir, 'p')
|
||||
""
|
||||
" Completion cache path.
|
||||
call g:requirements#utils#plugin.Flag('g:requirements#cache',
|
||||
\ s:cache_dir . '/requirements.json'
|
||||
\ )
|
||||
let s:cache = g:requirements#cache
|
||||
try
|
||||
let s:items = json_decode(readfile(s:cache)[0])
|
||||
catch /\v^Vim%(\(\a+\))?:E(684|484|491):/
|
||||
call requirements#update_cache()
|
||||
let s:items = json_decode(readfile(s:cache)[0])
|
||||
endtry
|
||||
""
|
||||
" Completion cache contents. For program.
|
||||
call g:requirements#utils#plugin.Flag('g:requirements#items', s:items)
|
||||
" vim: et sw=4 ts=4 sts=4:
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'requirements', 'autoload/requirements/utils.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
""
|
||||
" @section Configuration, config
|
||||
|
||||
function! s:Flag(name, default) abort
|
||||
let l:scope = get(split(a:name, ':'), 0, 'g:')
|
||||
let l:name = get(split(a:name, ':'), -1)
|
||||
let {l:scope}:{l:name} = get({l:scope}:, l:name, a:default)
|
||||
endfunction
|
||||
|
||||
let g:requirements#utils#plugin = {'Flag': funcref('s:Flag')}
|
||||
" vim: et sw=4 ts=4 sts=4:
|
||||
@@ -6,7 +6,6 @@ endif
|
||||
" Language: Ruby
|
||||
" Maintainer: Mark Guzman <segfault@hasno.info>
|
||||
" URL: https://github.com/vim-ruby/vim-ruby
|
||||
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
|
||||
" ----------------------------------------------------------------------------
|
||||
"
|
||||
" Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com)
|
||||
@@ -493,7 +492,7 @@ class VimRubyCompletion
|
||||
trail = "%s%s" % [ dir, sub ]
|
||||
tcfg = "%sconfig" % trail
|
||||
|
||||
if File.exists?( tcfg )
|
||||
if File.exist?( tcfg )
|
||||
rails_base = trail
|
||||
break
|
||||
end
|
||||
@@ -506,7 +505,7 @@ class VimRubyCompletion
|
||||
|
||||
bootfile = rails_base + "config/boot.rb"
|
||||
envfile = rails_base + "config/environment.rb"
|
||||
if File.exists?( bootfile ) && File.exists?( envfile )
|
||||
if File.exist?( bootfile ) && File.exist?( envfile )
|
||||
begin
|
||||
require bootfile
|
||||
require envfile
|
||||
|
||||
@@ -3,14 +3,17 @@ if polyglot#init#is_disabled(expand('<sfile>:p'), 'smt2', 'autoload/smt2/formatt
|
||||
endif
|
||||
|
||||
" Formatting requires a rather recent Vim version
|
||||
if !((v:version > 802) || (v:version == 802 && has("patch2725")))
|
||||
if (v:version < 802) || (v:version == 802 && !has("patch2725"))
|
||||
const s:errmsg_oldvim = "Vim >= 8.2.2725 required for auto-formatting"
|
||||
|
||||
"Dummies
|
||||
function! smt2#formatter#FormatCurrentParagraph()
|
||||
echoerr s:errmsg_oldvim
|
||||
endfunction
|
||||
function! smt2#formatter#FormatAllParagraphs()
|
||||
function! smt2#formatter#FormatOutermostSExpr()
|
||||
echoerr s:errmsg_oldvim
|
||||
endfunction
|
||||
function! smt2#formatter#FormatFile()
|
||||
echoerr s:errmsg_oldvim
|
||||
endfunction
|
||||
|
||||
@@ -88,55 +91,75 @@ def Format(ast: dict<any>, indent = 0): string
|
||||
call formatted->add(child->Format())
|
||||
endfor
|
||||
return formatted->join("\n")
|
||||
elseif ast.kind ==# 'File'
|
||||
var formatted = []
|
||||
for child in ast.value
|
||||
call formatted->add(child->Format())
|
||||
endfor
|
||||
return formatted->join("\n\n")
|
||||
endif
|
||||
throw 'Cannot format AST node: ' .. string(ast)
|
||||
return '' # Unreachable
|
||||
enddef
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Auxiliary
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
def FormatInCurrentBuffer(ast: dict<any>)
|
||||
const cursor = getpos('.')
|
||||
|
||||
# Format lines and potential surrounding text on them
|
||||
const formatted_lines = split(Format(ast), '\n')
|
||||
const ast_coords = ast.CalcCoords()
|
||||
const ws_mask = " \n\r\t"
|
||||
const first_line_part_to_keep = getline(ast_coords[0].line)
|
||||
->strcharpart(0, ast_coords[0].col - 2)
|
||||
->trim(ws_mask, 2)
|
||||
const last_line_part_to_keep = getline(ast_coords[1].line)
|
||||
->strcharpart(ast_coords[1].col - 1)
|
||||
->trim(ws_mask, 1)
|
||||
|
||||
# If section of AST has trailing whitespace until the file end, remove it
|
||||
cursor(ast_coords[1].line, ast_coords[1].col)
|
||||
if search('\m\C\S', 'W') == 0
|
||||
deletebufline('%', ast_coords[1].line + 1, line('$'))
|
||||
endif
|
||||
|
||||
# Replace section of AST by formatted lines (w/o killing surrounding text)
|
||||
deletebufline('%', ast_coords[0].line, ast_coords[1].line)
|
||||
if !empty(last_line_part_to_keep)
|
||||
last_line_part_to_keep->append(ast_coords[0].line - 1)
|
||||
endif
|
||||
formatted_lines->append(ast_coords[0].line - 1)
|
||||
if !empty(first_line_part_to_keep)
|
||||
first_line_part_to_keep->append(ast_coords[0].line - 1)
|
||||
endif
|
||||
|
||||
# If section of AST has leading whitespace until the file start, remove it
|
||||
cursor(ast_coords[0].line, ast_coords[0].col)
|
||||
if search('\m\C\S', 'bW') == 0
|
||||
deletebufline('%', 1, ast_coords[0].line - 1)
|
||||
endif
|
||||
|
||||
# Restore cursor position
|
||||
call setpos('.', cursor)
|
||||
enddef
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Public functions
|
||||
# ------------------------------------------------------------------------------
|
||||
def smt2#formatter#FormatCurrentParagraph()
|
||||
const cursor = getpos('.')
|
||||
const ast = smt2#parser#ParseCurrentParagraph()
|
||||
|
||||
# Identify on which end of the buffer we are (to fix newlines later)
|
||||
silent! normal! {
|
||||
const is_first_paragraph = line('.') == 1
|
||||
silent! normal! }
|
||||
const is_last_paragraph = line('.') == line('$')
|
||||
|
||||
# Replace paragraph by formatted lines
|
||||
const lines = split(Format(ast), '\n')
|
||||
silent! normal! {d}
|
||||
if is_last_paragraph && !is_first_paragraph
|
||||
call append('.', [''] + lines)
|
||||
else
|
||||
call append('.', lines + [''])
|
||||
endif
|
||||
|
||||
# Remove potentially introduced first empty line
|
||||
if is_first_paragraph | silent! :1delete | endif
|
||||
|
||||
# Restore cursor position
|
||||
call setpos('.', cursor)
|
||||
FormatInCurrentBuffer(ast)
|
||||
enddef
|
||||
|
||||
def smt2#formatter#FormatAllParagraphs()
|
||||
const cursor = getpos('.')
|
||||
const asts = smt2#parser#ParseAllParagraphs()
|
||||
|
||||
# Clear buffer & insert formatted paragraphs
|
||||
silent! :1,$delete
|
||||
for ast in asts
|
||||
const lines = split(Format(ast), '\n') + ['']
|
||||
call append('$', lines)
|
||||
endfor
|
||||
|
||||
# Remove first & trailing empty lines
|
||||
silent! :1delete
|
||||
silent! :$delete
|
||||
|
||||
# Restore cursor position
|
||||
call setpos('.', cursor)
|
||||
def smt2#formatter#FormatOutermostSExpr()
|
||||
const ast = smt2#parser#ParseOutermostSExpr()
|
||||
FormatInCurrentBuffer(ast)
|
||||
enddef
|
||||
|
||||
def smt2#formatter#FormatFile()
|
||||
const ast = smt2#parser#ParseFile()
|
||||
FormatInCurrentBuffer(ast)
|
||||
enddef
|
||||
|
||||
@@ -11,17 +11,37 @@ set maxfuncdepth=100000000 # SMT files tend to be highly nested
|
||||
# TODO: Change Ast.kind type from string to enum/number?
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# AST nodes -- essentially named token wrappers
|
||||
# AST nodes
|
||||
#
|
||||
# Note: pos_from, pos_to and contains_comment were only introduced to allow for
|
||||
# a fast FitsOneLine(ast) function in the formatter.
|
||||
# Here, pos_from and pos_to refer to indices of characters -- not tokens
|
||||
# Note: pos_from, pos_to and contains_comment allow for a fast FitsOneLine(ast)
|
||||
# function in the formatter.
|
||||
# Here, pos_from and pos_to refer to indices of characters -- not tokens.
|
||||
# ------------------------------------------------------------------------------
|
||||
def Ast(kind: string, value: any, pos_from: number, pos_to: number, contains_comment: bool): dict<any>
|
||||
return {kind: kind, value: value, pos_from: pos_from, pos_to: pos_to, contains_comment: contains_comment}
|
||||
def Ast(kind: string, value: any, pos_from: number, pos_to: number, contains_comment: bool, scanner: dict<any>): dict<any>
|
||||
# User-facing functionality wants start/end line and column -- not positions
|
||||
def CalcCoords(): list<dict<number>>
|
||||
const from = scanner.calcCoord(pos_from)
|
||||
# If expression ends at end of line, pos_to will be in next line.
|
||||
# That's undesired. Stay in the actual last line.
|
||||
var to = scanner.calcCoord(pos_to - 1)
|
||||
to.col += 1
|
||||
return [from, to]
|
||||
enddef
|
||||
return {kind: kind, value: value, pos_from: pos_from, pos_to: pos_to, contains_comment: contains_comment, CalcCoords: CalcCoords}
|
||||
enddef
|
||||
|
||||
def ParagraphAst(exprs: list<dict<any>>, pos_from: number, pos_to: number): dict<any>
|
||||
def FileAst(paragraphs: list<dict<any>>, pos_from: number, pos_to: number, scanner: dict<any>): dict<any>
|
||||
var contains_comment = false
|
||||
for paragraph in paragraphs
|
||||
if paragraph.contains_comment
|
||||
contains_comment = true
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
return Ast('File', paragraphs, pos_from, pos_to, contains_comment, scanner)
|
||||
enddef
|
||||
|
||||
def ParagraphAst(exprs: list<dict<any>>, pos_from: number, pos_to: number, scanner: dict<any>): dict<any>
|
||||
var contains_comment = false
|
||||
for expr in exprs
|
||||
if expr.contains_comment
|
||||
@@ -29,10 +49,10 @@ def ParagraphAst(exprs: list<dict<any>>, pos_from: number, pos_to: number): dict
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
return Ast('Paragraph', exprs, pos_from, pos_to, contains_comment)
|
||||
return Ast('Paragraph', exprs, pos_from, pos_to, contains_comment, scanner)
|
||||
enddef
|
||||
|
||||
def SExprAst(exprs: list<dict<any>>, pos_from: number, pos_to: number): dict<any>
|
||||
def SExprAst(exprs: list<dict<any>>, pos_from: number, pos_to: number, scanner: dict<any>): dict<any>
|
||||
var contains_comment = false
|
||||
for expr in exprs
|
||||
if expr.contains_comment
|
||||
@@ -40,15 +60,22 @@ def SExprAst(exprs: list<dict<any>>, pos_from: number, pos_to: number): dict<any
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
return Ast('SExpr', exprs, pos_from, pos_to, contains_comment)
|
||||
return Ast('SExpr', exprs, pos_from, pos_to, contains_comment, scanner)
|
||||
enddef
|
||||
|
||||
def AtomAst(token: dict<any>): dict<any>
|
||||
return Ast('Atom', token, token.pos, token.pos + len(token.lexeme), token.kind == 8)
|
||||
def AtomAst(token: dict<any>, scanner: dict<any>): dict<any>
|
||||
return Ast('Atom', token, token.pos, token.pos + len(token.lexeme), token.kind == 8, scanner)
|
||||
enddef
|
||||
|
||||
def PrintAst(ast: dict<any>, indent = 0)
|
||||
echo repeat(' ', indent * 2) .. '[' .. ast.kind .. '] '
|
||||
const coords = ast.CalcCoords()
|
||||
|
||||
echo printf("[%5d-%-5d) [%4d:%-3d-%4d:%-3d) %s[%s] ",
|
||||
ast.pos_from, ast.pos_to,
|
||||
coords[0].line, coords[0].col,
|
||||
coords[1].line, coords[1].col,
|
||||
repeat(' ', indent * 2),
|
||||
ast.kind)
|
||||
|
||||
if ast.kind ==# 'Atom'
|
||||
echon ast.value.lexeme
|
||||
@@ -60,13 +87,18 @@ def PrintAst(ast: dict<any>, indent = 0)
|
||||
for v in ast.value
|
||||
call PrintAst(v, indent + 1)
|
||||
endfor
|
||||
elseif ast.kind ==# 'File'
|
||||
for v in ast.value
|
||||
call PrintAst(v, indent + 1)
|
||||
endfor
|
||||
endif
|
||||
enddef
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Grammar
|
||||
# ------------------------------------------------------------------------------
|
||||
# Paragraph ::= Expr+
|
||||
# File ::= Paragraph+
|
||||
# Paragraph ::= Expr+ EndOfParagraph
|
||||
# Expr ::= SExpr | Atom
|
||||
# SExpr ::= '(' Expr* ')'
|
||||
|
||||
@@ -77,14 +109,16 @@ def AtStartOfLParen(scanner: dict<any>): bool
|
||||
return scanner.cur_token.kind == 0 # token_lparen
|
||||
enddef
|
||||
|
||||
def ParseLParen(scanner: dict<any>) # consumes token; no return
|
||||
def ParseLParen(scanner: dict<any>): dict<any>
|
||||
if debug
|
||||
scanner->smt2#scanner#Enforce(scanner->AtStartOfLParen(),
|
||||
"ParseLParen called but not at start of LParen",
|
||||
scanner.cur_token.pos)
|
||||
endif
|
||||
|
||||
const token = scanner.cur_token
|
||||
scanner->smt2#scanner#NextToken()
|
||||
return token
|
||||
enddef
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
@@ -94,14 +128,16 @@ def AtStartOfRParen(scanner: dict<any>): bool
|
||||
return scanner.cur_token.kind == 1 # token_rparen
|
||||
enddef
|
||||
|
||||
def ParseRParen(scanner: dict<any>) # consumes token; no return
|
||||
def ParseRParen(scanner: dict<any>): dict<any>
|
||||
if debug
|
||||
scanner->smt2#scanner#Enforce(scanner->AtStartOfRParen(),
|
||||
"ParseRParen called but not at start of RParen",
|
||||
scanner.cur_token.pos)
|
||||
endif
|
||||
|
||||
const token = scanner.cur_token
|
||||
scanner->smt2#scanner#NextToken()
|
||||
return token
|
||||
enddef
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
@@ -118,7 +154,7 @@ def ParseAtom(scanner: dict<any>): dict<any>
|
||||
scanner.cur_token.pos)
|
||||
endif
|
||||
|
||||
const ast = AtomAst(scanner.cur_token)
|
||||
const ast = AtomAst(scanner.cur_token, scanner)
|
||||
scanner->smt2#scanner#NextToken()
|
||||
return ast
|
||||
enddef
|
||||
@@ -129,6 +165,7 @@ enddef
|
||||
def AtStartOfExpr(scanner: dict<any>): bool
|
||||
return scanner->AtStartOfSExpr() || scanner->AtStartOfAtom()
|
||||
enddef
|
||||
|
||||
def ParseExpr(scanner: dict<any>): dict<any>
|
||||
if debug
|
||||
scanner->smt2#scanner#Enforce(scanner->AtStartOfExpr(),
|
||||
@@ -146,6 +183,7 @@ enddef
|
||||
# SExpr
|
||||
# ------------------------------------------------------------------------------
|
||||
const AtStartOfSExpr = funcref(AtStartOfLParen)
|
||||
|
||||
def ParseSExpr(scanner: dict<any>): dict<any>
|
||||
const pos_from = scanner.cur_token.pos
|
||||
|
||||
@@ -165,10 +203,10 @@ def ParseSExpr(scanner: dict<any>): dict<any>
|
||||
scanner->smt2#scanner#Enforce(scanner->AtStartOfRParen(),
|
||||
printf("Expected RParen but got %s", scanner.cur_token.kind->smt2#scanner#TokenKind2Str()),
|
||||
scanner.cur_token.pos)
|
||||
scanner->ParseRParen()
|
||||
const end_token = scanner->ParseRParen()
|
||||
|
||||
const pos_to = scanner.cur_token.pos
|
||||
return SExprAst(exprs, pos_from, pos_to)
|
||||
const pos_to = end_token.pos + 1
|
||||
return SExprAst(exprs, pos_from, pos_to, scanner)
|
||||
enddef
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
@@ -187,41 +225,132 @@ def ParseParagraph(scanner: dict<any>): dict<any>
|
||||
exprs->add(scanner->ParseExpr())
|
||||
endwhile
|
||||
|
||||
const pos_to = scanner.cur_token.pos
|
||||
return ParagraphAst(exprs, pos_from, pos_to)
|
||||
const pos_to = exprs[-1].pos_to
|
||||
return ParagraphAst(exprs, pos_from, pos_to, scanner)
|
||||
enddef
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# File
|
||||
# ------------------------------------------------------------------------------
|
||||
def ParseFile(scanner: dict<any>): dict<any>
|
||||
const pos_from = scanner.cur_token.pos
|
||||
|
||||
var paragraphs = []
|
||||
while scanner.cur_token.kind != 9 # token_eof
|
||||
const ast = scanner->ParseParagraph()
|
||||
paragraphs->add(ast)
|
||||
endwhile
|
||||
|
||||
const pos_to = empty(paragraphs) ? pos_from : paragraphs[-1].pos_to
|
||||
return FileAst(paragraphs, pos_from, pos_to, scanner)
|
||||
enddef
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Auxiliary
|
||||
#
|
||||
# TODO: MoveTo* functions rely on local search instead of proper (but slow)
|
||||
# scanning of the whole file and may be incorrect in corner cases.
|
||||
# Consider tweaking.
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Returns true if successful, i.e. on move to '(' of outermost SExpr
|
||||
def MoveToOutermostSExpr(): bool
|
||||
var cur_pos = getpos('.')
|
||||
while true
|
||||
silent! normal! [(
|
||||
const new_pos = getpos('.')
|
||||
if cur_pos == new_pos
|
||||
break
|
||||
else
|
||||
cur_pos = new_pos
|
||||
endif
|
||||
endwhile
|
||||
|
||||
const cur_char = getline('.')[charcol('.') - 1]
|
||||
return cur_char == '('
|
||||
enddef
|
||||
|
||||
def CursorInSExpr(): bool
|
||||
const cursor = getpos('.')
|
||||
silent! normal! [(
|
||||
const res = cursor != getpos('.')
|
||||
call setpos('.', cursor)
|
||||
return res
|
||||
enddef
|
||||
|
||||
def MoveToStartOfCurrentParagraph()
|
||||
# Empty (or whitespace) lines outside of S-expressions separate paragraphs.
|
||||
# Nothing to do if cursor is already at such a line.
|
||||
if !(getline('.')->trim()->empty() && !CursorInSExpr())
|
||||
# Move backwards until an empty line that is not in an SExpr is found,
|
||||
# or -- if there is none -- to the first line of the file
|
||||
while true
|
||||
const empty_line = search('\m\C^\s*$', 'b', 1)
|
||||
if !CursorInSExpr()
|
||||
break
|
||||
elseif empty_line == 0
|
||||
cursor(1, 1)
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
endif
|
||||
enddef
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Public functions
|
||||
# ------------------------------------------------------------------------------
|
||||
def smt2#parser#ParseCurrentParagraph(): dict<any>
|
||||
# source = [start of current paragraph, EOF]
|
||||
# Note: This is needed since `silent! normal! {y}` may not yank full paragraphs
|
||||
# in the context of multiline expressions
|
||||
const cursor = getpos('.')
|
||||
silent! normal! {
|
||||
const line_offset = line('.')
|
||||
const source = join(getline('.', '$'), "\n")
|
||||
MoveToStartOfCurrentParagraph()
|
||||
const from = getpos('.')
|
||||
call setpos('.', cursor)
|
||||
|
||||
var scanner = smt2#scanner#Scanner(source, line_offset)
|
||||
# source = [paragraph of outermost SExpr, EOF]
|
||||
# Note: This is needed since `silent! normal! {` is not guaranteed to jump
|
||||
# to the start of the paragraph, e.g. if newlines occur in between.
|
||||
const lines_to_format = getline(from[1], '$')
|
||||
const source = join(lines_to_format, "\n")
|
||||
|
||||
var scanner = smt2#scanner#Scanner(source, from[1], from[2])
|
||||
const ast = scanner->ParseParagraph()
|
||||
|
||||
if debug | ast->PrintAst() | endif
|
||||
return ast
|
||||
enddef
|
||||
|
||||
def smt2#parser#ParseAllParagraphs(): list<dict<any>>
|
||||
# source = current buffer
|
||||
const source = join(getline(1, '$'), "\n")
|
||||
def smt2#parser#ParseOutermostSExpr(): dict<any>
|
||||
const cursor = getpos('.')
|
||||
if ! MoveToOutermostSExpr()
|
||||
throw "Cursor is not in an S-expression!"
|
||||
endif
|
||||
const from = getpos('.')
|
||||
call setpos('.', cursor)
|
||||
|
||||
var scanner = smt2#scanner#Scanner(source)
|
||||
var asts = []
|
||||
while scanner.cur_token.kind != 9 # token_eof
|
||||
const ast = scanner->ParseParagraph()
|
||||
asts->add(ast)
|
||||
# source = [start of outermost SExpr, EOF]
|
||||
# Note: This is needed since `silent! normal! %` is not guaranteed to jump
|
||||
# to the matching ')', e.g. if an unmatched '(' occurs in a comment.
|
||||
const lines_to_format = getline(from[1], '$')
|
||||
const source = join(lines_to_format, "\n")
|
||||
|
||||
if debug | ast->PrintAst() | endif
|
||||
endwhile
|
||||
return asts
|
||||
var scanner = smt2#scanner#Scanner(source, from[1], from[2])
|
||||
const ast = scanner->ParseSExpr()
|
||||
|
||||
if debug | ast->PrintAst() | endif
|
||||
return ast
|
||||
enddef
|
||||
|
||||
def smt2#parser#ParseFile(): dict<any>
|
||||
const cursor = getpos('.')
|
||||
cursor(1, 1)
|
||||
const first_non_empty_line = search('.')
|
||||
call setpos('.', cursor)
|
||||
|
||||
# source = [first non-empty line, EOF]
|
||||
const source = join(getline(first_non_empty_line, '$'), "\n")
|
||||
|
||||
var scanner = smt2#scanner#Scanner(source, first_non_empty_line)
|
||||
const ast = scanner->ParseFile()
|
||||
|
||||
if debug | ast->PrintAst() | endif
|
||||
return ast
|
||||
enddef
|
||||
|
||||
@@ -56,7 +56,7 @@ enddef
|
||||
|
||||
def PrettyPrint(scanner: dict<any>, token: dict<any>)
|
||||
const coord = scanner->Pos2Coord(token.pos)
|
||||
echo printf("%4d:%-3d (%5d) %8s %s", coord.line, coord.col, token.pos, token.kind->smt2#scanner#TokenKind2Str(), token.lexeme)
|
||||
echo printf("%5d %4d:%-3d %8s %s", token.pos, coord.line, coord.col, token.kind->smt2#scanner#TokenKind2Str(), token.lexeme)
|
||||
enddef
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
@@ -72,12 +72,14 @@ enddef
|
||||
# TODO: Enforce restriction to ASCII? We should if we use the lookup table below
|
||||
# TODO: Do not take a string but a character stream (or just buffer and pos)?
|
||||
|
||||
def smt2#scanner#Scanner(source: string, line_offset = 1): dict<any>
|
||||
def smt2#scanner#Scanner(source: string, start_line = 1, start_col = 1): dict<any>
|
||||
var scanner = {
|
||||
chars: source->trim(" \t\n\r", 2)->split('\zs'),
|
||||
line_offset: line_offset, # start line of source string in buffer
|
||||
pos: 0, # pos in source string -- not column in line
|
||||
at_new_paragraph: false}
|
||||
chars: source->trim(" \n\r\t", 2)->split('\zs'),
|
||||
line_offset: start_line, # start line of source string in buffer
|
||||
pos: start_col - 1, # pos in source string -- not column in line
|
||||
at_new_paragraph: false,
|
||||
}
|
||||
scanner.calcCoord = (pos: number): dict<number> => Pos2Coord(scanner, pos)
|
||||
|
||||
if scanner.chars->empty()
|
||||
scanner.at_eof = true
|
||||
|
||||
@@ -9,6 +9,11 @@ set cpoptions&vim
|
||||
let $TF_CLI_ARGS_fmt=''
|
||||
|
||||
function! terraform#fmt() abort
|
||||
silent execute 'w !'.g:terraform_binary_path.' fmt -check -'
|
||||
if v:shell_error == 0
|
||||
return
|
||||
endif
|
||||
|
||||
" Save the view.
|
||||
let curw = winsaveview()
|
||||
|
||||
|
||||
@@ -1,118 +0,0 @@
|
||||
if polyglot#init#is_disabled(expand('<sfile>:p'), 'unison', 'autoload/unison.vim')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Unison functionality for Vim, including type/term omnicompletion.
|
||||
"
|
||||
" Maintainer: Unison Computing
|
||||
" Original Author: Cody Allen (ceedubs)
|
||||
|
||||
if exists('g:autoloaded_unison')
|
||||
finish
|
||||
endif
|
||||
let g:autoloaded_unison = 1
|
||||
|
||||
let s:required_config_value = "!REQUIRED!"
|
||||
|
||||
" adapted from https://github.com/rust-lang/rust.vim/blob/4aa69b84c8a58fcec6b6dad6fe244b916b1cf830/autoload/rust.vim#L9-L18
|
||||
function! s:config(name, default) abort
|
||||
let name = 'unison_' . a:name
|
||||
" Local buffer variable with same name takes predeence over global
|
||||
if has_key(b:, name)
|
||||
return get(b:, name)
|
||||
elseif has_key(g:, name)
|
||||
return get(g:, name)
|
||||
elseif a:default == s:required_config_value
|
||||
throw 'Missing required configuration value: ' . name
|
||||
else
|
||||
return a:default
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:curl_path() abort
|
||||
return s:config('curl_path', "curl")
|
||||
endfunction
|
||||
|
||||
function! s:jq_path() abort
|
||||
return s:config('jq_path', "jq")
|
||||
endfunction
|
||||
|
||||
function! unison#SetBufferDefaults() abort
|
||||
if s:config('set_buffer_defaults', 1)
|
||||
" Since Unison completion is fuzzy and not prefix-based, 'longest' doesn't
|
||||
" work well, and 'noinsert' behaves a little better.
|
||||
setlocal completeopt=menuone,noinsert,preview
|
||||
|
||||
setlocal omnifunc=unison#Complete
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Unison completion satisfying the standard vim completion signature, such
|
||||
" that it can be assigned to omnifunc.
|
||||
" vim will first call this to find the base input that should be completed,
|
||||
" and then will call it again with the base input.
|
||||
function! unison#Complete(findstart, base) abort
|
||||
if a:findstart
|
||||
" locate the start of the word
|
||||
let line = getline('.')
|
||||
let start = col('.') - 1
|
||||
" Examples of where we want to count the start of a word:
|
||||
"
|
||||
" foo List.fold<cursor>
|
||||
" ^
|
||||
"
|
||||
" {Abor<cursor>
|
||||
" ^
|
||||
"
|
||||
" (List.fol<cursor>
|
||||
" ^
|
||||
while start > 0 && line[start - 1] !~ '\v\s|[!(){}\[\]]'
|
||||
let start -= 1
|
||||
endwhile
|
||||
return start
|
||||
else
|
||||
return unison#CompleteForBase(a:base)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Return an array of completion items for the provided base input. For example
|
||||
" base could be 'List.foldL', in which case the top result would probably be
|
||||
" 'List.foldLeft'.
|
||||
function! unison#CompleteForBase(base) abort
|
||||
let resultLimit = s:config('complete_result_limit', 20)
|
||||
let apiHost = s:config('api_host', 'localhost')
|
||||
let apiPort = s:config('api_port', s:required_config_value)
|
||||
let apiToken = s:config('api_token', s:required_config_value)
|
||||
let apiUri = 'http://' . apiHost . ':' . apiPort . '/' . apiToken . '/api/find'
|
||||
|
||||
let curlCommand = s:curl_path() . " -Gfs
|
||||
\ --data-urlencode 'limit=" . resultLimit . "'
|
||||
\ --data-urlencode 'query=" . a:base . "' "
|
||||
\ . apiUri
|
||||
|
||||
let jqFilter = '
|
||||
\ def prettyTermType: .termType|[(.[] | .segment)]|add;
|
||||
\ def prettyTypeDef: if .tag == "BuiltinObject" then "builtin type " else "" end + (.contents|[(.[] | .segment)]|add);
|
||||
\ def termToMatch: {
|
||||
\ word: .bestFoundTermName,
|
||||
\ info: (.namedTerm.termName + " : " + (.namedTerm|prettyTermType)),
|
||||
\ menu: .namedTerm|prettyTermType
|
||||
\ };
|
||||
\ def typeToMatch: {
|
||||
\ word: .bestFoundTypeName,
|
||||
\ info: (.namedType.typeName + " : " + (.typeDef|prettyTypeDef)),
|
||||
\ menu: .typeDef|prettyTypeDef
|
||||
\ };
|
||||
\ .[][1]|(
|
||||
\ (select(.tag == "FoundTermResult")|.contents|termToMatch),
|
||||
\ (select(.tag == "FoundTypeResult")|.contents|typeToMatch)
|
||||
\ )'
|
||||
|
||||
let command = curlCommand . " | " . s:jq_path() . " -c '" . jqFilter . "'"
|
||||
let lines = system(command)
|
||||
let resultObjects = split(lines, "\n")
|
||||
call map(resultObjects, {_, val -> json_decode(val)})
|
||||
return resultObjects
|
||||
endfunction
|
||||
|
||||
" vim: set et sw=2 sts=2 ts=2:
|
||||
@@ -128,6 +128,7 @@ let attributes_value = {
|
||||
\ 'http-equiv': ['Text', ''],
|
||||
\ 'icon': ['URL', ''],
|
||||
\ 'id': ['Text', ''],
|
||||
\ 'inert': ['Bool', ''],
|
||||
\ 'ismap': ['Bool', ''],
|
||||
\ 'keytype': ['Text', ''],
|
||||
\ 'label': ['Text', ''],
|
||||
@@ -194,7 +195,7 @@ let attributes_value = {
|
||||
\ }
|
||||
|
||||
if g:html5_event_handler_attributes_complete == 1
|
||||
let event_handler_attributes = {'onabort': [], 'onblur': [], 'oncanplay': [], 'oncanplaythrough': [], 'onchange': [], 'onclick': [], 'oncontextmenu': [], 'ondblclick': [], 'ondrag': [], 'ondragend': [], 'ondragenter': [], 'ondragleave': [], 'ondragover': [], 'ondragstart': [], 'ondrop': [], 'ondurationchange': [], 'onemptied': [], 'onended': [], 'onerror': [], 'onfocus': [], 'onformchange': [], 'onforminput': [], 'oninput': [], 'oninvalid': [], 'onkeydown': [], 'onkeypress': [], 'onkeyup': [], 'onload': [], 'onloadeddata': [], 'onloadedmetadata': [], 'onloadstart': [], 'onmousedown': [], 'onmousemove': [], 'onmouseout': [], 'onmouseover': [], 'onmouseup': [], 'onmousewheel': [], 'onpause': [], 'onplay': [], 'onplaying': [], 'onprogress': [], 'onratechange': [], 'onreadystatechange': [], 'onscroll': [], 'onseeked': [], 'onseeking': [], 'onselect': [], 'onshow': [], 'onstalled': [], 'onsubmit': [], 'onsuspend': [], 'ontimeupdate': [], 'onvolumechange': [], 'onwaiting': [], 'onselectstart': [], 'onselectchange': []}
|
||||
let event_handler_attributes = {'onabort': [], 'onblur': [], 'oncancel': [], 'oncanplay': [], 'oncanplaythrough': [], 'onchange': [], 'onclick': [], 'oncontextmenu': [], 'ondblclick': [], 'ondrag': [], 'ondragend': [], 'ondragenter': [], 'ondragleave': [], 'ondragover': [], 'ondragstart': [], 'ondrop': [], 'ondurationchange': [], 'onemptied': [], 'onended': [], 'onerror': [], 'onfocus': [], 'onformchange': [], 'onforminput': [], 'oninput': [], 'oninvalid': [], 'onkeydown': [], 'onkeypress': [], 'onkeyup': [], 'onload': [], 'onloadeddata': [], 'onloadedmetadata': [], 'onloadstart': [], 'onmousedown': [], 'onmousemove': [], 'onmouseout': [], 'onmouseover': [], 'onmouseup': [], 'onmousewheel': [], 'onpause': [], 'onplay': [], 'onplaying': [], 'onprogress': [], 'onratechange': [], 'onreadystatechange': [], 'onscroll': [], 'onseeked': [], 'onseeking': [], 'onselect': [], 'onshow': [], 'onstalled': [], 'onsubmit': [], 'onsuspend': [], 'ontimeupdate': [], 'onvolumechange': [], 'onwaiting': [], 'onselectstart': [], 'onselectchange': []}
|
||||
let global_attributes = extend(global_attributes, event_handler_attributes)
|
||||
|
||||
let body_attributes = {'onafterprint': [], 'onbeforeprint': [], 'onbeforeunload': [], 'onblur': [], 'onerror': [], 'onfocus': [], 'onhashchange': [], 'onload': [], 'onmessage': [], 'onoffline': [], 'ononline': [], 'onpopstate': [], 'onredo': [], 'onresize': [], 'onstorage': [], 'onundo': [], 'onunload': []}
|
||||
@@ -205,6 +206,7 @@ if g:html5_event_handler_attributes_complete == 1
|
||||
\ 'onbeforeprint': ['Script', ''],
|
||||
\ 'onbeforeunload': ['Script', ''],
|
||||
\ 'onblur': ['Script', ''],
|
||||
\ 'oncancel': ['Script', ''],
|
||||
\ 'oncanplay': ['Script', ''],
|
||||
\ 'oncanplaythrough': ['Script', ''],
|
||||
\ 'onchange': ['Script', ''],
|
||||
|
||||
Reference in New Issue
Block a user