mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-10 12:33:51 -05:00
Update
This commit is contained in:
@@ -21,7 +21,7 @@ if exists('s:did_indent')
|
||||
endif
|
||||
|
||||
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()
|
||||
return jsx_pretty#indent#get(function('GetJavascriptIndent'))
|
||||
|
||||
@@ -26,7 +26,7 @@ if exists('s:did_indent')
|
||||
endif
|
||||
|
||||
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()
|
||||
return jsx_pretty#indent#get(function('GetTypescriptIndent'))
|
||||
|
||||
@@ -36,6 +36,19 @@ if exists('g:cpp_member_variable_highlight') && g:cpp_member_variable_highlight
|
||||
hi def link cCustomMemVar Function
|
||||
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
|
||||
" -----------------------------------------------------------------------------
|
||||
|
||||
@@ -633,21 +633,19 @@ syntax keyword cppSTLios unitbuf
|
||||
syntax keyword cppSTLios uppercase
|
||||
"syntax keyword cppSTLios ws
|
||||
syntax keyword cppSTLiterator back_insert_iterator
|
||||
syntax keyword cppSTLiterator bidirectional_iterator
|
||||
syntax keyword cppSTLiterator const_iterator
|
||||
syntax keyword cppSTLiterator const_reverse_iterator
|
||||
syntax keyword cppSTLiterator forward_iterator
|
||||
syntax keyword cppSTLiterator front_insert_iterator
|
||||
syntax keyword cppSTLiterator input_iterator
|
||||
syntax keyword cppSTLiterator insert_iterator
|
||||
syntax keyword cppSTLiterator istreambuf_iterator
|
||||
syntax keyword cppSTLiterator istream_iterator
|
||||
syntax keyword cppSTLiterator ostreambuf_iterator
|
||||
syntax keyword cppSTLiterator ostream_iterator
|
||||
syntax keyword cppSTLiterator iterator
|
||||
syntax keyword cppSTLiterator ostream_iterator
|
||||
syntax keyword cppSTLiterator output_iterator
|
||||
syntax keyword cppSTLiterator random_access_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_tag bidirectional_iterator_tag
|
||||
syntax keyword cppSTLiterator_tag forward_iterator_tag
|
||||
@@ -1593,6 +1591,8 @@ endif " C++14
|
||||
|
||||
|
||||
if !exists("cpp_no_cpp17")
|
||||
syntax keyword cppSTLnamespace pmr
|
||||
|
||||
" algorithm
|
||||
syntax keyword cppSTLfunction clamp
|
||||
syntax keyword cppSTLfunction for_each_n
|
||||
@@ -1985,87 +1985,278 @@ endif " C++17
|
||||
|
||||
|
||||
if !exists("cpp_no_cpp20")
|
||||
" type_traits
|
||||
syntax keyword cppSTLtype remove_cvref remove_cvref_t
|
||||
syntax keyword cppType char8_t
|
||||
syntax keyword cppStatement co_yield co_return co_await
|
||||
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
|
||||
|
||||
|
||||
if exists('g:cpp_concepts_highlight') && g:cpp_concepts_highlight
|
||||
if exists('g:cpp_concepts_highlight')
|
||||
syntax keyword cppStatement concept
|
||||
syntax keyword cppStorageClass requires
|
||||
syntax keyword cppSTLtype DefaultConstructible
|
||||
syntax keyword cppSTLtype MoveConstructible
|
||||
syntax keyword cppSTLtype CopyConstructible
|
||||
syntax keyword cppSTLtype MoveAssignable
|
||||
syntax keyword cppSTLtype CopyAssignable
|
||||
syntax keyword cppSTLtype Destructible
|
||||
syntax keyword cppSTLtype TriviallyCopyable
|
||||
syntax keyword cppSTLtype TrivialType
|
||||
syntax keyword cppSTLtype StandardLayoutType
|
||||
syntax keyword cppSTLtype PODType
|
||||
syntax keyword cppSTLtype EqualityComparable
|
||||
syntax keyword cppSTLtype LessThanComparable
|
||||
syntax keyword cppSTLtype Swappable
|
||||
syntax keyword cppSTLtype ValueSwappable
|
||||
syntax keyword cppSTLtype NullablePointer
|
||||
syntax keyword cppSTLtype Hash
|
||||
syntax keyword cppSTLtype Allocator
|
||||
syntax keyword cppSTLtype FunctionObject
|
||||
syntax keyword cppSTLtype Callable
|
||||
syntax keyword cppSTLtype Predicate
|
||||
syntax keyword cppSTLtype BinaryPredicate
|
||||
syntax keyword cppSTLtype Compare
|
||||
syntax keyword cppSTLtype Container
|
||||
syntax keyword cppSTLtype ReversibleContainer
|
||||
syntax keyword cppSTLtype AllocatorAwareContainer
|
||||
syntax keyword cppSTLtype SequenceContainer
|
||||
syntax keyword cppSTLtype ContiguousContainer
|
||||
syntax keyword cppSTLtype AssociativeContainer
|
||||
syntax keyword cppSTLtype UnorderedAssociativeContainer
|
||||
syntax keyword cppSTLtype DefaultInsertable
|
||||
syntax keyword cppSTLtype CopyInsertable
|
||||
syntax keyword cppSTLtype CopyInsertable
|
||||
syntax keyword cppSTLtype MoveInsertable
|
||||
syntax keyword cppSTLtype EmplaceConstructible
|
||||
syntax keyword cppSTLtype Erasable
|
||||
syntax keyword cppSTLtype Iterator
|
||||
syntax keyword cppSTLtype InputIterator
|
||||
syntax keyword cppSTLtype OutputIterator
|
||||
syntax keyword cppSTLtype ForwardIterator
|
||||
syntax keyword cppSTLtype BidirectionalIterator
|
||||
syntax keyword cppSTLtype RandomAccessIterator
|
||||
syntax keyword cppSTLtype ContiguousIterator
|
||||
syntax keyword cppSTLtype UnformattedInputFunction
|
||||
syntax keyword cppSTLtype FormattedInputFunction
|
||||
syntax keyword cppSTLtype UnformattedOutputFunction
|
||||
syntax keyword cppSTLtype FormattedOutputFunction
|
||||
syntax keyword cppSTLtype SeedSequence
|
||||
syntax keyword cppSTLtype UniformRandomBitGenerator
|
||||
syntax keyword cppSTLtype RandomNumberEngine
|
||||
syntax keyword cppSTLtype RandomNumberEngineAdaptor
|
||||
syntax keyword cppSTLtype RandomNumberDistribution
|
||||
syntax keyword cppSTLtype BasicLockable
|
||||
syntax keyword cppSTLtype Lockable
|
||||
syntax keyword cppSTLtype TimedLockable
|
||||
syntax keyword cppSTLtype Mutex
|
||||
syntax keyword cppSTLtype TimedMutex
|
||||
syntax keyword cppSTLtype SharedMutex
|
||||
syntax keyword cppSTLtype SharedTimedMutex
|
||||
syntax keyword cppSTLtype UnaryTypeTrait
|
||||
syntax keyword cppSTLtype BinaryTypeTrait
|
||||
syntax keyword cppSTLtype TransformationTrait
|
||||
syntax keyword cppSTLtype Clock
|
||||
syntax keyword cppSTLtype TrivialClock
|
||||
syntax keyword cppSTLtype CharTraits
|
||||
syntax keyword cppSTLtype pos_type
|
||||
syntax keyword cppSTLtype off_type
|
||||
syntax keyword cppSTLtype BitmaskType
|
||||
syntax keyword cppSTLtype NumericType
|
||||
syntax keyword cppSTLtype RegexTraits
|
||||
syntax keyword cppSTLtype LiteralType
|
||||
|
||||
if g:cpp_concepts_highlight == 1
|
||||
syntax keyword cppSTLconcept DefaultConstructible
|
||||
syntax keyword cppSTLconcept MoveConstructible
|
||||
syntax keyword cppSTLconcept CopyConstructible
|
||||
syntax keyword cppSTLconcept MoveAssignable
|
||||
syntax keyword cppSTLconcept CopyAssignable
|
||||
syntax keyword cppSTLconcept Destructible
|
||||
syntax keyword cppSTLconcept TriviallyCopyable
|
||||
syntax keyword cppSTLconcept TrivialType
|
||||
syntax keyword cppSTLconcept StandardLayoutType
|
||||
syntax keyword cppSTLconcept PODType
|
||||
syntax keyword cppSTLconcept EqualityComparable
|
||||
syntax keyword cppSTLconcept LessThanComparable
|
||||
syntax keyword cppSTLconcept Swappable
|
||||
syntax keyword cppSTLconcept ValueSwappable
|
||||
syntax keyword cppSTLconcept NullablePointer
|
||||
syntax keyword cppSTLconcept Hash
|
||||
syntax keyword cppSTLconcept Allocator
|
||||
syntax keyword cppSTLconcept FunctionObject
|
||||
syntax keyword cppSTLconcept Callable
|
||||
syntax keyword cppSTLconcept Predicate
|
||||
syntax keyword cppSTLconcept BinaryPredicate
|
||||
syntax keyword cppSTLconcept Compare
|
||||
syntax keyword cppSTLconcept Container
|
||||
syntax keyword cppSTLconcept ReversibleContainer
|
||||
syntax keyword cppSTLconcept AllocatorAwareContainer
|
||||
syntax keyword cppSTLconcept SequenceContainer
|
||||
syntax keyword cppSTLconcept ContiguousContainer
|
||||
syntax keyword cppSTLconcept AssociativeContainer
|
||||
syntax keyword cppSTLconcept UnorderedAssociativeContainer
|
||||
syntax keyword cppSTLconcept DefaultInsertable
|
||||
syntax keyword cppSTLconcept CopyInsertable
|
||||
syntax keyword cppSTLconcept CopyInsertable
|
||||
syntax keyword cppSTLconcept MoveInsertable
|
||||
syntax keyword cppSTLconcept EmplaceConstructible
|
||||
syntax keyword cppSTLconcept Erasable
|
||||
syntax keyword cppSTLconcept Iterator
|
||||
syntax keyword cppSTLconcept InputIterator
|
||||
syntax keyword cppSTLconcept OutputIterator
|
||||
syntax keyword cppSTLconcept ForwardIterator
|
||||
syntax keyword cppSTLconcept BidirectionalIterator
|
||||
syntax keyword cppSTLconcept RandomAccessIterator
|
||||
syntax keyword cppSTLconcept ContiguousIterator
|
||||
syntax keyword cppSTLconcept UnformattedInputFunction
|
||||
syntax keyword cppSTLconcept FormattedInputFunction
|
||||
syntax keyword cppSTLconcept UnformattedOutputFunction
|
||||
syntax keyword cppSTLconcept FormattedOutputFunction
|
||||
syntax keyword cppSTLconcept SeedSequence
|
||||
syntax keyword cppSTLconcept UniformRandomBitGenerator
|
||||
syntax keyword cppSTLconcept RandomNumberEngine
|
||||
syntax keyword cppSTLconcept RandomNumberEngineAdaptor
|
||||
syntax keyword cppSTLconcept RandomNumberDistribution
|
||||
syntax keyword cppSTLconcept BasicLockable
|
||||
syntax keyword cppSTLconcept Lockable
|
||||
syntax keyword cppSTLconcept TimedLockable
|
||||
syntax keyword cppSTLconcept Mutex
|
||||
syntax keyword cppSTLconcept TimedMutex
|
||||
syntax keyword cppSTLconcept SharedMutex
|
||||
syntax keyword cppSTLconcept SharedTimedMutex
|
||||
syntax keyword cppSTLconcept UnaryTypeTrait
|
||||
syntax keyword cppSTLconcept BinaryTypeTrait
|
||||
syntax keyword cppSTLconcept TransformationTrait
|
||||
syntax keyword cppSTLconcept Clock
|
||||
syntax keyword cppSTLconcept TrivialClock
|
||||
syntax keyword cppSTLconcept CharTraits
|
||||
syntax keyword cppSTLconcept pos_type
|
||||
syntax keyword cppSTLconcept off_type
|
||||
syntax keyword cppSTLconcept BitmaskType
|
||||
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
|
||||
|
||||
|
||||
@@ -2095,6 +2286,7 @@ if version >= 508 || !exists("did_cpp_syntax_inits")
|
||||
HiLink cppSTLiterator Typedef
|
||||
HiLink cppSTLiterator_tag Typedef
|
||||
HiLink cppSTLenum Typedef
|
||||
HiLink cppSTLconcept Typedef
|
||||
HiLink cppSTLios Function
|
||||
HiLink cppSTLcast Statement " be consistent with official syntax
|
||||
HiLink cppRawString String
|
||||
|
||||
@@ -368,6 +368,11 @@ function! go#config#PlayOpenBrowser() abort
|
||||
return get(g:, "go_play_open_browser", 1)
|
||||
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
|
||||
return get(g:, "go_gorename_bin", "gorename")
|
||||
endfunction
|
||||
|
||||
@@ -15,6 +15,10 @@ let s:start_tag = '<\_s*\%(>\|\${\|\%(\<[-:._$A-Za-z0-9]\+\>\)\)'
|
||||
" Regexp for the end tag
|
||||
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
|
||||
function s:syntax_stack_at(lnum, col)
|
||||
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
|
||||
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
|
||||
function s:start_syntax(lnum)
|
||||
return s:syntax_at(a:lnum, s:start_col(a:lnum))
|
||||
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
|
||||
function s:skip_if_not(current_lnum, ...)
|
||||
" Skip the match in current line
|
||||
@@ -57,47 +50,6 @@ function s:skip_if_not(current_lnum, ...)
|
||||
return syntax !~? join(a:000, '\|')
|
||||
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
|
||||
function s:is_opening_tag(syntax)
|
||||
return a:syntax =~? 'jsxOpenPunct'
|
||||
@@ -108,9 +60,9 @@ function s:is_closing_tag(syntax)
|
||||
return a:syntax =~? 'jsxClose'
|
||||
endfunction
|
||||
|
||||
" Whether the specified stytax group is the jsxAttrib
|
||||
function s:is_jsx_attr(syntax)
|
||||
return a:syntax =~? 'jsxAttrib'
|
||||
" Whether the specified syntax group is the jsxRegion
|
||||
function s:is_jsx_region(syntax)
|
||||
return a:syntax =~? 'jsxRegion'
|
||||
endfunction
|
||||
|
||||
" Whether the specified syntax group is the jsxElement
|
||||
@@ -118,9 +70,9 @@ function s:is_jsx_element(syntax)
|
||||
return a:syntax =~? 'jsxElement'
|
||||
endfunction
|
||||
|
||||
" Whether the specified syntax group is the jsxTag
|
||||
function s:is_jsx_tag(syntax)
|
||||
return a:syntax =~? 'jsxTag'
|
||||
" Whether the specified syntax group is the jsxEscapeJs
|
||||
function s:is_jsx_escape(syntax)
|
||||
return a:syntax =~? 'jsxEscapeJs'
|
||||
endfunction
|
||||
|
||||
" Whether the specified syntax group is the jsxBraces
|
||||
@@ -133,6 +85,11 @@ function s:is_jsx_comment(syntax)
|
||||
return a:syntax =~? 'jsxComment'
|
||||
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
|
||||
function s:is_jsx_backticks(syntax)
|
||||
return a:syntax =~? 'jsxBackticks'
|
||||
@@ -143,155 +100,18 @@ function s:prev_lnum(lnum)
|
||||
return prevnonblank(a:lnum - 1)
|
||||
endfunction
|
||||
|
||||
" Given a lnum and get the information of its previous line
|
||||
function s:prev_info(lnum)
|
||||
let prev_lnum = s:prev_lnum(a:lnum)
|
||||
let prev_start_syntax = s:start_syntax(prev_lnum)
|
||||
let prev_end_syntax = s:end_syntax(prev_lnum)
|
||||
|
||||
return [prev_lnum, prev_start_syntax, prev_end_syntax]
|
||||
" Whether the given pos is the parent of the given element who has
|
||||
" element_count jsxElement syntax
|
||||
function s:is_parent_element(pos, element_count)
|
||||
let syntax_stack = s:syntax_stack_at(a:pos[0], a:pos[1])
|
||||
return s:is_opening_tag(syntax_stack[-1]) &&
|
||||
\ count(syntax_stack, 'jsxElement') <= a:element_count
|
||||
endfunction
|
||||
|
||||
" Get the length difference between syntax stack a and b
|
||||
function s:syntax_stack_length_compare(lnum_a, col_a, lnum_b, col_b)
|
||||
let stack_a = s:syntax_stack_at(a:lnum_a, a:col_a)
|
||||
let stack_b = s:syntax_stack_at(a:lnum_b, a:col_b)
|
||||
|
||||
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)) =~ '^>'
|
||||
" Compute the indention of the trail punct
|
||||
function s:jsx_indent_trail_punct(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
|
||||
|
||||
" 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)
|
||||
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
|
||||
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
|
||||
" <div|> <-- press enter
|
||||
" should indent as
|
||||
" <div
|
||||
" > <--
|
||||
if trim(getline(a:lnum)) =~ '^>' && !s:is_opening_tag(prev_end_syntax)
|
||||
return indent(prev_lnum)
|
||||
if s:trim(getline(a:lnum)) =~ '^>'
|
||||
return s:jsx_indent_trail_punct(a:lnum)
|
||||
endif
|
||||
|
||||
" If the start of the previous line is start with >
|
||||
" <div
|
||||
" attr="foo"
|
||||
" >
|
||||
" text <--
|
||||
" </div>
|
||||
if s:is_opening_tag(prev_start_syntax) &&
|
||||
\ trim(getline(prev_lnum)) =~ '^>$'
|
||||
return indent(prev_lnum) + s:sw()
|
||||
" If current tag is closing tag
|
||||
if s:is_closing_tag(syntax_name)
|
||||
return s:jsx_indent_closing_tag(a:lnum)
|
||||
endif
|
||||
|
||||
" Normalize the jsxElement count for opening tag
|
||||
if s:is_opening_tag(syntax_name)
|
||||
" <div>
|
||||
" text <--
|
||||
" <div></div> <-- jsxRegion->jsxElement->jsxElement->jsxTag->jsxOpenTag->jsxOpenPunct
|
||||
" </div>
|
||||
" should not affect case like
|
||||
" <div>
|
||||
" <br />
|
||||
" hello <--
|
||||
" </div>
|
||||
if s:is_opening_tag(prev_start_syntax) &&
|
||||
\ s:is_element_of(prev_lnum, a:lnum)
|
||||
return indent(prev_lnum) + s:sw()
|
||||
if s:is_jsx_element(syntax_stack[-4]) && s:is_jsx_element(syntax_stack[-5])
|
||||
let element_count = element_count - 1
|
||||
endif
|
||||
endif
|
||||
|
||||
" return <div>
|
||||
" text <--
|
||||
" </div>
|
||||
if !s:start_with_jsx(prev_lnum)
|
||||
return indent(prev_lnum) + s:sw()
|
||||
let start_time = localtime()
|
||||
let pos = searchpos(s:start_tag, 'bW')
|
||||
|
||||
while !s:is_parent_element(pos, element_count)
|
||||
if localtime() - start_time >= 0.5
|
||||
return -1
|
||||
endif
|
||||
let pos = searchpos(s:start_tag, 'bW')
|
||||
endwhile
|
||||
|
||||
" Otherwise, align with the previous line
|
||||
" <div>
|
||||
" {foo}
|
||||
" text <--
|
||||
" </div>
|
||||
return indent(prev_lnum)
|
||||
endfunction
|
||||
|
||||
" Compute the indentation of jsxBraces
|
||||
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)
|
||||
return indent(pos[0]) + s:sw()
|
||||
endfunction
|
||||
|
||||
" Compute the indentation of the comment
|
||||
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))
|
||||
let line = trim(getline(a:lnum))
|
||||
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
|
||||
if line =~ '^<!--' || line =~ '^-->'
|
||||
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
|
||||
if trim(getline(prev_lnum)) =~ '^<!--'
|
||||
" <!--
|
||||
" comment <--
|
||||
" -->
|
||||
return indent(prev_lnum) + s:sw()
|
||||
return s:jsx_indent_element(a:lnum) + s:sw()
|
||||
endif
|
||||
else
|
||||
" <!--
|
||||
" comment
|
||||
" comment <--
|
||||
" -->
|
||||
return indent(prev_lnum)
|
||||
if line =~ '^/\*' || line =~ '^//'
|
||||
return s:jsx_indent_element(a:lnum)
|
||||
else
|
||||
return s:jsx_indent_element(a:lnum) + 1
|
||||
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
|
||||
|
||||
" Compute the indentation of jsxBackticks
|
||||
function s:jsx_indent_backticks(lnum)
|
||||
let tags = get(g:, 'vim_jsx_pretty_template_tags', ['html', 'jsx'])
|
||||
let start_tag = '\%(' . join(tags, '\|') . '\)`'
|
||||
@@ -498,116 +187,120 @@ function s:jsx_indent_backticks(lnum)
|
||||
return indent(pair_line)
|
||||
endfunction
|
||||
|
||||
" Compute the indentation for the jsx-related element
|
||||
function s:jsx_indent(lnum)
|
||||
let start_syntax = s:start_syntax(a:lnum)
|
||||
" Syntax context types:
|
||||
" - jsxRegion
|
||||
" - 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)
|
||||
return s:jsx_indent_opening_tag(a:lnum)
|
||||
elseif s:is_closing_tag(start_syntax)
|
||||
return s:jsx_indent_closing_tag(a:lnum)
|
||||
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)
|
||||
for syntax_name in reversed
|
||||
" If the current line is jsxEscapeJs and not starts with jsxBraces
|
||||
if s:is_jsx_escape(syntax_name)
|
||||
return 'jsxEscapeJs'
|
||||
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'
|
||||
if s:is_jsx_region(syntax_name)
|
||||
return 'jsxRegion'
|
||||
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>
|
||||
if s:is_jsx_element(syntax_name)
|
||||
" If current line starts with the opening tag
|
||||
if s:is_opening_tag(start_syntax) || s:is_closing_tag(start_syntax)
|
||||
" And the next syntax is jsxRegion
|
||||
if s:is_jsx_region(reversed[i+1])
|
||||
return 'jsxRegion'
|
||||
elseif reversed[i+1] =~ 'jsxTaggedRegion'
|
||||
return 'jsxTaggedRegion'
|
||||
else
|
||||
return 'jsxElement'
|
||||
elseif s:is_jsx_tag(item)
|
||||
return 'jsxTag'
|
||||
elseif s:is_jsx_brace(item) && trim(getline(prev_lnum)) =~ '{$'
|
||||
return 'jsxBraces'
|
||||
endif
|
||||
elseif reversed[i+1] =~ 'jsxTaggedRegion'
|
||||
return 'jsxTaggedRegion'
|
||||
else
|
||||
return 'jsxElement'
|
||||
endif
|
||||
endif
|
||||
|
||||
let i = i + 1
|
||||
endfor
|
||||
|
||||
return 'unknown'
|
||||
return 'Other'
|
||||
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)
|
||||
let line = s:trim(getline(v:lnum))
|
||||
let start_syntax = s:start_syntax(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)
|
||||
if s:is_jsx_backticks(start_syntax)
|
||||
return s:jsx_indent_backticks(v:lnum)
|
||||
endif
|
||||
|
||||
" 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))
|
||||
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
|
||||
|
||||
" Fix cases for the new line
|
||||
if empty(line)
|
||||
let context = s:jsx_context(v:lnum)
|
||||
let prev_lnum = s:prev_lnum(v:lnum)
|
||||
let prev_line = s:trim(getline(prev_lnum))
|
||||
|
||||
if context == 'jsxElement'
|
||||
" <div> <-- press o
|
||||
" </div>
|
||||
return s:jsx_indent_element(v:lnum)
|
||||
elseif context == 'jsxTag'
|
||||
" <div <-- press o
|
||||
" >
|
||||
" </div>
|
||||
" -----------------------
|
||||
" <div
|
||||
" attr="attr" <-- press o
|
||||
" >
|
||||
" </div>
|
||||
return s:jsx_indent_attr(v:lnum)
|
||||
elseif context == 'jsxBraces'
|
||||
" <div>
|
||||
" { <-- press o
|
||||
" }
|
||||
" </div>
|
||||
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()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
endif
|
||||
|
||||
@@ -67,8 +67,8 @@ let s:var_stmt = '^\s*var'
|
||||
let s:comma_first = '^\s*,'
|
||||
let s:comma_last = ',\s*$'
|
||||
|
||||
let s:ternary = '^\s\+[?|:]'
|
||||
let s:ternary_q = '^\s\+?'
|
||||
let s:ternary = '^\s\+[?:]'
|
||||
let s:ternary_q = '^\s\+?[.?]\@!'
|
||||
|
||||
" 2. Auxiliary Functions {{{1
|
||||
" ======================
|
||||
|
||||
@@ -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 match typescriptDotNotation /\./ nextgroup=typescriptProp skipnl
|
||||
syntax match typescriptDotNotation /\.\|?\.\|!\./ nextgroup=typescriptProp skipnl
|
||||
syntax match typescriptDotStyleNotation /\.style\./ nextgroup=typescriptDOMStyle transparent
|
||||
" 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
|
||||
|
||||
@@ -5,7 +5,7 @@ syntax match typescriptUnaryOp /[+\-~!]/
|
||||
\ nextgroup=@typescriptValue
|
||||
\ 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
|
||||
\ skipwhite skipempty
|
||||
|
||||
@@ -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 /^\%(tag\>\|ref:\)/ contained containedin=gitHead nextgroup=gitReference 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 gitIdentityHeader /^\%(Author\|Commit\|Tagger\):/ contained containedin=gitHead nextgroup=gitIdentity skipwhite
|
||||
syn match gitDateHeader /^\%(AuthorDate\|CommitDate\|Date\):/ contained containedin=gitHead nextgroup=gitDate skipwhite
|
||||
|
||||
@@ -164,11 +164,11 @@ endif
|
||||
syn match goSingleDecl /\%(import\|var\|const\) [^(]\@=/ contains=goImport,goVar,goConst
|
||||
|
||||
" Integers
|
||||
syn match goDecimalInt "\<-\=\d\+\%([Ee][-+]\=\d\+\)\=\>"
|
||||
syn match goDecimalInt "\<-\=\(0\|[1-9]\d*\)\%([Ee][-+]\=\d\+\)\=\>"
|
||||
syn match goHexadecimalInt "\<-\=0[xX]\x\+\>"
|
||||
syn match goHexadecimalError "\<-\=0[xX]\x*[^ \t0-9A-Fa-f]\S*\>"
|
||||
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 goBinaryError "\<-\=0[bB][01]*[^ \t01]\S*\>"
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'tmux') == -1
|
||||
|
||||
" Language: tmux(1) configuration file
|
||||
" Version: 2.9a (git-0d64531f)
|
||||
" Version: 3.0 (git-48cbbb87)
|
||||
" 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)
|
||||
@@ -66,29 +66,29 @@ for s:i in range(0, 255)
|
||||
endfor
|
||||
|
||||
syn keyword tmuxOptions
|
||||
\ buffer-limit command-alias default-terminal escape-time exit-empty
|
||||
\ activity-action assume-paste-time base-index bell-action default-command
|
||||
\ default-shell default-size destroy-unattached detach-on-destroy
|
||||
\ display-panes-active-colour display-panes-colour display-panes-time
|
||||
\ display-time exit-unattached focus-events history-file history-limit
|
||||
\ key-table lock-after-time lock-command message-command-style message-limit
|
||||
\ message-style mouse aggressive-resize allow-rename alternate-screen
|
||||
\ automatic-rename automatic-rename-format clock-mode-colour
|
||||
\ clock-mode-style main-pane-height main-pane-width mode-keys mode-style
|
||||
\ monitor-activity monitor-bell monitor-silence other-pane-height
|
||||
\ other-pane-width pane-active-border-style pane-base-index
|
||||
\ pane-border-format pane-border-status pane-border-style prefix prefix2
|
||||
\ 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-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 window-status-style window-style word-separators
|
||||
\ wrap-search xterm-keys
|
||||
\ backspace buffer-limit command-alias default-terminal escape-time
|
||||
\ exit-empty activity-action assume-paste-time base-index bell-action
|
||||
\ default-command default-shell default-size destroy-unattached
|
||||
\ detach-on-destroy display-panes-active-colour display-panes-colour
|
||||
\ display-panes-time display-time exit-unattached focus-events history-file
|
||||
\ history-limit key-table lock-after-time lock-command message-command-style
|
||||
\ message-limit message-style aggressive-resize allow-rename
|
||||
\ alternate-screen automatic-rename automatic-rename-format
|
||||
\ clock-mode-colour clock-mode-style main-pane-height main-pane-width
|
||||
\ mode-keys mode-style monitor-activity monitor-bell monitor-silence mouse
|
||||
\ other-pane-height other-pane-width pane-active-border-style
|
||||
\ pane-base-index pane-border-format pane-border-status pane-border-style
|
||||
\ prefix prefix2 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-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
|
||||
\ window-status-style window-style word-separators wrap-search xterm-keys
|
||||
|
||||
syn keyword tmuxCommands
|
||||
\ attach attach-session bind bind-key break-pane breakp capture-pane
|
||||
|
||||
Reference in New Issue
Block a user