This commit is contained in:
Adam Stankiewicz
2022-03-12 15:46:18 +01:00
parent 83422e0a1f
commit a4f98d2a9e
12 changed files with 153 additions and 68 deletions

View File

@@ -117,8 +117,8 @@ function! s:unmap(function)
return
endif
let mapids = a:function =~# "^move" ? ["n", "x", "o"] :
\ a:function =~# "^select" ? ["x", "o"] :
\ ["n"]
\ a:function =~# "^select" ? ["x", "o"] :
\ ["n"]
let fn = "julia_blocks#" . a:function
let cmd = "<buffer> " . chars
for m in mapids
@@ -355,10 +355,10 @@ function! s:move_before_begin()
endfunction
function! s:cycle_until_end()
let pos = getpos('.')
let c = 0
while !s:on_end()
let pos = getpos('.')
call s:matchit()
let c = 0
if getpos('.') == pos || c > 1000
" shouldn't happen, but let's avoid infinite loops anyway
return 0
@@ -384,12 +384,12 @@ function! s:moveto_block_delim(toend, backwards, ...)
while 1
let searchret = search('\C' . pattern, flags)
if !searchret
return ret
return ret
endif
exe "let skip = " . b:match_skip
if !skip
let ret = 1
break
let ret = 1
break
endif
endwhile
endfor
@@ -495,15 +495,15 @@ function! julia_blocks#moveblock_N()
let start1_pos = ret_start ? getpos('.') : [0,0,0,0]
call setpos('.', save_pos)
if s:on_end()
normal! h
normal! h
endif
let ret_end = s:moveto_block_delim(1, 0, 1)
let end1_pos = ret_end ? getpos('.') : [0,0,0,0]
if ret_start && (!ret_end || s:compare_pos(start1_pos, end1_pos) < 0)
call setpos('.', start1_pos)
call setpos('.', start1_pos)
else
call setpos('.', save_pos)
call setpos('.', save_pos)
endif
endif
@@ -564,7 +564,7 @@ function! julia_blocks#moveblock_p()
if s:on_begin()
call s:move_before_begin()
if s:on_end()
normal! l
normal! l
endif
let save_pos = getpos('.')
let ret_start = s:moveto_block_delim(0, 1, 1)
@@ -574,9 +574,9 @@ function! julia_blocks#moveblock_p()
let end1_pos = ret_end ? getpos('.') : [0,0,0,0]
if ret_end && (!ret_start || s:compare_pos(start1_pos, end1_pos) < 0)
call setpos('.', end1_pos)
call setpos('.', end1_pos)
else
call setpos('.', save_pos)
call setpos('.', save_pos)
endif
endif
@@ -700,7 +700,7 @@ function! s:find_block(current_mode)
endfunction
function! s:repeated_find(ai_mode)
let repeat = b:jlblk_count + (a:ai_mode == 'i' && v:count1 > 1 ? 1 : 0)
let repeat = b:jlblk_count + (a:ai_mode == 'i' && b:jlblk_count > 1 ? 1 : 0)
for c in range(repeat)
let current_mode = (c < repeat - 1 ? 'a' : a:ai_mode)
let ret_find_block = s:find_block(current_mode)
@@ -734,8 +734,8 @@ function! julia_blocks#select_a(...)
let b:jlblk_doing_select = 1
" CursorMove is only triggered if end_pos
" end_pos is different than the staring position;
" CursorMoved is only triggered if end_pos
" is different than the staring position;
" so when starting from the 'd' in 'end' we need to
" force it
if current_pos == end_pos
@@ -746,6 +746,39 @@ function! julia_blocks#select_a(...)
return [start_pos, end_pos]
endfunction
let s:bracketBlocks = '\<julia\%(\%(\%(Printf\)\?Par\|SqBra\%(Idx\)\?\|CurBra\)Block\|ParBlockInRange\|StringVars\%(Par\|SqBra\|CurBra\)\|Dollar\%(Par\|SqBra\)\|QuotedParBlockS\?\)\>'
let s:codeBlocks = '\<julia\%(Conditional\|While\|For\|Begin\|Function\|Macro\|Quote\|\%(Mutable\)\?Struct\|Let\|Do\|Exception\|Abstract\|Primitive\)Block\>'
function s:is_in_brackets(lnum, c)
let stack = map(synstack(a:lnum, a:c), 'synIDattr(v:val, "name")')
for i in range(len(stack)-1, 0, -1)
if stack[i] =~# s:bracketBlocks
return 1
elseif stack[i] =~# s:codeBlocks
return 0
endif
endfor
return 0
endfunction
function! s:seek_bracket_end()
let [lnum, c] = [line('.'), col('.')]
if !s:is_in_brackets(lnum, c)
return
endif
while c > 0 && s:is_in_brackets(lnum, c)
let c -= 1
endwhile
let c += 1
if !s:is_in_brackets(lnum, c)
echoerr "this is a bug, please report it"
return
end
call cursor(lnum, c)
call s:matchit()
return
endfunction
function! julia_blocks#select_i()
call s:get_save_pos(!b:jlblk_did_select)
let current_pos = getpos('.')
@@ -759,19 +792,32 @@ function! julia_blocks#select_i()
return s:abort()
endif
call setpos('.', end_pos)
let b:jlblk_doing_select = 1
let start_pos[1] += 1
call setpos('.', start_pos)
normal! ^
normal! $
call s:seek_bracket_end()
let l = getline('.')
while col('.') < len(l) && l[col('.'):] =~# '^\s*;'
normal! l
endwhile
if col('.') == len(l) || l[col('.')] =~# '\s'
normal! W
else
normal! l
endif
let start_pos = getpos('.')
let end_pos[1] -= 1
let end_pos[2] = len(getline(end_pos[1]))
" CursorMove is only triggered if end_pos
" end_pos is different than the staring position;
call setpos('.', end_pos)
if end_pos[2] > 1 && getline('.')[end_pos[2]-2] =~# '\S'
normal! h
else
normal! gE
endif
let end_pos = getpos('.')
" CursorMoved is only triggered if end_pos
" is different than the staring position;
" so when starting from the 'd' in 'end' we need to
" force it
if current_pos == end_pos

View File

@@ -72,7 +72,7 @@ if exists("loaded_matchit")
elseif attr == 'juliaBlKeyword'
return b:julia_begin_keywordsm . ':' . b:julia_end_keywords
elseif attr == 'juliaException'
return b:julia_begin_keywordsm . ':\<\%(catch\|finally\)\>:' . b:julia_end_keywords
return b:julia_begin_keywordsm . ':\<\%(catch\|else\|finally\)\>:' . b:julia_end_keywords
endif
return '\<\>:\<\>'
endfunction

View File

@@ -92,7 +92,7 @@ function GetJuliaNestingStruct(lnum, ...)
let i = JuliaMatch(a:lnum, line, '\<else\>', s)
if i >= 0 && i == fb
let s = i+1
if len(blocks_stack) > 0 && blocks_stack[-1] =~# '\<\%(else\)\=if\>'
if len(blocks_stack) > 0 && blocks_stack[-1] =~# '\<\%(\%(else\)\=if\|catch\)\>'
let blocks_stack[-1] = 'else'
else
call add(blocks_stack, 'else')
@@ -110,7 +110,7 @@ function GetJuliaNestingStruct(lnum, ...)
let i = JuliaMatch(a:lnum, line, '\<catch\>', s)
if i >= 0 && i == fb
let s = i+1
if len(blocks_stack) > 0 && blocks_stack[-1] == 'try'
if len(blocks_stack) > 0 && blocks_stack[-1] =~# '\<\%(try\|finally\)\>'
let blocks_stack[-1] = 'catch'
else
call add(blocks_stack, 'catch')
@@ -121,7 +121,7 @@ function GetJuliaNestingStruct(lnum, ...)
let i = JuliaMatch(a:lnum, line, '\<finally\>', s)
if i >= 0 && i == fb
let s = i+1
if len(blocks_stack) > 0 && (blocks_stack[-1] == 'try' || blocks_stack[-1] == 'catch')
if len(blocks_stack) > 0 && blocks_stack[-1] =~# '\<\%(try\|catch\|else\)\>'
let blocks_stack[-1] = 'finally'
else
call add(blocks_stack, 'finally')

View File

@@ -119,7 +119,7 @@ function! GetSvelteIndent()
let cursyns = s:SynsSOL(v:lnum)
let cursyn = get(cursyns, 0, '')
if s:SynHTML(cursyn)
if s:SynHTML(cursyn) && !s:IsMultipleLineSvelteExpression(curline, cursyns)
call s:Log('syntax: html')
let ind = XmlIndentGet(v:lnum, 0)
if prevline =~? s:empty_tag
@@ -233,6 +233,20 @@ function! s:SynHTML(syn)
return a:syn ==? 'htmlSvelteTemplate'
endfunction
function! s:IsMultipleLineSvelteExpression(curline, syns)
if a:curline =~ '^\s*{.*}\s*$'
return 0
endif
for syn in a:syns
if syn ==? 'svelteExpression'
return 1
endif
endfor
return 0
endfunction
function! s:SynBlockBody(syn)
return a:syn ==? 'svelteBlockBody'
endfunction

View File

@@ -183,8 +183,9 @@ syntax region juliaLetBlock matchgroup=juliaBlKeyword start="\<let\>" end="\<e
syntax region juliaDoBlock matchgroup=juliaBlKeyword start="\<do\>" end="\<end\>" contains=@juliaExpressions fold
syntax region juliaModuleBlock matchgroup=juliaBlKeyword start="\<\%(bare\)\?module\>" end="\<end\>" contains=@juliaExpressions fold
syntax region juliaExceptionBlock matchgroup=juliaException start="\<try\>" end="\<end\>" contains=@juliaExpressions,juliaCatchBlock,juliaFinallyBlock fold
syntax region juliaCatchBlock matchgroup=juliaException transparent contained start="\<catch\>" end="\<end\>"me=s-1 contains=@juliaExpressions,juliaFinallyBlock
syntax region juliaFinallyBlock matchgroup=juliaException transparent contained start="\<finally\>" end="\<end\>"me=s-1 contains=@juliaExpressions
syntax region juliaCatchBlock matchgroup=juliaException transparent contained start="\<catch\>" end="\<end\>"me=s-1 contains=@juliaExpressions,juliaTryElseBlock,juliaFinallyBlock
syntax region juliaTryElseBlock matchgroup=juliaException transparent contained start="\<else\>" end="\<end\>"me=s-1 contains=@juliaExpressions,juliaFinallyBlock
syntax region juliaFinallyBlock matchgroup=juliaException transparent contained start="\<finally\>" end="\<end\>"me=s-1 contains=@juliaExpressions,juliaCatchBlock
syntax region juliaAbstractBlock matchgroup=juliaBlKeyword start="\<abstract\s\+type\>" end="\<end\>" fold contains=@juliaExpressions,juliaStructR
syntax region juliaPrimitiveBlock matchgroup=juliaBlKeyword start="\<primitive\s\+type\>" end="\<end\>" fold contains=@juliaExpressions,juliaStructR

View File

@@ -129,7 +129,6 @@ syntax keyword smt2Builtin
\ rotate_left
\ rotate_right
\ sat
\ sat
\ select
\ sign_extend
\ store
@@ -137,7 +136,6 @@ syntax keyword smt2Builtin
\ to_real
\ true
\ unsat
\ unsat
\ xor
\ zero_extend
syntax match smt2Builtin "\m\C[\^\~]"

View File

@@ -247,7 +247,7 @@ syn keyword solMethod delete new var return import
syn region solMethodParens start='(' end=')' contains=solString,solConstant,solNumber,solFuncCall,solTypeCast,solMethod,solComma,solOperator contained transparent
syn keyword solMethod nextgroup=solMethodParens skipwhite skipempty
\ blockhash require revert assert keccak256 sha256
\ ripemd160 ecrecover addmod mullmod selfdestruct
\ ripemd160 ecrecover addmod mulmod selfdestruct
hi def link solMethod Special

View File

@@ -22,43 +22,41 @@ syntax match svelteComponentName containedin=htmlTagN '\v\C<[a-z0-9]+(-[a-z0-9]+
syntax match svelteComponentName containedin=htmlTagN '\vsvelte:\w*'
" Syntax for vim-svelte-theme
syntax match htmlAttr '\v(\S|\<)@<![^\/\<\>[:blank:]]+' containedin=htmlTag
syntax match htmlAttr '\v(\S|\<)@<![^\/\<\>[:blank:]]+'
\ containedin=htmlTag
\ contains=htmlString,svelteValue,htmlArg
syntax match htmlAttrEqual '\v\=' containedin=htmlAttr
syntax match svelteAttr
\ '\v(\S)@<!(on|bind|use|in|out|transition|animate|class):[^\=\>[:blank:]]+(\=\"[^"]*\"|\=\{[^}]*\})?'
\ '\(\S\)\@<!\w\+:[^=>[:blank:]]\+\(="[^"]*"\|={[^}]*}\)\?'
\ containedin=htmlTag
\ contains=svelteKey,svelteValue
syntax match svelteKey contained '\v(on|bind|use|in|out|transition|animate|class):[^\=\>[:blank:]]+'
syntax match svelteValue contained '\v\{[^}]*\}'
syntax match svelteValue contained '{[^}]*}'
syntax match svelteKey contained '\w\+:[^=>[:blank:]]\+'
syntax region svelteExpression
\ containedin=htmlH.*,htmlItalic
\ matchgroup=svelteBrace
\ transparent
\ start="{"
\ end="}\(}\)\@!"
\ end="}\(}\|;\)\@!"
" Multiple lines expressions are supposed to end with '}}'
syntax region svelteExpression
\ containedin=svelteValue,htmlValue,htmlAttr
\ contains=@simpleJavascriptExpression
\ matchgroup=svelteBrace
\ start="{"
\ end="\(}\)\@<=}"
syntax region svelteExpression
\ containedin=htmlSvelteTemplate,svelteValue,htmlString,htmlValue,htmlArg,htmlTag
\ containedin=htmlSvelteTemplate,svelteValue,htmlString,htmlArg,htmlTag,htmlAttr,htmlValue,htmlAttr
\ contains=@simpleJavascriptExpression,svelteAtTags
\ matchgroup=svelteBrace
\ transparent
\ start="{"
\ end="}\(}\)\@!"
\ end="}\(}\|;\)\@!"
\ oneline
syntax region svelteExpression
\ containedin=htmlTag
\ contains=@simpleJavascriptExpression,svelteAtTags,svelteShortProp
\ matchgroup=svelteBrace
\ transparent
\ start="{"
\ end="}\(}\)\@!"
syntax match svelteAtTags '\v\@(html|debug)'
syntax match svelteShortProp '\v<\w+>'
syntax match svelteAtTags '@\(html\|debug\)'
syntax region svelteBlockBody
\ containedin=htmlSvelteTemplate,htmlLink
@@ -101,7 +99,9 @@ syntax region javaScriptTemplateExpression
syntax match javaScriptNumber '\v<-?\d+L?>|0[xX][0-9a-fA-F]+>' contained
syntax match javaScriptOperator '[-!|&+<>=%*~^]' contained
syntax match javaScriptOperator '\v(*)@<!/(/|*)@!' contained
syntax keyword javaScriptOperator delete instanceof typeof void new in of contained
syntax keyword javaScriptOperator contained
\ delete instanceof typeof void new in of const let var
\ return function
highlight default link svelteAttr htmlTag
if s:highlight_svelte_attr
@@ -112,7 +112,9 @@ else
highlight default link svelteValue String
endif
highlight default link svelteExpression None
highlight default link svelteBrace Type
highlight default link svelteAtTags Type
highlight default link svelteBlockKeyword Statement
highlight default link svelteComponentName htmlTagName
highlight default link javaScriptTemplateString String
@@ -122,6 +124,5 @@ highlight default link javaScriptNumber Constant
highlight default link javaScriptOperator Operator
highlight default link svelteAttr htmlTag
highlight default link svelteAttrEqual htmlTag
highlight default link svelteShortProp htmlValue
"}}}
" vim: fdm=marker

View File

@@ -192,7 +192,7 @@ syn keyword swayConfigDrawingMarksKeyword show_marks contained
syn match swayConfigDrawingMarks /^\s*show_marks\s\+\(yes\|no\)\s\?$/ contains=swayConfigFocusWrappingType,swayConfigDrawingMarksKeyword
" Group mode/bar
syn keyword swayConfigBlockKeyword mode bar colors i3bar_command status_command position exec mode hidden_state modifier id position output background statusline tray_output tray_padding separator separator_symbol workspace_buttons strip_workspace_numbers binding_mode_indicator focused_workspace active_workspace inactive_workspace urgent_workspace binding_mode contained
syn keyword swayConfigBlockKeyword set input mode bar colors i3bar_command status_command position exec mode hidden_state modifier id position output background statusline tray_output tray_padding separator separator_symbol workspace_buttons strip_workspace_numbers binding_mode_indicator focused_workspace active_workspace inactive_workspace urgent_workspace binding_mode contained
syn region swayConfigBlock start=+.*s\?{$+ end=+^}$+ contains=swayConfigBlockKeyword,swayConfigString,swayConfigBind,swayConfigComment,swayConfigFont,swayConfigFocusWrappingType,swayConfigColor,swayConfigVariable transparent keepend extend
" Line continuation
@@ -202,6 +202,10 @@ syn region swayConfigLineCont start=/^.*\\$/ end=/^.*$/ contains=swayConfigBlock
syn keyword swayConfigInclude include contained
syn match swayConfigFile /^include\s\(\~\?\/.*$\|\.\{0,2}\/.*$\)/ contains=swayConfigInclude
" xwayland
syn keyword swayConfigXwaylandKeyword xwayland contained
syn match swayConfigXwaylandModifier /^\s*xwayland\s\+\(enable\|disable\|force\)\s\?$/ contains=swayConfigXwaylandKeyword
" Define the highlighting.
let b:current_syntax = "swayconfig"
hi! def link swayConfigError Error
@@ -281,5 +285,6 @@ hi! def link swayConfigFloatingModifier Identifier
hi! def link swayConfigFloatingMouseAction Type
hi! def link swayConfigFocusKeyword Type
hi! def link swayConfigFocusType Identifier
hi! def link swayConfigXwaylandKeyword Identifier
hi! def link swayConfigXwaylandModifier Type

View File

@@ -140,10 +140,12 @@ syntax keyword swiftKeywords
\ init
\ inout
\ internal
\ isolated
\ lazy
\ let
\ mutating
\ nil
\ nonisolated
\ nonmutating
\ open
\ operator
@@ -193,14 +195,22 @@ syntax keyword swiftAttributes
\ @_exported
\ @_implementationOnly
\ @_silgen_name
\ @AppStorage
\ @assignment
\ @autoclosure
\ @available
\ @Binding
\ @convention
\ @discardableResult
\ @Environment
\ @EnvironmentObject
\ @escaping
\ @exported
\ @FetchRequest
\ @FocusedBinding
\ @FocusedValue
\ @frozen
\ @GestureState
\ @IBAction
\ @IBDesignable
\ @IBInspectable
@@ -208,21 +218,29 @@ syntax keyword swiftAttributes
\ @inlinable
\ @main
\ @MainActor
\ @Namespace
\ @noescape
\ @nonobjc
\ @noreturn
\ @NSApplicationDelegateAdaptor
\ @NSApplicationMain
\ @NSCopying
\ @NSManaged
\ @objc
\ @ObservedObject
\ @preconcurrency
\ @propertyWrapper
\ @Published
\ @resultBuilder
\ @ScaledMetric
\ @SceneStorage
\ @Sendable
\ @State
\ @StateObject
\ @testable
\ @UIApplicationDelegateAdaptor
\ @UIApplicationMain
\ @usableFromInline
\ @warn_unused_result
syntax keyword swiftConditionStatement
\ #available

View File

@@ -3,7 +3,7 @@ if polyglot#init#is_disabled(expand('<sfile>:p'), 'tmux', 'syntax/tmux.vim')
endif
" Language: tmux(1) configuration file
" Version: 3.3-rc (git-85ef7359)
" Version: 3.3-rc (git-ee3f1d25)
" URL: https://github.com/ericpruitt/tmux.vim/
" Maintainer: Eric Pruitt <eric.pruitt@gmail.com>
" License: 2-Clause BSD (http://opensource.org/licenses/BSD-2-Clause)
@@ -88,13 +88,13 @@ syn keyword tmuxOptions
\ pane-border-indicators pane-border-lines pane-border-status
\ pane-border-style pane-colours popup-border-lines popup-border-style
\ popup-style prefix prefix2 prompt-history-limit remain-on-exit
\ renumber-windows repeat-time set-clipboard set-titles set-titles-string
\ silence-action status status-bg status-fg status-format status-interval
\ status-justify status-keys status-left status-left-length
\ status-left-style status-position status-right status-right-length
\ status-right-style status-style synchronize-panes terminal-features
\ terminal-overrides update-environment user-keys visual-activity
\ visual-bell visual-silence window-active-style window-size
\ remain-on-exit-format renumber-windows repeat-time set-clipboard
\ set-titles set-titles-string silence-action status status-bg status-fg
\ status-format status-interval status-justify status-keys status-left
\ status-left-length status-left-style status-position status-right
\ status-right-length status-right-style status-style synchronize-panes
\ terminal-features terminal-overrides update-environment user-keys
\ visual-activity visual-bell visual-silence window-active-style window-size
\ window-status-activity-style window-status-bell-style
\ window-status-current-format window-status-current-style
\ window-status-format window-status-last-style window-status-separator

View File

@@ -203,6 +203,8 @@ let s:zig_syntax_keywords = {
\ , "@floor"
\ , "@ceil"
\ , "@trunc"
\ , "@wasmMemorySize"
\ , "@wasmMemoryGrow"
\ , "@round"]
\ }