This commit is contained in:
Adam Stankiewicz
2019-11-15 17:27:14 +01:00
parent 0c79dd3e73
commit d15651463a
13 changed files with 873 additions and 584 deletions

View File

@@ -21,7 +21,7 @@ if exists('s:did_indent')
endif endif
setlocal indentexpr=GetJsxIndent() setlocal indentexpr=GetJsxIndent()
setlocal indentkeys=0{,0},0),0],0\,,!^F,o,O,e,<>>,=*/ setlocal indentkeys=0{,0},0),0],0?,0\*,0\,,!^F,:,<:>,o,O,e,<>>,=*/
function! GetJsxIndent() function! GetJsxIndent()
return jsx_pretty#indent#get(function('GetJavascriptIndent')) return jsx_pretty#indent#get(function('GetJavascriptIndent'))

View File

@@ -26,7 +26,7 @@ if exists('s:did_indent')
endif endif
setlocal indentexpr=GetJsxIndent() setlocal indentexpr=GetJsxIndent()
setlocal indentkeys=0{,0},0),0],0\,,!^F,o,O,e,*<Return>,<>>,<<>,/ setlocal indentkeys=0{,0},0),0],0?,0\*,0\,,!^F,:,<:>,o,O,e,<>>,=*/
function! GetJsxIndent() function! GetJsxIndent()
return jsx_pretty#indent#get(function('GetTypescriptIndent')) return jsx_pretty#indent#get(function('GetTypescriptIndent'))

View File

@@ -36,6 +36,19 @@ if exists('g:cpp_member_variable_highlight') && g:cpp_member_variable_highlight
hi def link cCustomMemVar Function hi def link cCustomMemVar Function
endif endif
" -----------------------------------------------------------------------------
" Highlight POSIX functions.
" -----------------------------------------------------------------------------
if exists('g:cpp_posix_standard') && g:cpp_posix_standard
syn keyword cPOSIXFunction socket accept bind connect getsockname
syn keyword cPOSIXFunction listen recv recvfrom recvmsg
syn keyword cPOSIXFunction send sendto sendmsg setsockopt socketpair
syn keyword cPOSIXFunction htonl htons ntohl ntohs
syn keyword cPOSIXFunction inet_ntop inet_pton getaddrinfo
syn keyword cPOSIXFunction poll select pselect
hi def link cPOSIXFunction Function
endif
" ----------------------------------------------------------------------------- " -----------------------------------------------------------------------------
" Source: aftersyntaxc.vim " Source: aftersyntaxc.vim
" ----------------------------------------------------------------------------- " -----------------------------------------------------------------------------

View File

@@ -633,21 +633,19 @@ syntax keyword cppSTLios unitbuf
syntax keyword cppSTLios uppercase syntax keyword cppSTLios uppercase
"syntax keyword cppSTLios ws "syntax keyword cppSTLios ws
syntax keyword cppSTLiterator back_insert_iterator syntax keyword cppSTLiterator back_insert_iterator
syntax keyword cppSTLiterator bidirectional_iterator
syntax keyword cppSTLiterator const_iterator syntax keyword cppSTLiterator const_iterator
syntax keyword cppSTLiterator const_reverse_iterator syntax keyword cppSTLiterator const_reverse_iterator
syntax keyword cppSTLiterator forward_iterator
syntax keyword cppSTLiterator front_insert_iterator syntax keyword cppSTLiterator front_insert_iterator
syntax keyword cppSTLiterator input_iterator
syntax keyword cppSTLiterator insert_iterator syntax keyword cppSTLiterator insert_iterator
syntax keyword cppSTLiterator istreambuf_iterator syntax keyword cppSTLiterator istreambuf_iterator
syntax keyword cppSTLiterator istream_iterator syntax keyword cppSTLiterator istream_iterator
syntax keyword cppSTLiterator ostreambuf_iterator
syntax keyword cppSTLiterator ostream_iterator
syntax keyword cppSTLiterator iterator syntax keyword cppSTLiterator iterator
syntax keyword cppSTLiterator ostream_iterator syntax keyword cppSTLiterator ostream_iterator
syntax keyword cppSTLiterator output_iterator syntax keyword cppSTLiterator output_iterator
syntax keyword cppSTLiterator random_access_iterator
syntax keyword cppSTLiterator raw_storage_iterator syntax keyword cppSTLiterator raw_storage_iterator
syntax keyword cppSTLiterator reverse_bidirectional_iterator syntax keyword cppSTLiterator move_iterator
syntax keyword cppSTLiterator reverse_iterator syntax keyword cppSTLiterator reverse_iterator
syntax keyword cppSTLiterator_tag bidirectional_iterator_tag syntax keyword cppSTLiterator_tag bidirectional_iterator_tag
syntax keyword cppSTLiterator_tag forward_iterator_tag syntax keyword cppSTLiterator_tag forward_iterator_tag
@@ -1593,6 +1591,8 @@ endif " C++14
if !exists("cpp_no_cpp17") if !exists("cpp_no_cpp17")
syntax keyword cppSTLnamespace pmr
" algorithm " algorithm
syntax keyword cppSTLfunction clamp syntax keyword cppSTLfunction clamp
syntax keyword cppSTLfunction for_each_n syntax keyword cppSTLfunction for_each_n
@@ -1985,87 +1985,278 @@ endif " C++17
if !exists("cpp_no_cpp20") if !exists("cpp_no_cpp20")
" type_traits
syntax keyword cppSTLtype remove_cvref remove_cvref_t
syntax keyword cppType char8_t syntax keyword cppType char8_t
syntax keyword cppStatement co_yield co_return co_await syntax keyword cppStatement co_yield co_return co_await
syntax keyword cppStorageClass consteval syntax keyword cppStorageClass consteval
syntax keyword cppSTLnamespace ranges
" algorithm
syntax keyword cppSTLfunction shift_left
syntax keyword cppSTLfunction shift_right
syntax keyword cppSTLfunction lexicographical_compare_three_way
" bit
syntax keyword cppSTLcast bit_cast
syntax keyword cppSTLfunction ispow2
syntax keyword cppSTLfunction ceil2
syntax keyword cppSTLfunction floor2
syntax keyword cppSTLfunction log2p1
syntax keyword cppSTLfunction rotl
syntax keyword cppSTLfunction rotr
syntax keyword cppSTLfunction countl_zero
syntax keyword cppSTLfunction countl_one
syntax keyword cppSTLfunction countr_zero
syntax keyword cppSTLfunction countr_one
syntax keyword cppSTLfunction popcount
syntax keyword cppSTLtype endian
" compare
syntax keyword cppSTLtype weak_equality
syntax keyword cppSTLtype strong_equality
syntax keyword cppSTLtype partial_ordering
syntax keyword cppSTLtype weak_ordering
syntax keyword cppSTLtype strong_ordering
syntax keyword cppSTLtype common_comparison_category
syntax keyword cppSTLtype compare_three_way_result
syntax keyword cppSTLtype compare_three_way
syntax keyword cppSTLtype strong_order
syntax keyword cppSTLtype weak_order
syntax keyword cppSTLtype parital_order
syntax keyword cppSTLtype compare_strong_order_fallback
syntax keyword cppSTLtype compare_weak_order_fallback
syntax keyword cppSTLtype compare_parital_order_fallback
syntax keyword cppSTLfunction is_eq
syntax keyword cppSTLfunction is_neq
syntax keyword cppSTLfunction is_lt
syntax keyword cppSTLfunction is_lteq
syntax keyword cppSTLfunction is_gt
syntax keyword cppSTLfunction is_gteq
" format
syntax keyword cppSTLtype formatter
syntax keyword cppSTLtype basic_format_parse_context
syntax keyword cppSTLtype format_parse_context
syntax keyword cppSTLtype wformat_parse_context
syntax keyword cppSTLtype basic_format_context
syntax keyword cppSTLtype format_context
syntax keyword cppSTLtype wformat_context
syntax keyword cppSTLtype basic_format_arg
syntax keyword cppSTLtype basic_format_args
syntax keyword cppSTLtype format_args
syntax keyword cppSTLtype wformat_args
syntax keyword cppSTLtype format_args_t
syntax keyword cppSTLtype format_error
syntax keyword cppSTLfuntion format
syntax keyword cppSTLfuntion format_to
syntax keyword cppSTLfuntion format_to_n
syntax keyword cppSTLfuntion formatted_size
syntax keyword cppSTLfuntion vformat
syntax keyword cppSTLfuntion vformat_to
syntax keyword cppSTLfuntion visit_format_arg
syntax keyword cppSTLfuntion make_format_args
syntax keyword cppSTLfuntion make_wformat_args
" iterator
syntax keyword cppSTLtype default_sentinel_t unreachable_sentinel_t
syntax keyword cppSTLiterator common_iterator
syntax keyword cppSTLiterator counted_iterator
syntax keyword cppSTLiterator_tag contiguous_iterator_tag
" memory
syntax keyword cppSTLfunction to_address
syntax keyword cppSTLfunction assume_aligned
syntax keyword cppSTLfunction make_unique_default_init
syntax keyword cppSTLfunction allocate_shared_default_init
" source_location
syntax keyword cppSTLtype source_location
" span
syntax keyword cppSTLtype span
syntax keyword cppSTLfunction as_bytes
syntax keyword cppSTLfunction as_writable_bytes
syntax keyword cppSTLconstant dynamic_extent
" syncstream
syntax keyword cppSTLtype basic_syncbuf
syntax keyword cppSTLtype basic_osyncstream
syntax keyword cppSTLtype syncbuf
syntax keyword cppSTLtype wsyncbuf
syntax keyword cppSTLtype osyncstream
syntax keyword cppSTLtype wosyncstream
" type_traits
syntax keyword cppSTLtype remove_cvref remove_cvref_t
syntax keyword cppSTLtype common_reference common_reference_t
syntax keyword cppSTLfunction is_constant_evaluated
syntax keyword cppSTLfunction is_pointer_interconvertible
syntax keyword cppSTLfunction is_corresponding_member
syntax keyword cppSTLtype is_nothrow_convertible
syntax keyword cppSTLbool is_nothrow_convertible_v
syntax keyword cppSTLtype is_layout_compatible
syntax keyword cppSTLbool is_layout_compatible_v
syntax keyword cppSTLtype is_bounded_array
syntax keyword cppSTLbool is_bounded_array_v
syntax keyword cppSTLtype is_unbounded_array
syntax keyword cppSTLbool is_unbounded_array_v
syntax keyword cppSTLtype is_pointer_interconvertible_base_of
syntax keyword cppSTLbool is_pointer_interconvertible_base_of_v
syntax keyword cppSTLtype has_strong_structural_equality
syntax keyword cppSTLbool has_strong_structural_equality_v
" version
" TODO
endif endif
if exists('g:cpp_concepts_highlight') && g:cpp_concepts_highlight if exists('g:cpp_concepts_highlight')
syntax keyword cppStatement concept syntax keyword cppStatement concept
syntax keyword cppStorageClass requires syntax keyword cppStorageClass requires
syntax keyword cppSTLtype DefaultConstructible
syntax keyword cppSTLtype MoveConstructible if g:cpp_concepts_highlight == 1
syntax keyword cppSTLtype CopyConstructible syntax keyword cppSTLconcept DefaultConstructible
syntax keyword cppSTLtype MoveAssignable syntax keyword cppSTLconcept MoveConstructible
syntax keyword cppSTLtype CopyAssignable syntax keyword cppSTLconcept CopyConstructible
syntax keyword cppSTLtype Destructible syntax keyword cppSTLconcept MoveAssignable
syntax keyword cppSTLtype TriviallyCopyable syntax keyword cppSTLconcept CopyAssignable
syntax keyword cppSTLtype TrivialType syntax keyword cppSTLconcept Destructible
syntax keyword cppSTLtype StandardLayoutType syntax keyword cppSTLconcept TriviallyCopyable
syntax keyword cppSTLtype PODType syntax keyword cppSTLconcept TrivialType
syntax keyword cppSTLtype EqualityComparable syntax keyword cppSTLconcept StandardLayoutType
syntax keyword cppSTLtype LessThanComparable syntax keyword cppSTLconcept PODType
syntax keyword cppSTLtype Swappable syntax keyword cppSTLconcept EqualityComparable
syntax keyword cppSTLtype ValueSwappable syntax keyword cppSTLconcept LessThanComparable
syntax keyword cppSTLtype NullablePointer syntax keyword cppSTLconcept Swappable
syntax keyword cppSTLtype Hash syntax keyword cppSTLconcept ValueSwappable
syntax keyword cppSTLtype Allocator syntax keyword cppSTLconcept NullablePointer
syntax keyword cppSTLtype FunctionObject syntax keyword cppSTLconcept Hash
syntax keyword cppSTLtype Callable syntax keyword cppSTLconcept Allocator
syntax keyword cppSTLtype Predicate syntax keyword cppSTLconcept FunctionObject
syntax keyword cppSTLtype BinaryPredicate syntax keyword cppSTLconcept Callable
syntax keyword cppSTLtype Compare syntax keyword cppSTLconcept Predicate
syntax keyword cppSTLtype Container syntax keyword cppSTLconcept BinaryPredicate
syntax keyword cppSTLtype ReversibleContainer syntax keyword cppSTLconcept Compare
syntax keyword cppSTLtype AllocatorAwareContainer syntax keyword cppSTLconcept Container
syntax keyword cppSTLtype SequenceContainer syntax keyword cppSTLconcept ReversibleContainer
syntax keyword cppSTLtype ContiguousContainer syntax keyword cppSTLconcept AllocatorAwareContainer
syntax keyword cppSTLtype AssociativeContainer syntax keyword cppSTLconcept SequenceContainer
syntax keyword cppSTLtype UnorderedAssociativeContainer syntax keyword cppSTLconcept ContiguousContainer
syntax keyword cppSTLtype DefaultInsertable syntax keyword cppSTLconcept AssociativeContainer
syntax keyword cppSTLtype CopyInsertable syntax keyword cppSTLconcept UnorderedAssociativeContainer
syntax keyword cppSTLtype CopyInsertable syntax keyword cppSTLconcept DefaultInsertable
syntax keyword cppSTLtype MoveInsertable syntax keyword cppSTLconcept CopyInsertable
syntax keyword cppSTLtype EmplaceConstructible syntax keyword cppSTLconcept CopyInsertable
syntax keyword cppSTLtype Erasable syntax keyword cppSTLconcept MoveInsertable
syntax keyword cppSTLtype Iterator syntax keyword cppSTLconcept EmplaceConstructible
syntax keyword cppSTLtype InputIterator syntax keyword cppSTLconcept Erasable
syntax keyword cppSTLtype OutputIterator syntax keyword cppSTLconcept Iterator
syntax keyword cppSTLtype ForwardIterator syntax keyword cppSTLconcept InputIterator
syntax keyword cppSTLtype BidirectionalIterator syntax keyword cppSTLconcept OutputIterator
syntax keyword cppSTLtype RandomAccessIterator syntax keyword cppSTLconcept ForwardIterator
syntax keyword cppSTLtype ContiguousIterator syntax keyword cppSTLconcept BidirectionalIterator
syntax keyword cppSTLtype UnformattedInputFunction syntax keyword cppSTLconcept RandomAccessIterator
syntax keyword cppSTLtype FormattedInputFunction syntax keyword cppSTLconcept ContiguousIterator
syntax keyword cppSTLtype UnformattedOutputFunction syntax keyword cppSTLconcept UnformattedInputFunction
syntax keyword cppSTLtype FormattedOutputFunction syntax keyword cppSTLconcept FormattedInputFunction
syntax keyword cppSTLtype SeedSequence syntax keyword cppSTLconcept UnformattedOutputFunction
syntax keyword cppSTLtype UniformRandomBitGenerator syntax keyword cppSTLconcept FormattedOutputFunction
syntax keyword cppSTLtype RandomNumberEngine syntax keyword cppSTLconcept SeedSequence
syntax keyword cppSTLtype RandomNumberEngineAdaptor syntax keyword cppSTLconcept UniformRandomBitGenerator
syntax keyword cppSTLtype RandomNumberDistribution syntax keyword cppSTLconcept RandomNumberEngine
syntax keyword cppSTLtype BasicLockable syntax keyword cppSTLconcept RandomNumberEngineAdaptor
syntax keyword cppSTLtype Lockable syntax keyword cppSTLconcept RandomNumberDistribution
syntax keyword cppSTLtype TimedLockable syntax keyword cppSTLconcept BasicLockable
syntax keyword cppSTLtype Mutex syntax keyword cppSTLconcept Lockable
syntax keyword cppSTLtype TimedMutex syntax keyword cppSTLconcept TimedLockable
syntax keyword cppSTLtype SharedMutex syntax keyword cppSTLconcept Mutex
syntax keyword cppSTLtype SharedTimedMutex syntax keyword cppSTLconcept TimedMutex
syntax keyword cppSTLtype UnaryTypeTrait syntax keyword cppSTLconcept SharedMutex
syntax keyword cppSTLtype BinaryTypeTrait syntax keyword cppSTLconcept SharedTimedMutex
syntax keyword cppSTLtype TransformationTrait syntax keyword cppSTLconcept UnaryTypeTrait
syntax keyword cppSTLtype Clock syntax keyword cppSTLconcept BinaryTypeTrait
syntax keyword cppSTLtype TrivialClock syntax keyword cppSTLconcept TransformationTrait
syntax keyword cppSTLtype CharTraits syntax keyword cppSTLconcept Clock
syntax keyword cppSTLtype pos_type syntax keyword cppSTLconcept TrivialClock
syntax keyword cppSTLtype off_type syntax keyword cppSTLconcept CharTraits
syntax keyword cppSTLtype BitmaskType syntax keyword cppSTLconcept pos_type
syntax keyword cppSTLtype NumericType syntax keyword cppSTLconcept off_type
syntax keyword cppSTLtype RegexTraits syntax keyword cppSTLconcept BitmaskType
syntax keyword cppSTLtype LiteralType syntax keyword cppSTLconcept NumericType
syntax keyword cppSTLconcept RegexTraits
syntax keyword cppSTLconcept LiteralType
elseif g:cpp_concepts_highlight == 2
syntax keyword cppSTLconcept same_as
syntax keyword cppSTLconcept derived_from
syntax keyword cppSTLconcept convertible_to
syntax keyword cppSTLconcept common_reference_with
syntax keyword cppSTLconcept common_with
syntax keyword cppSTLconcept integral
syntax keyword cppSTLconcept signed_integral
syntax keyword cppSTLconcept unsigned_integral
syntax keyword cppSTLconcept assignable_from
syntax keyword cppSTLconcept swappable
syntax keyword cppSTLconcept swappable_with
syntax keyword cppSTLconcept destructible
syntax keyword cppSTLconcept constructible_from
syntax keyword cppSTLconcept default_constructible
syntax keyword cppSTLconcept move_constructible
syntax keyword cppSTLconcept copy_constructible
syntax keyword cppSTLconcept boolean
syntax keyword cppSTLconcept equality_comparable
syntax keyword cppSTLconcept equality_comparable_with
syntax keyword cppSTLconcept totally_ordered
syntax keyword cppSTLconcept totally_ordered_with
syntax keyword cppSTLconcept movable
syntax keyword cppSTLconcept copyable
syntax keyword cppSTLconcept semiregular
syntax keyword cppSTLconcept regular
syntax keyword cppSTLconcept invocable
syntax keyword cppSTLconcept regular_invocable
syntax keyword cppSTLconcept predicate
syntax keyword cppSTLconcept relation
syntax keyword cppSTLconcept strict_weak_order
syntax keyword cppSTLconcept readable
syntax keyword cppSTLconcept writable
syntax keyword cppSTLconcept weakly_incrementable
syntax keyword cppSTLconcept incrementable
syntax keyword cppSTLconcept input_or_output_iterator
syntax keyword cppSTLconcept sentinal_for
syntax keyword cppSTLconcept sized_sentinal_for
syntax keyword cppSTLconcept input_iterator
syntax keyword cppSTLconcept output_iterator
syntax keyword cppSTLconcept forward_iterator
syntax keyword cppSTLconcept bidirectional_iterator
syntax keyword cppSTLconcept random_access_iterator
syntax keyword cppSTLconcept input_iterator
syntax keyword cppSTLconcept output_iterator
syntax keyword cppSTLconcept bidirectional_iterator
syntax keyword cppSTLconcept random_access_iterator
syntax keyword cppSTLconcept contiguous_iterator
syntax keyword cppSTLconcept indirectly_unary_invocable
syntax keyword cppSTLconcept indirectly_regular_unary_invocable
syntax keyword cppSTLconcept indirect_unary_predicate
syntax keyword cppSTLconcept indirect_relation
syntax keyword cppSTLconcept indirect_strict_weak_order
syntax keyword cppSTLconcept indirectly_movable
syntax keyword cppSTLconcept indirectly_movable_storable
syntax keyword cppSTLconcept indirectly_copyable
syntax keyword cppSTLconcept indirectly_copyable_storable
syntax keyword cppSTLconcept indirectly_swappable
syntax keyword cppSTLconcept indirectly_comparable
syntax keyword cppSTLconcept permutable
syntax keyword cppSTLconcept mergeable
syntax keyword cppSTLconcept sortable
syntax keyword cppSTLconcept range
syntax keyword cppSTLconcept sized_range
syntax keyword cppSTLconcept output_range
syntax keyword cppSTLconcept input_range
syntax keyword cppSTLconcept bidirectional_range
syntax keyword cppSTLconcept random_access_range
syntax keyword cppSTLconcept contiguous_range
syntax keyword cppSTLconcept common_range
syntax keyword cppSTLconcept viewable_range
syntax keyword cppSTLconcept uniform_random_bit_generator
endif
endif " C++ concepts endif " C++ concepts
@@ -2095,6 +2286,7 @@ if version >= 508 || !exists("did_cpp_syntax_inits")
HiLink cppSTLiterator Typedef HiLink cppSTLiterator Typedef
HiLink cppSTLiterator_tag Typedef HiLink cppSTLiterator_tag Typedef
HiLink cppSTLenum Typedef HiLink cppSTLenum Typedef
HiLink cppSTLconcept Typedef
HiLink cppSTLios Function HiLink cppSTLios Function
HiLink cppSTLcast Statement " be consistent with official syntax HiLink cppSTLcast Statement " be consistent with official syntax
HiLink cppRawString String HiLink cppRawString String

View File

@@ -368,6 +368,11 @@ function! go#config#PlayOpenBrowser() abort
return get(g:, "go_play_open_browser", 1) return get(g:, "go_play_open_browser", 1)
endfunction endfunction
function! go#config#GorenameCommand() abort
" delegate to go#config#GorenameBin for backwards compatability.
return get(g:, "go_gorename_command", go#config#GorenameBin())
endfunction
function! go#config#GorenameBin() abort function! go#config#GorenameBin() abort
return get(g:, "go_gorename_bin", "gorename") return get(g:, "go_gorename_bin", "gorename")
endfunction endfunction

View File

@@ -15,6 +15,10 @@ let s:start_tag = '<\_s*\%(>\|\${\|\%(\<[-:._$A-Za-z0-9]\+\>\)\)'
" Regexp for the end tag " Regexp for the end tag
let s:end_tag = '\%(<\_s*/\_s*\%(\<[-:._$A-Za-z0-9]\+\>\)\_s*>\|/\_s*>\)' let s:end_tag = '\%(<\_s*/\_s*\%(\<[-:._$A-Za-z0-9]\+\>\)\_s*>\|/\_s*>\)'
function s:trim(line)
return substitute(a:line, '^\s*\|\s*$', '', 'g')
endfunction
" Get the syntax stack at the given position " Get the syntax stack at the given position
function s:syntax_stack_at(lnum, col) function s:syntax_stack_at(lnum, col)
return map(synstack(a:lnum, a:col), 'synIDattr(v:val, "name")') return map(synstack(a:lnum, a:col), 'synIDattr(v:val, "name")')
@@ -30,22 +34,11 @@ function s:start_col(lnum)
return len(matchstr(getline(a:lnum), '^\s*')) + 1 return len(matchstr(getline(a:lnum), '^\s*')) + 1
endfunction endfunction
" Get the end col of the non-space charactor
function s:end_col(lnum)
return len(substitute(getline(a:lnum), '\s*$', '', 'g'))
endfunction
" Get the start syntax of a given line number " Get the start syntax of a given line number
function s:start_syntax(lnum) function s:start_syntax(lnum)
return s:syntax_at(a:lnum, s:start_col(a:lnum)) return s:syntax_at(a:lnum, s:start_col(a:lnum))
endfunction endfunction
" Get the end syntax of a given line number
function s:end_syntax(lnum)
let end_col = len(substitute(getline(a:lnum), '\s*$', '', 'g'))
return s:syntax_at(a:lnum, end_col)
endfunction
" The skip function for searchpair " The skip function for searchpair
function s:skip_if_not(current_lnum, ...) function s:skip_if_not(current_lnum, ...)
" Skip the match in current line " Skip the match in current line
@@ -57,47 +50,6 @@ function s:skip_if_not(current_lnum, ...)
return syntax !~? join(a:000, '\|') return syntax !~? join(a:000, '\|')
endfunction endfunction
" Whether the specified stytax group is an jsx-related syntax
function s:is_jsx(syntax_name)
return a:syntax_name =~ '^jsx' && a:syntax_name !=? 'jsxEscapeJs'
endfunction
" Whether the specified line is start with jsx-related syntax
function s:start_with_jsx(lnum)
let start_syntax = s:start_syntax(a:lnum)
return s:is_jsx(start_syntax)
endfunction
" Whether the specified line is end with jsx-related syntax
function s:end_with_jsx(lnum)
let end_syntax = s:end_syntax(a:lnum)
return s:is_jsx(end_syntax)
endfunction
" Whether the specified line is comment related syntax
function s:is_comment(syntax)
return a:syntax =~? 'comment'
endfunction
" Whether the specified line is embedded comment in jsxTag
function s:is_embedded_comment(lnum)
let start_col = s:start_col(a:lnum)
let syntax_stack = s:syntax_stack_at(a:lnum, start_col)
let last = get(syntax_stack, -1)
let last_2nd = get(syntax_stack, -2)
" Patch code for pangloss/vim-javascript
" <div
" /* hello */ <-- syntax stack is [..., jsxTag, jsComment, jsComment]
" >
if last_2nd =~ 'comment'
let last_2nd = get(syntax_stack, -3)
endif
return last =~? 'comment' && last_2nd =~? 'jsxTag' &&
\ trim(getline(a:lnum)) =~ '\%(^/[*/]\)\|\%(\*/$\)'
endfunction
" Whether the specified stytax group is the opening tag " Whether the specified stytax group is the opening tag
function s:is_opening_tag(syntax) function s:is_opening_tag(syntax)
return a:syntax =~? 'jsxOpenPunct' return a:syntax =~? 'jsxOpenPunct'
@@ -108,9 +60,9 @@ function s:is_closing_tag(syntax)
return a:syntax =~? 'jsxClose' return a:syntax =~? 'jsxClose'
endfunction endfunction
" Whether the specified stytax group is the jsxAttrib " Whether the specified syntax group is the jsxRegion
function s:is_jsx_attr(syntax) function s:is_jsx_region(syntax)
return a:syntax =~? 'jsxAttrib' return a:syntax =~? 'jsxRegion'
endfunction endfunction
" Whether the specified syntax group is the jsxElement " Whether the specified syntax group is the jsxElement
@@ -118,9 +70,9 @@ function s:is_jsx_element(syntax)
return a:syntax =~? 'jsxElement' return a:syntax =~? 'jsxElement'
endfunction endfunction
" Whether the specified syntax group is the jsxTag " Whether the specified syntax group is the jsxEscapeJs
function s:is_jsx_tag(syntax) function s:is_jsx_escape(syntax)
return a:syntax =~? 'jsxTag' return a:syntax =~? 'jsxEscapeJs'
endfunction endfunction
" Whether the specified syntax group is the jsxBraces " Whether the specified syntax group is the jsxBraces
@@ -133,6 +85,11 @@ function s:is_jsx_comment(syntax)
return a:syntax =~? 'jsxComment' return a:syntax =~? 'jsxComment'
endfunction endfunction
" Whether the specified line is comment related syntax
function s:is_comment(syntax)
return a:syntax =~? 'comment'
endfunction
" Whether the specified syntax group is the jsxComment " Whether the specified syntax group is the jsxComment
function s:is_jsx_backticks(syntax) function s:is_jsx_backticks(syntax)
return a:syntax =~? 'jsxBackticks' return a:syntax =~? 'jsxBackticks'
@@ -143,155 +100,18 @@ function s:prev_lnum(lnum)
return prevnonblank(a:lnum - 1) return prevnonblank(a:lnum - 1)
endfunction endfunction
" Given a lnum and get the information of its previous line " Whether the given pos is the parent of the given element who has
function s:prev_info(lnum) " element_count jsxElement syntax
let prev_lnum = s:prev_lnum(a:lnum) function s:is_parent_element(pos, element_count)
let prev_start_syntax = s:start_syntax(prev_lnum) let syntax_stack = s:syntax_stack_at(a:pos[0], a:pos[1])
let prev_end_syntax = s:end_syntax(prev_lnum) return s:is_opening_tag(syntax_stack[-1]) &&
\ count(syntax_stack, 'jsxElement') <= a:element_count
return [prev_lnum, prev_start_syntax, prev_end_syntax]
endfunction endfunction
" Get the length difference between syntax stack a and b " Compute the indention of the trail punct
function s:syntax_stack_length_compare(lnum_a, col_a, lnum_b, col_b) function s:jsx_indent_trail_punct(lnum)
let stack_a = s:syntax_stack_at(a:lnum_a, a:col_a) let pair_line = searchpair('<', '', '>', 'bW', 's:skip_if_not(a:lnum, "jsxOpenPunct", "jsxClose")')
let stack_b = s:syntax_stack_at(a:lnum_b, a:col_b) return indent(pair_line)
return len(stack_a) - len(stack_b)
endfunction
" Determine whether child is a element of parent
function s:is_element_of(parent_lnum, child_lnum)
let parent_stack = s:syntax_stack_at(a:parent_lnum, s:start_col(a:parent_lnum))
let child_stack = s:syntax_stack_at(a:child_lnum, s:start_col(a:child_lnum))
let element_index = len(child_stack) - index(reverse(child_stack), 'jsxElement')
let rest = parent_stack[element_index:]
return index(rest, 'jsxElement') == -1
endfunction
" Compute the indention of the opening tag
function s:jsx_indent_opening_tag(lnum)
let [prev_lnum, prev_start_syntax, prev_end_syntax] = s:prev_info(a:lnum)
" If current line is start with >
if trim(getline(a:lnum)) =~ '^>'
let pair_line = searchpair('<', '', '>', 'bW', 's:skip_if_not(a:lnum, "jsxOpenPunct", "jsxClose")')
return indent(pair_line)
endif
" If both the start and the end of the previous line are not jsx-related syntax
" return (
" <div></div> <--
" )
if !s:end_with_jsx(prev_lnum) && !s:start_with_jsx(prev_lnum)
" return -1, so that it will use the default js indent function
return -1
endif
" If the end of the previous line is not jsx-related syntax
" [
" <div></div>,
" <div></div> <--
" ]
" should not affect
" <div
" render={() => (
" <div> <--
" </div>
" )}
" >
" </div>
" <div>
" {items.map(() => (
" <Item /> <--
" ))}
" </div>
if !s:end_with_jsx(prev_lnum) &&
\ !s:is_jsx_attr(prev_start_syntax) &&
\ !s:is_jsx_brace(prev_start_syntax)
return indent(prev_lnum)
endif
" If the start of the previous line is not jsx-related syntax
" return <div>
" <div></div> <--
" </div>
if !s:start_with_jsx(prev_lnum)
return indent(prev_lnum) + s:sw()
endif
endif
" <div>
" <span>
" </span>
" <div> <--
" </div>
" </div>
if s:is_closing_tag(prev_start_syntax)
return indent(prev_lnum)
endif
" If the previous line is end with a closing tag
" <div>
" <br />
" <div></div> <--
" </div>
" should not affect case like
" <div><br />
" <span> <--
" </div>
if s:is_closing_tag(prev_end_syntax) &&
\ s:syntax_stack_length_compare(
\ prev_lnum, s:start_col(prev_lnum), prev_lnum, s:end_col(prev_lnum)) == 2
return indent(prev_lnum)
endif
" If the start of the previous line is the jsxElement
" <div>
" hello
" <div></div> <--
" </div>
if s:is_jsx_element(prev_start_syntax) ||
\ s:is_jsx_comment(prev_start_syntax)
return indent(prev_lnum)
endif
" If the start of the prvious line is the jsxBraces {
" <div>
" {foo}
" <div></div> <--
" </div>
" should not affect case like
" <div>
" {
" <div></div> <--
" }
" </div>
if s:is_jsx_brace(prev_start_syntax) &&
\ trim(getline(prev_lnum)) =~ '^[$]\?{' &&
\ s:syntax_stack_length_compare(
\ prev_lnum, s:start_col(prev_lnum), a:lnum, s:start_col(a:lnum)) == -2
return indent(prev_lnum)
endif
" If the start of the prvious line is the jsxBraces }
" <div>
" {
" foo
" }
" <div></div> <--
" </div>
if s:is_jsx_brace(prev_start_syntax) &&
\ trim(getline(prev_lnum)) =~ '}' &&
\ s:syntax_stack_length_compare(
\ prev_lnum, s:start_col(prev_lnum), a:lnum, s:start_col(a:lnum)) == -3
return indent(prev_lnum)
endif
" Otherwise, indent s:sw() spaces
return indent(prev_lnum) + s:sw()
endfunction endfunction
" Compute the indention of the closing tag " Compute the indention of the closing tag
@@ -300,195 +120,64 @@ function s:jsx_indent_closing_tag(lnum)
return pair_line ? indent(pair_line) : indent(a:lnum) return pair_line ? indent(pair_line) : indent(a:lnum)
endfunction endfunction
" Compute the indention of the jsxAttrib
function s:jsx_indent_attr(lnum)
let [prev_lnum, prev_start_syntax, prev_end_syntax] = s:prev_info(a:lnum)
" If the start of the previous line is not jsx-related syntax
" return <div
" attr="hello" <--
" >
" should not affect
" <div
" // comment here
" attr="hello"
" >
" </div>
if !s:start_with_jsx(prev_lnum) &&
\ !s:is_comment(prev_start_syntax)
return indent(prev_lnum) + s:sw()
endif
" If the start of the previous line is the opening tag
" <div
" title="title" <--
" >
if s:is_opening_tag(prev_start_syntax)
return indent(prev_lnum) + s:sw()
endif
" Otherwise, align the attribute with its previous line
return indent(prev_lnum)
endfunction
" Compute the indentation of the jsxElement " Compute the indentation of the jsxElement
function s:jsx_indent_element(lnum) function s:jsx_indent_element(lnum)
let [prev_lnum, prev_start_syntax, prev_end_syntax] = s:prev_info(a:lnum) let syntax_stack = s:syntax_stack_at(a:lnum, s:start_col(a:lnum))
let syntax_name = syntax_stack[-1]
let element_count = count(syntax_stack, 'jsxElement')
" Fix test case like if s:trim(getline(a:lnum)) =~ '^>'
" <div|> <-- press enter return s:jsx_indent_trail_punct(a:lnum)
" should indent as
" <div
" > <--
if trim(getline(a:lnum)) =~ '^>' && !s:is_opening_tag(prev_end_syntax)
return indent(prev_lnum)
endif endif
" If the start of the previous line is start with > " If current tag is closing tag
" <div if s:is_closing_tag(syntax_name)
" attr="foo" return s:jsx_indent_closing_tag(a:lnum)
" >
" text <--
" </div>
if s:is_opening_tag(prev_start_syntax) &&
\ trim(getline(prev_lnum)) =~ '^>$'
return indent(prev_lnum) + s:sw()
endif endif
" <div> " Normalize the jsxElement count for opening tag
" text <-- if s:is_opening_tag(syntax_name)
" </div> " <div>
" should not affect case like " <div></div> <-- jsxRegion->jsxElement->jsxElement->jsxTag->jsxOpenTag->jsxOpenPunct
" <div> " </div>
" <br /> if s:is_jsx_element(syntax_stack[-4]) && s:is_jsx_element(syntax_stack[-5])
" hello <-- let element_count = element_count - 1
" </div> endif
if s:is_opening_tag(prev_start_syntax) &&
\ s:is_element_of(prev_lnum, a:lnum)
return indent(prev_lnum) + s:sw()
endif endif
" return <div> let start_time = localtime()
" text <-- let pos = searchpos(s:start_tag, 'bW')
" </div>
if !s:start_with_jsx(prev_lnum)
return indent(prev_lnum) + s:sw()
endif
" Otherwise, align with the previous line while !s:is_parent_element(pos, element_count)
" <div> if localtime() - start_time >= 0.5
" {foo} return -1
" text <-- endif
" </div> let pos = searchpos(s:start_tag, 'bW')
return indent(prev_lnum) endwhile
endfunction
" Compute the indentation of jsxBraces return indent(pos[0]) + s:sw()
function s:jsx_indent_brace(lnum)
let [prev_lnum, prev_start_syntax, prev_end_syntax] = s:prev_info(a:lnum)
" If the start of the previous line is start with >
" <div
" attr="foo"
" >
" {foo} <--
" </div>
if s:is_opening_tag(prev_start_syntax) &&
\ trim(getline(prev_lnum)) =~ '^>$'
return indent(prev_lnum) + s:sw()
endif
" <div>
" {foo} <--
" </div>
" should not affect case like
" <div>
" <br />
" {foo} <--
" text
" {foo} <--
" </div>
if s:is_opening_tag(prev_start_syntax) &&
\ s:syntax_stack_length_compare(
\ prev_lnum, s:start_col(prev_lnum), a:lnum, s:start_col(a:lnum)) == 1
return indent(prev_lnum) + s:sw()
endif
" If current line is the close brace }
if trim(getline(a:lnum)) =~ '^}'
let pair_line = searchpair('{', '', '}', 'bW', 's:skip_if_not(a:lnum, "jsxBraces")')
return indent(pair_line)
endif
" return <div>
" {foo} <--
" </div>
" should not affect
" <div
" // js comment
" {...props} <--
" >
" </div>
if !s:start_with_jsx(prev_lnum) &&
\ !s:is_comment(prev_start_syntax)
return indent(prev_lnum) + s:sw()
endif
return indent(prev_lnum)
endfunction endfunction
" Compute the indentation of the comment " Compute the indentation of the comment
function s:jsx_indent_comment(lnum) function s:jsx_indent_comment(lnum)
let [prev_lnum, prev_start_syntax, prev_end_syntax] = s:prev_info(a:lnum) let line = s:trim(getline(a:lnum))
" If current line is jsxComment
if s:is_jsx_comment(s:start_syntax(a:lnum)) if s:is_jsx_comment(s:start_syntax(a:lnum))
let line = trim(getline(a:lnum)) if line =~ '^<!--' || line =~ '^-->'
if line =~ '^<!--'
" Patch code for yajs.vim
" ${logs.map(log => html`
" <${Log} class="log" ...${log} />
" `)} <-- The backtick here is Highlighted as javascriptTemplate
" <!-- <-- Correct the indentation here
if !s:start_with_jsx(prev_lnum) && s:end_with_jsx(prev_lnum)
return indent(prev_lnum)
endif
" Return the element indent for the opening comment
return s:jsx_indent_element(a:lnum) return s:jsx_indent_element(a:lnum)
elseif line =~ '^-->'
" Return the paired indent for the closing comment
let pair_line = searchpair('<!--', '', '-->', 'bW')
return indent(pair_line)
else else
if trim(getline(prev_lnum)) =~ '^<!--' return s:jsx_indent_element(a:lnum) + s:sw()
" <!-- endif
" comment <-- else
" --> if line =~ '^/\*' || line =~ '^//'
return indent(prev_lnum) + s:sw() return s:jsx_indent_element(a:lnum)
else else
" <!-- return s:jsx_indent_element(a:lnum) + 1
" comment
" comment <--
" -->
return indent(prev_lnum)
endif
endif endif
endif endif
" For comment inside the jsxTag
if s:is_opening_tag(prev_start_syntax)
return indent(prev_lnum) + s:sw()
endif
if trim(getline(a:lnum)) =~ '\*/$'
let pair_line = searchpair('/\*', '', '\*/', 'bW', 's:skip_if_not(a:lnum)')
return indent(pair_line) + 1
endif
return indent(prev_lnum)
endfunction endfunction
" Compute the indentation of jsxBackticks
function s:jsx_indent_backticks(lnum) function s:jsx_indent_backticks(lnum)
let tags = get(g:, 'vim_jsx_pretty_template_tags', ['html', 'jsx']) let tags = get(g:, 'vim_jsx_pretty_template_tags', ['html', 'jsx'])
let start_tag = '\%(' . join(tags, '\|') . '\)`' let start_tag = '\%(' . join(tags, '\|') . '\)`'
@@ -498,116 +187,120 @@ function s:jsx_indent_backticks(lnum)
return indent(pair_line) return indent(pair_line)
endfunction endfunction
" Compute the indentation for the jsx-related element " Syntax context types:
function s:jsx_indent(lnum) " - jsxRegion
let start_syntax = s:start_syntax(a:lnum) " - jsxTaggedRegion
" - jsxElement
" - jsxEscapeJs
" - Other
function s:syntax_context(lnum)
let start_col = s:start_col(a:lnum)
let syntax_stack = s:syntax_stack_at(a:lnum, start_col)
let start_syntax = syntax_stack[-1]
let reversed = reverse(syntax_stack)
let i = 0
if s:is_opening_tag(start_syntax) for syntax_name in reversed
return s:jsx_indent_opening_tag(a:lnum) " If the current line is jsxEscapeJs and not starts with jsxBraces
elseif s:is_closing_tag(start_syntax) if s:is_jsx_escape(syntax_name)
return s:jsx_indent_closing_tag(a:lnum) return 'jsxEscapeJs'
elseif s:is_jsx_attr(start_syntax)
return s:jsx_indent_attr(a:lnum)
elseif s:is_jsx_element(start_syntax)
return s:jsx_indent_element(a:lnum)
elseif s:is_jsx_brace(start_syntax)
return s:jsx_indent_brace(a:lnum)
elseif s:is_jsx_comment(start_syntax)
return s:jsx_indent_comment(a:lnum)
elseif s:is_jsx_backticks(start_syntax)
return s:jsx_indent_backticks(a:lnum)
endif
return -1
endfunction
" Return the jsx context of the specified line
function s:jsx_context(lnum)
if !s:end_with_jsx(prev_lnum)
return 'non-jsx'
endif
let prev_lnum = s:prev_lnum(a:lnum)
let start_syntax = s:start_syntax(prev_lnum)
let end_col = s:end_col(prev_lnum)
let end_syntax_stack = s:syntax_stack_at(prev_lnum, end_col)
let reversed = reverse(end_syntax_stack)
for item in reversed
if item =~? 'jsxEscapeJs'
return 'unknown'
elseif s:is_jsx_element(item) && s:is_jsx(start_syntax) && start_syntax !~? 'jsxEscapeJs'
" <div>
" <br /> <-- press o
" </div>
" --------------------
" <div>
" {
" a > 0 ? 1 <div>|</div> <-- press enter
" }
" </div>
return 'jsxElement'
elseif s:is_jsx_tag(item)
return 'jsxTag'
elseif s:is_jsx_brace(item) && trim(getline(prev_lnum)) =~ '{$'
return 'jsxBraces'
endif
endfor
return 'unknown'
endfunction
function! jsx_pretty#indent#get(js_indent)
" The start column index of the current line (one-based)
let start_col = s:start_col(v:lnum)
" The end column index of the current line (one-based)
let end_col = s:end_col(v:lnum)
if s:start_with_jsx(v:lnum)
let ind = s:jsx_indent(v:lnum)
return ind == -1 ? a:js_indent() : ind
elseif s:is_embedded_comment(v:lnum)
return s:jsx_indent_comment(v:lnum)
else
let line = trim(getline(v:lnum))
let prev_lnum = s:prev_lnum(v:lnum)
" Fix the case where pressing enter at the cursor
" return <div>|</div>
if line =~ '^' . s:end_tag &&
\ s:end_with_jsx(s:prev_lnum(v:lnum))
return s:jsx_indent_closing_tag(v:lnum)
endif endif
" Fix cases for the new line if s:is_jsx_region(syntax_name)
if empty(line) return 'jsxRegion'
let context = s:jsx_context(v:lnum) endif
if context == 'jsxElement' if s:is_jsx_element(syntax_name)
" <div> <-- press o " If current line starts with the opening tag
" </div> if s:is_opening_tag(start_syntax) || s:is_closing_tag(start_syntax)
return s:jsx_indent_element(v:lnum) " And the next syntax is jsxRegion
elseif context == 'jsxTag' if s:is_jsx_region(reversed[i+1])
" <div <-- press o return 'jsxRegion'
" > elseif reversed[i+1] =~ 'jsxTaggedRegion'
" </div> return 'jsxTaggedRegion'
" ----------------------- else
" <div return 'jsxElement'
" attr="attr" <-- press o endif
" > elseif reversed[i+1] =~ 'jsxTaggedRegion'
" </div> return 'jsxTaggedRegion'
return s:jsx_indent_attr(v:lnum) else
elseif context == 'jsxBraces' return 'jsxElement'
" <div>
" { <-- press o
" }
" </div>
return indent(prev_lnum) + s:sw()
endif endif
endif endif
return a:js_indent() let i = i + 1
endfor
return 'Other'
endfunction
function! jsx_pretty#indent#get(js_indent)
let line = s:trim(getline(v:lnum))
let start_syntax = s:start_syntax(v:lnum)
if s:is_jsx_backticks(start_syntax)
return s:jsx_indent_backticks(v:lnum)
endif endif
if s:is_jsx_brace(start_syntax)
return s:jsx_indent_element(v:lnum)
endif
if s:is_opening_tag(start_syntax) && line =~ '^>'
return s:jsx_indent_trail_punct(v:lnum)
endif
let syntax_context = s:syntax_context(v:lnum)
if syntax_context == 'jsxRegion'
if s:is_closing_tag(start_syntax)
return s:jsx_indent_closing_tag(v:lnum)
endif
let prev_lnum = s:prev_lnum(v:lnum)
let prev_line = s:trim(getline(prev_lnum))
if prev_line =~ '[([{=?]$'
return indent(prev_lnum) + s:sw()
elseif prev_line =~ '[:|&<>]$' &&
\ s:trim(getline(s:prev_lnum(prev_lnum))) !~ '[?:|&<>]$'
return indent(prev_lnum) + s:sw()
else
return indent(prev_lnum)
endif
elseif syntax_context == 'jsxTaggedRegion'
if s:is_closing_tag(start_syntax)
return s:jsx_indent_closing_tag(v:lnum)
elseif s:is_jsx_comment(start_syntax)
return s:jsx_indent_comment(v:lnum)
else
return indent(s:prev_lnum(v:lnum)) + s:sw()
endif
elseif syntax_context == 'jsxElement'
if s:is_jsx_comment(start_syntax)
return s:jsx_indent_comment(v:lnum)
endif
if s:is_comment(start_syntax)
return s:jsx_indent_comment(v:lnum)
endif
return s:jsx_indent_element(v:lnum)
elseif syntax_context == 'jsxEscapeJs'
let prev_lnum = s:prev_lnum(v:lnum)
let prev_line = s:trim(getline(prev_lnum))
if line =~ '^?'
return indent(prev_lnum) + s:sw()
elseif line =~ '^:'
return indent(prev_lnum)
else
return a:js_indent()
endif
endif
return a:js_indent()
endfunction endfunction
endif endif

View File

@@ -67,8 +67,8 @@ let s:var_stmt = '^\s*var'
let s:comma_first = '^\s*,' let s:comma_first = '^\s*,'
let s:comma_last = ',\s*$' let s:comma_last = ',\s*$'
let s:ternary = '^\s\+[?|:]' let s:ternary = '^\s\+[?:]'
let s:ternary_q = '^\s\+?' let s:ternary_q = '^\s\+?[.?]\@!'
" 2. Auxiliary Functions {{{1 " 2. Auxiliary Functions {{{1
" ====================== " ======================

View File

@@ -22,7 +22,7 @@ syntax match typescriptProp contained /\K\k*!\?/
syntax region typescriptIndexExpr contained matchgroup=typescriptProperty start=/\[/rs=s+1 end=/]/he=e-1 contains=@typescriptValue nextgroup=@typescriptSymbols,typescriptDotNotation,typescriptFuncCallArg skipwhite skipempty syntax region typescriptIndexExpr contained matchgroup=typescriptProperty start=/\[/rs=s+1 end=/]/he=e-1 contains=@typescriptValue nextgroup=@typescriptSymbols,typescriptDotNotation,typescriptFuncCallArg skipwhite skipempty
syntax match typescriptDotNotation /\./ nextgroup=typescriptProp skipnl syntax match typescriptDotNotation /\.\|?\.\|!\./ nextgroup=typescriptProp skipnl
syntax match typescriptDotStyleNotation /\.style\./ nextgroup=typescriptDOMStyle transparent syntax match typescriptDotStyleNotation /\.style\./ nextgroup=typescriptDOMStyle transparent
" syntax match typescriptFuncCall contained /[a-zA-Z]\k*\ze(/ nextgroup=typescriptFuncCallArg " syntax match typescriptFuncCall contained /[a-zA-Z]\k*\ze(/ nextgroup=typescriptFuncCallArg
syntax region typescriptParenExp matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptComments,@typescriptValue,typescriptCastKeyword nextgroup=@typescriptSymbols skipwhite skipempty syntax region typescriptParenExp matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptComments,@typescriptValue,typescriptCastKeyword nextgroup=@typescriptSymbols skipwhite skipempty

View File

@@ -5,7 +5,7 @@ syntax match typescriptUnaryOp /[+\-~!]/
\ nextgroup=@typescriptValue \ nextgroup=@typescriptValue
\ skipwhite \ skipwhite
syntax region typescriptTernary matchgroup=typescriptTernaryOp start=/?/ end=/:/ contained contains=@typescriptValue,@typescriptComments nextgroup=@typescriptValue skipwhite skipempty syntax region typescriptTernary matchgroup=typescriptTernaryOp start=/?[.?]\@!/ end=/:/ contained contains=@typescriptValue,@typescriptComments nextgroup=@typescriptValue skipwhite skipempty
syntax match typescriptAssign /=/ nextgroup=@typescriptValue syntax match typescriptAssign /=/ nextgroup=@typescriptValue
\ skipwhite skipempty \ skipwhite skipempty

View File

@@ -34,7 +34,7 @@ syn match gitDiffRemoved "\[-.*-\]" contained containedin=gitDiff
syn match gitKeyword /^\%(object\|type\|tag\|commit\|tree\|parent\|encoding\)\>/ contained containedin=gitHead nextgroup=gitHash,gitType skipwhite syn match gitKeyword /^\%(object\|type\|tag\|commit\|tree\|parent\|encoding\)\>/ contained containedin=gitHead nextgroup=gitHash,gitType skipwhite
syn match gitKeyword /^\%(tag\>\|ref:\)/ contained containedin=gitHead nextgroup=gitReference skipwhite syn match gitKeyword /^\%(tag\>\|ref:\)/ contained containedin=gitHead nextgroup=gitReference skipwhite
syn match gitKeyword /^Merge:/ contained containedin=gitHead nextgroup=gitHashAbbrev skipwhite syn match gitKeyword /^Merge:/ contained containedin=gitHead nextgroup=gitHashAbbrev skipwhite
syn match gitMode /^\d\{6\}/ contained containedin=gitHead nextgroup=gitType,gitHash skipwhite syn match gitMode /^\d\{6\}\>/ contained containedin=gitHead nextgroup=gitType,gitHash skipwhite
syn match gitIdentityKeyword /^\%(author\|committer\|tagger\)\>/ contained containedin=gitHead nextgroup=gitIdentity skipwhite syn match gitIdentityKeyword /^\%(author\|committer\|tagger\)\>/ contained containedin=gitHead nextgroup=gitIdentity skipwhite
syn match gitIdentityHeader /^\%(Author\|Commit\|Tagger\):/ contained containedin=gitHead nextgroup=gitIdentity skipwhite syn match gitIdentityHeader /^\%(Author\|Commit\|Tagger\):/ contained containedin=gitHead nextgroup=gitIdentity skipwhite
syn match gitDateHeader /^\%(AuthorDate\|CommitDate\|Date\):/ contained containedin=gitHead nextgroup=gitDate skipwhite syn match gitDateHeader /^\%(AuthorDate\|CommitDate\|Date\):/ contained containedin=gitHead nextgroup=gitDate skipwhite

View File

@@ -164,11 +164,11 @@ endif
syn match goSingleDecl /\%(import\|var\|const\) [^(]\@=/ contains=goImport,goVar,goConst syn match goSingleDecl /\%(import\|var\|const\) [^(]\@=/ contains=goImport,goVar,goConst
" Integers " Integers
syn match goDecimalInt "\<-\=\d\+\%([Ee][-+]\=\d\+\)\=\>" syn match goDecimalInt "\<-\=\(0\|[1-9]\d*\)\%([Ee][-+]\=\d\+\)\=\>"
syn match goHexadecimalInt "\<-\=0[xX]\x\+\>" syn match goHexadecimalInt "\<-\=0[xX]\x\+\>"
syn match goHexadecimalError "\<-\=0[xX]\x*[^ \t0-9A-Fa-f]\S*\>" syn match goHexadecimalError "\<-\=0[xX]\x*[^ \t0-9A-Fa-f]\S*\>"
syn match goOctalInt "\<-\=0\o\+\>" syn match goOctalInt "\<-\=0\o\+\>"
syn match goOctalError "\<-\=0[^XxBb]\o*[^ \t0-7]\S*\>" syn match goOctalError "\<-\=0[XxBb\]]\@!\o*[^ \t0-7]\S*\>"
syn match goBinaryInt "\<-\=0[bB][01]\+\>" syn match goBinaryInt "\<-\=0[bB][01]\+\>"
syn match goBinaryError "\<-\=0[bB][01]*[^ \t01]\S*\>" syn match goBinaryError "\<-\=0[bB][01]*[^ \t01]\S*\>"

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tmux') == -1 if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tmux') == -1
" Language: tmux(1) configuration file " Language: tmux(1) configuration file
" Version: 2.9a (git-0d64531f) " Version: 3.0 (git-48cbbb87)
" URL: https://github.com/ericpruitt/tmux.vim/ " URL: https://github.com/ericpruitt/tmux.vim/
" Maintainer: Eric Pruitt <eric.pruitt@gmail.com> " Maintainer: Eric Pruitt <eric.pruitt@gmail.com>
" License: 2-Clause BSD (http://opensource.org/licenses/BSD-2-Clause) " License: 2-Clause BSD (http://opensource.org/licenses/BSD-2-Clause)
@@ -66,29 +66,29 @@ for s:i in range(0, 255)
endfor endfor
syn keyword tmuxOptions syn keyword tmuxOptions
\ buffer-limit command-alias default-terminal escape-time exit-empty \ backspace buffer-limit command-alias default-terminal escape-time
\ activity-action assume-paste-time base-index bell-action default-command \ exit-empty activity-action assume-paste-time base-index bell-action
\ default-shell default-size destroy-unattached detach-on-destroy \ default-command default-shell default-size destroy-unattached
\ display-panes-active-colour display-panes-colour display-panes-time \ detach-on-destroy display-panes-active-colour display-panes-colour
\ display-time exit-unattached focus-events history-file history-limit \ display-panes-time display-time exit-unattached focus-events history-file
\ key-table lock-after-time lock-command message-command-style message-limit \ history-limit key-table lock-after-time lock-command message-command-style
\ message-style mouse aggressive-resize allow-rename alternate-screen \ message-limit message-style aggressive-resize allow-rename
\ automatic-rename automatic-rename-format clock-mode-colour \ alternate-screen automatic-rename automatic-rename-format
\ clock-mode-style main-pane-height main-pane-width mode-keys mode-style \ clock-mode-colour clock-mode-style main-pane-height main-pane-width
\ monitor-activity monitor-bell monitor-silence other-pane-height \ mode-keys mode-style monitor-activity monitor-bell monitor-silence mouse
\ other-pane-width pane-active-border-style pane-base-index \ other-pane-height other-pane-width pane-active-border-style
\ pane-border-format pane-border-status pane-border-style prefix prefix2 \ pane-base-index pane-border-format pane-border-status pane-border-style
\ remain-on-exit renumber-windows repeat-time set-clipboard set-titles \ prefix prefix2 remain-on-exit renumber-windows repeat-time set-clipboard
\ set-titles-string silence-action status status-bg status-fg status-format \ set-titles set-titles-string silence-action status status-bg status-fg
\ status-interval status-justify status-keys status-left status-left-length \ status-format status-interval status-justify status-keys status-left
\ status-left-style status-position status-right status-right-length \ status-left-length status-left-style status-position status-right
\ status-right-style status-style synchronize-panes terminal-overrides \ status-right-length status-right-style status-style synchronize-panes
\ update-environment user-keys visual-activity visual-bell visual-silence \ terminal-overrides update-environment user-keys visual-activity
\ window-active-style window-size window-status-activity-style \ visual-bell visual-silence window-active-style window-size
\ window-status-bell-style window-status-current-format \ window-status-activity-style window-status-bell-style
\ window-status-current-style window-status-format window-status-last-style \ window-status-current-format window-status-current-style
\ window-status-separator window-status-style window-style word-separators \ window-status-format window-status-last-style window-status-separator
\ wrap-search xterm-keys \ window-status-style window-style word-separators wrap-search xterm-keys
syn keyword tmuxCommands syn keyword tmuxCommands
\ attach attach-session bind bind-key break-pane breakp capture-pane \ attach attach-session bind bind-key break-pane breakp capture-pane