This commit is contained in:
Adam Stankiewicz
2021-06-01 18:17:40 +02:00
parent 730dcb02ca
commit af0eaee017
56 changed files with 813 additions and 430 deletions

View File

@@ -73,9 +73,6 @@ function! s:L2U_SetupGlobal()
" Trigger for the previous mapping of <CR>
let s:l2u_fallback_trigger_cr = "\u0091L2UFallbackCR"
" Trigger for autosub completion cleanup autocommand
let s:l2u_autosub_cleanup_trigger = "\u0091L2UAutosubCleanup"
endfunction
" Each time the filetype changes, we may need to enable or
@@ -371,16 +368,14 @@ function! s:L2U_SetFallbackMapping(s, k)
" general solution. Also, it doesn't work with <CR> since that stops
" parsing of the <C-R>=... expression, so we need to special-case it.
" Also, if the original mapping was intended to be recursive, this
" will break it.
if mmdict["expr"]
if a:s != "<CR>"
let rhs = substitute(rhs, '\c' . a:s, "\<C-R>=LaTeXtoUnicode#PutLiteral('" . a:s . "')\<CR>", 'g')
else
let rhs = substitute(rhs, '\c' . a:s, "\<C-R>=LaTeXtoUnicode#PutLiteralCR()\<CR>", 'g')
endif
" Make the mapping silent even if it wasn't originally
if !mmdict["silent"]
let pre = pre . '<silent>'
" will break it.
if a:s != "<CR>"
let rhs = substitute(rhs, '\c' . a:s, "\<C-R>=LaTeXtoUnicode#PutLiteral('" . a:s . "')\<CR>", 'g')
else
let rhs = substitute(rhs, '\c' . a:s, "\<C-R>=LaTeXtoUnicode#PutLiteralCR()\<CR>", 'g')
endif
" Make the mapping silent even if it wasn't originally
if !mmdict["silent"]
let pre = pre . '<silent>'
endif
endif
@@ -631,7 +626,7 @@ function! LaTeXtoUnicode#AutoSub(...)
let col1 = col('.')
let lnum = line('.')
if col1 == 1
if a:0 > 1
if a:0 > 1
call feedkeys(a:2, 'mi')
endif
let b:l2u_in_autosub = 0
@@ -641,7 +636,7 @@ function! LaTeXtoUnicode#AutoSub(...)
let l = getline(lnum)[0 : col1-1-bs] . v:char
let col0 = match(l, '\\\%([_^]\?[A-Za-z]\+\%' . col1 . 'c\%([^A-Za-z]\|$\)\|[_^]\%([0-9()=+-]\)\%' . col1 .'c\%(.\|$\)\)')
if col0 == -1
if a:0 > 1
if a:0 > 1
call feedkeys(a:2, 'mi')
endif
let b:l2u_in_autosub = 0
@@ -650,33 +645,22 @@ function! LaTeXtoUnicode#AutoSub(...)
let base = l[col0 : col1-1-bs]
let unicode = get(g:l2u_symbols_dict, base, '')
if empty(unicode)
if a:0 > 1
if a:0 > 1
call feedkeys(a:2, 'mi')
endif
let b:l2u_in_autosub = 0
return ''
endif
" create a temporary mapping to reset b:l2u_in_autosub when done
" (when invoked, it removes itself)
exec 'imap <buffer> ' . s:l2u_autosub_cleanup_trigger . ' <Plug>L2UAutosubReset'
inoremap <buffer><expr> <Plug>L2UAutosubReset <SID>L2U_AutosubReset()
" perform the substitution, wrapping it in undo breakpoints so that
" we can revert it as a whole
call feedkeys("\<C-G>u", 'n')
call feedkeys(repeat("\b", len(base) + bs) . unicode . vc . s:l2u_esc_sequence, 'nt')
call feedkeys("\<C-G>u", 'n')
" enqueue the reset mechanism
call feedkeys(s:l2u_autosub_cleanup_trigger)
return ''
endfunction
function! s:L2U_AutosubReset()
" no longer doing substitution
let b:l2u_in_autosub = 0
" remove the mapping that triggered this function
exec 'iunmap <buffer> ' . s:l2u_autosub_cleanup_trigger
" we can revert it as a whole
" at the end, reset the l2u_in_autosub variable without leaving insert mode
" the 'i' mode is the only one that works correctly when executing macros
" the 'n' mode is to avoid user-defined mappings of \b, <C-G> and <C-\><C-O>
call feedkeys("\<C-G>u" .
\ repeat("\b", len(base) + bs) . unicode . vc . s:l2u_esc_sequence .
\ "\<C-G>u" .
\ "\<C-\>\<C-O>:let b:l2u_in_autosub = 0\<CR>",
\ 'ni')
return ''
endfunction

View File

@@ -1195,7 +1195,7 @@ endfun
fu! csv#Sort(bang, line1, line2, colnr) range "{{{3
" :Sort command
let wsv = winsaveview()
let flag = matchstr(a:colnr, '[nixo]')
let flag = matchstr(a:colnr, '[nixof]')
call csv#CheckHeaderLine()
let line1 = a:line1
let line2 = a:line2
@@ -2199,7 +2199,15 @@ fu! csv#CSVMappings() "{{{3
call csv#Map('nnoremap', 'W', ':<C-U>call csv#MoveCol(1, line("."))<CR>')
call csv#Map('nnoremap', '<C-Right>', ':<C-U>call csv#MoveCol(1, line("."))<CR>')
call csv#Map('nnoremap', 'L', ':<C-U>call csv#MoveCol(1, line("."))<CR>')
call csv#Map('nnoremap', 'E', ':<C-U>call csv#MoveCol(-1, line("."))<CR>')
try
if g:csv_bind_B == 1
call csv#Map('nnoremap', 'B', ':<C-U>call csv#MoveCol(-1, line("."))<CR>')
else
call csv#Map('nnoremap', 'E', ':<C-U>call csv#MoveCol(-1, line("."))<CR>')
endif
catch
call csv#Map('nnoremap', 'E', ':<C-U>call csv#MoveCol(-1, line("."))<CR>')
endtry
call csv#Map('nnoremap', '<C-Left>', ':<C-U>call csv#MoveCol(-1, line("."))<CR>')
call csv#Map('nnoremap', 'H', ':<C-U>call csv#MoveCol(-1, line("."), 1)<CR>')
call csv#Map('nnoremap', 'K', ':<C-U>call csv#MoveCol(0, line(".")-v:count1)<CR>')

View File

@@ -2245,7 +2245,7 @@ if !has_key(g:polyglot_is_disabled, 'jsonnet')
endif
if !has_key(g:polyglot_is_disabled, 'json')
au BufNewFile,BufRead *.JSON-tmLanguage,*.avsc,*.geojson,*.gltf,*.har,*.ice,*.json,*.jsonl,*.jsonp,*.mcmeta,*.template,*.tfstate,*.tfstate.backup,*.topojson,*.webapp,*.webmanifest,*.yy,*.yyp,{.,}arcconfig,{.,}htmlhintrc,{.,}tern-config,{.,}tern-project,{.,}watchmanconfig,Pipfile.lock,composer.lock,mcmod.info setf json
au BufNewFile,BufRead *.JSON-tmLanguage,*.avsc,*.geojson,*.gltf,*.har,*.ice,*.json,*.jsonl,*.jsonp,*.mcmeta,*.template,*.tfstate,*.tfstate.backup,*.topojson,*.webapp,*.webmanifest,*.yy,*.yyp,{.,}arcconfig,{.,}htmlhintrc,{.,}imgbotconfig,{.,}tern-config,{.,}tern-project,{.,}watchmanconfig,Pipfile.lock,composer.lock,mcmod.info setf json
endif
if !has_key(g:polyglot_is_disabled, 'json5')

View File

@@ -263,7 +263,7 @@ let s:globs = {
\ 'jovial': '*.jov,*.j73,*.jovial',
\ 'jproperties': '*.properties,*.properties_??,*.properties_??_??,*.properties_??_??_*',
\ 'jq': '*.jq,.jqrc,.jqrc*',
\ 'json': '*.json,*.avsc,*.geojson,*.gltf,*.har,*.ice,*.JSON-tmLanguage,*.jsonl,*.mcmeta,*.tfstate,*.tfstate.backup,*.topojson,*.webapp,*.webmanifest,*.yy,*.yyp,*.jsonp,*.template,.arcconfig,.htmlhintrc,.tern-config,.tern-project,.watchmanconfig,Pipfile.lock,composer.lock,mcmod.info',
\ 'json': '*.json,*.avsc,*.geojson,*.gltf,*.har,*.ice,*.JSON-tmLanguage,*.jsonl,*.mcmeta,*.tfstate,*.tfstate.backup,*.topojson,*.webapp,*.webmanifest,*.yy,*.yyp,*.jsonp,*.template,.arcconfig,.htmlhintrc,.imgbotconfig,.tern-config,.tern-project,.watchmanconfig,Pipfile.lock,composer.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',

View File

@@ -40,7 +40,7 @@ function! terraform#align() abort
if exists(':Tabularize') && getline('.') =~# '^.*=' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^=]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*=\s*\zs.*'))
Tabularize/=/l1
Tabularize/=.*/l1
normal! 0
call search(repeat('[^=]*=',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
endif
@@ -67,6 +67,7 @@ function! terraform#commands(ArgLead, CmdLine, CursorPos) abort
\ 'show',
\ 'state',
\ 'taint',
\ 'test',
\ 'untaint',
\ 'version',
\ 'workspace'