├── CMakeLists.txt ├── README.md ├── ftdetect ├── sil.vim ├── swift.vim └── swiftgyb.vim ├── ftplugin ├── swift.vim └── swiftgyb.vim ├── swift-format.py └── syntax ├── sil.vim ├── swift.vim └── swiftgyb.vim /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | swift_install_in_component(DIRECTORY 2 | ftdetect 3 | syntax 4 | DESTINATION "share/vim/vim73" 5 | COMPONENT editor-integration 6 | PATTERN ".*" EXCLUDE) 7 | 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Install 2 | 3 | 4 | Install the plugin as you would this plugin (Vundle example): 5 | 6 | ``` 7 | Plugin 'bumaociyuan/vim-swift' 8 | ``` 9 | -------------------------------------------------------------------------------- /ftdetect/sil.vim: -------------------------------------------------------------------------------- 1 | au BufNewFile,BufRead *.sil set ft=sil 2 | -------------------------------------------------------------------------------- /ftdetect/swift.vim: -------------------------------------------------------------------------------- 1 | au BufNewFile,BufRead *.swift set ft=swift 2 | -------------------------------------------------------------------------------- /ftdetect/swiftgyb.vim: -------------------------------------------------------------------------------- 1 | au BufNewFile,BufRead *.swift.gyb set ft=swiftgyb 2 | 3 | -------------------------------------------------------------------------------- /ftplugin/swift.vim: -------------------------------------------------------------------------------- 1 | setlocal comments=s1:/*,mb:*,ex:*/,:///,:// 2 | setlocal expandtab 3 | setlocal ts=2 4 | setlocal sw=2 5 | setlocal smartindent 6 | -------------------------------------------------------------------------------- /ftplugin/swiftgyb.vim: -------------------------------------------------------------------------------- 1 | runtime! ftplugin/swift.vim 2 | -------------------------------------------------------------------------------- /swift-format.py: -------------------------------------------------------------------------------- 1 | # This file is a minimal swift-format vim-integration. To install: 2 | # - Change 'binary' if swift-format is not on the path (see below). 3 | # - Add to your .vimrc: 4 | # 5 | # map :pyf /swift-format.py 6 | # imap :pyf /swift-format.py 7 | # 8 | # The first line enables swift-format for NORMAL and VISUAL mode, the second 9 | # line adds support for INSERT mode. Change "C-I" to another binding if you 10 | # need swift-format on a different key (C-I stands for Ctrl+i). 11 | # 12 | # With this integration you can press the bound key and swift-format will 13 | # format the current line in NORMAL and INSERT mode or the selected region in 14 | # VISUAL mode. The line or region is extended to the next bigger syntactic 15 | # entity. 16 | # 17 | # You can also pass in the variable "l:lines" to choose the range for 18 | # formatting. This variable can either contain ": or 19 | # "all" to format the full file. So, to format the full file, write a function 20 | # like: 21 | # 22 | # :function FormatFile() 23 | # : let l:lines="all" 24 | # : pyf /swift-format.py 25 | # :endfunction 26 | # 27 | # It operates on the current, potentially unsaved buffer and does not create or 28 | # save any files. To revert a formatting, just undo. 29 | 30 | from __future__ import print_function 31 | 32 | import difflib 33 | import platform 34 | import subprocess 35 | import sys 36 | 37 | import vim 38 | 39 | binary = 'swift-format' 40 | if vim.eval('exists("g:swift_format_path")') == "1": 41 | binary = vim.eval('g:swift_format_path') 42 | 43 | 44 | def get_buffer(encoding): 45 | if platform.python_version_tuple()[0] == "3": 46 | return vim.current.buffer 47 | return [line.decode(encoding) for line in vim.current.buffer] 48 | 49 | 50 | def main(argc, argv): 51 | encoding = vim.eval("&encoding") 52 | buf = get_buffer(encoding) 53 | 54 | if vim.eval('exists("l:lines")') == '1': 55 | lines = vim.eval('l:lines') 56 | else: 57 | lines = '%s:%s' % (vim.current.range.start + 1, 58 | vim.current.range.end + 1) 59 | 60 | cursor = int(vim.eval('line2byte(line(".")) + col(".")')) - 2 61 | if cursor < 0: 62 | print("Couldn't determine cursor position. Is your file empty?") 63 | return 64 | 65 | # avoid the cmd prompt on windows 66 | SI = None 67 | if sys.platform.startswith('win32'): 68 | SI = subprocess.STARTUPINFO() 69 | SI.dwFlags |= subprocess.STARTF_USESHOWWINDOW 70 | SI.wShowWindow = subprocess.SW_HIDE 71 | 72 | command = [binary] 73 | if lines != 'all': 74 | command.extend(['-line-range', lines]) 75 | 76 | p = subprocess.Popen(command, 77 | stdout=subprocess.PIPE, stderr=subprocess.PIPE, 78 | stdin=subprocess.PIPE, startupinfo=SI) 79 | stdout, stderr = p.communicate(input='\n'.join(buf).encode(encoding)) 80 | 81 | if stderr: 82 | print(stderr) 83 | 84 | if not stdout: 85 | print('No output from swift-format (crashed?).') 86 | return 87 | 88 | lines = stdout.decode(encoding).split('\n') 89 | sequence = difflib.SequenceMatcher(None, buf, lines) 90 | for op in reversed(sequence.get_opcodes()): 91 | if op[0] is not 'equal': 92 | vim.current.buffer[op[1]:op[2]] = lines[op[3]:op[4]] 93 | 94 | 95 | if __name__ == '__main__': 96 | main(len(sys.argv), sys.argv) 97 | -------------------------------------------------------------------------------- /syntax/sil.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: sil 3 | 4 | if exists("b:current_syntax") 5 | finish 6 | endif 7 | 8 | syn keyword silStage skipwhite nextgroup=silStages 9 | \ sil_stage 10 | syn keyword silStages 11 | \ canonical 12 | \ raw 13 | 14 | syn match silIdentifier skipwhite 15 | \ /@\<[A-Za-z_0-9]\+\>/ 16 | 17 | syn match silConvention skipwhite 18 | \ /$\?@convention/ 19 | syn region silConvention contained contains=silConventions 20 | \ start="@convention(" end=")" 21 | syn keyword silConventions 22 | \ block 23 | \ c 24 | \ method 25 | \ objc_method 26 | \ thick 27 | \ thin 28 | \ witness_method 29 | 30 | syn match silFunctionType skipwhite 31 | \ /@\(\\|\\|\\|\\|\\|\\|\\|\\|\\|\\|\\|\\|\\)/ 32 | syn match silMetatypeType skipwhite 33 | \ /@\(\\|\\|\\)/ 34 | 35 | " TODO: handle [tail_elems sil-type * sil-operand] 36 | syn region silAttribute contains=silAttributes 37 | \ start="\[" end="\]" 38 | syn keyword silAttributes contained containedin=silAttribute 39 | \ abort 40 | \ deinit 41 | \ delegatingself 42 | \ derivedself 43 | \ derivedselfonly 44 | \ dynamic 45 | \ exact 46 | \ init 47 | \ modify 48 | \ mutating 49 | \ objc 50 | \ open 51 | \ read 52 | \ rootself 53 | \ stack 54 | \ static 55 | \ strict 56 | \ unknown 57 | \ unsafe 58 | \ var 59 | 60 | syn keyword swiftImport import skipwhite nextgroup=swiftImportModule 61 | syn match swiftImportModule /\<[A-Za-z_][A-Za-z_0-9]*\>/ contained nextgroup=swiftImportComponent 62 | syn match swiftImportComponent /\.\<[A-Za-z_][A-Za-z_0-9]*\>/ contained nextgroup=swiftImportComponent 63 | 64 | syn region swiftComment start="/\*" end="\*/" contains=swiftComment,swiftLineComment,swiftTodo 65 | syn region swiftLineComment start="//" end="$" contains=swiftComment,swiftTodo 66 | 67 | syn match swiftLineComment /^#!.*/ 68 | syn match swiftTypeName /\<[A-Z][a-zA-Z_0-9]*\>/ 69 | syn match swiftDecimal /\<[-]\?[0-9]\+\>/ 70 | syn match swiftDecimal /\<[-+]\?[0-9]\+\>/ 71 | 72 | syn match swiftTypeName /\$\*\<\?[A-Z][a-zA-Z0-9_]*\>/ 73 | syn match swiftVarName /%\<[A-z[a-z_0-9]\+\(#[0-9]\+\)\?\>/ 74 | 75 | syn keyword swiftKeyword break case continue default do else for if in static switch repeat return where while skipwhite 76 | 77 | syn keyword swiftKeyword sil internal thunk skipwhite 78 | syn keyword swiftKeyword public hidden private shared public_external hidden_external skipwhite 79 | syn keyword swiftKeyword getter setter allocator initializer enumelt destroyer globalaccessor objc skipwhite 80 | syn keyword swiftKeyword alloc_global alloc_stack alloc_ref alloc_ref_dynamic alloc_box alloc_existential_box alloc_value_buffer dealloc_stack dealloc_box dealloc_existential_box dealloc_ref dealloc_partial_ref dealloc_value_buffer skipwhite 81 | syn keyword swiftKeyword debug_value debug_value_addr skipwhite 82 | syn keyword swiftKeyword load load_unowned store assign mark_uninitialized mark_function_escape copy_addr destroy_addr index_addr index_raw_pointer bind_memory to skipwhite 83 | syn keyword swiftKeyword strong_retain strong_release strong_retain_unowned ref_to_unowned unowned_to_ref unowned_retain unowned_release load_weak store_unowned store_weak fix_lifetime autorelease_value set_deallocating is_unique is_escaping_closure skipwhite 84 | syn keyword swiftKeyword function_ref integer_literal float_literal string_literal global_addr skipwhite 85 | syn keyword swiftKeyword class_method super_method witness_method objc_method objc_super_method skipwhite 86 | syn keyword swiftKeyword partial_apply builtin skipwhite 87 | syn keyword swiftApplyKeyword apply try_apply skipwhite 88 | syn keyword swiftKeyword metatype value_metatype existential_metatype skipwhite 89 | syn keyword swiftKeyword retain_value release_value retain_value_addr release_value_addr tuple tuple_extract tuple_element_addr struct struct_extract struct_element_addr ref_element_addr skipwhite 90 | syn keyword swiftKeyword init_enum_data_addr unchecked_enum_data unchecked_take_enum_data_addr inject_enum_addr skipwhite 91 | syn keyword swiftKeyword init_existential_addr init_existential_value init_existential_metatype deinit_existential_addr deinit_existential_value open_existential_addr open_existential_box open_existential_box_value open_existential_metatype init_existential_ref open_existential_ref open_existential_value skipwhite 92 | syn keyword swiftKeyword upcast address_to_pointer pointer_to_address pointer_to_thin_function unchecked_addr_cast unchecked_ref_cast unchecked_ref_cast_addr ref_to_raw_pointer ref_to_bridge_object ref_to_unmanaged unmanaged_to_ref raw_pointer_to_ref skipwhite 93 | syn keyword swiftKeyword convert_function thick_to_objc_metatype thin_function_to_pointer objc_to_thick_metatype thin_to_thick_function unchecked_ref_bit_cast unchecked_trivial_bit_cast bridge_object_to_ref bridge_object_to_word unchecked_bitwise_cast skipwhite 94 | syn keyword swiftKeyword objc_existential_metatype_to_object objc_metatype_to_object objc_protocol skipwhite 95 | syn keyword swiftKeyword unconditional_checked_cast unconditional_checked_cast_addr unconditional_checked_cast_value skipwhite 96 | syn keyword swiftKeyword cond_fail skipwhite 97 | syn keyword swiftKeyword unreachable return throw br cond_br switch_value select_enum select_enum_addr select_value switch_enum switch_enum_addr dynamic_method_br checked_cast_br checked_cast_value_br checked_cast_addr_br skipwhite 98 | syn keyword swiftKeyword project_box project_existential_box project_value_buffer project_block_storage init_block_storage_header copy_block mark_dependence skipwhite 99 | 100 | syn keyword swiftTypeDefinition class extension protocol struct typealias enum skipwhite nextgroup=swiftTypeName 101 | syn region swiftTypeAttributes start="\[" end="\]" skipwhite contained nextgroup=swiftTypeName 102 | syn match swiftTypeName /\<[A-Za-z_][A-Za-z_0-9\.]*\>/ contained nextgroup=swiftTypeParameters 103 | 104 | syn region swiftTypeParameters start="<" end=">" skipwhite contained 105 | 106 | syn keyword swiftFuncDefinition func skipwhite nextgroup=swiftFuncAttributes,swiftFuncName,swiftOperator 107 | syn region swiftFuncAttributes start="\[" end="\]" skipwhite contained nextgroup=swiftFuncName,swiftOperator 108 | syn match swiftFuncName /\<[A-Za-z_][A-Za-z_0-9]*\>/ skipwhite contained nextgroup=swiftTypeParameters 109 | syn keyword swiftFuncKeyword subscript init destructor nextgroup=swiftTypeParameters 110 | 111 | syn keyword swiftVarDefinition var skipwhite nextgroup=swiftVarName 112 | syn keyword swiftVarDefinition let skipwhite nextgroup=swiftVarName 113 | syn match swiftVarName /\<[A-Za-z_][A-Za-z_0-9]*\>/ skipwhite contained 114 | 115 | syn keyword swiftDefinitionModifier static 116 | 117 | syn match swiftImplicitVarName /\$\<[A-Za-z_0-9]\+\>/ 118 | 119 | hi def link swiftImport Include 120 | hi def link swiftImportModule Title 121 | hi def link swiftImportComponent Identifier 122 | hi def link swiftApplyKeyword Statement 123 | hi def link swiftKeyword Statement 124 | hi def link swiftTypeDefinition Define 125 | hi def link swiftTypeName Type 126 | hi def link swiftTypeParameters Special 127 | hi def link swiftTypeAttributes PreProc 128 | hi def link swiftFuncDefinition Define 129 | hi def link swiftDefinitionModifier Define 130 | hi def link swiftFuncName Function 131 | hi def link swiftFuncAttributes PreProc 132 | hi def link swiftFuncKeyword Function 133 | hi def link swiftVarDefinition Define 134 | hi def link swiftVarName Identifier 135 | hi def link swiftImplicitVarName Identifier 136 | hi def link swiftIdentifierKeyword Identifier 137 | hi def link swiftTypeDeclaration Delimiter 138 | hi def link swiftBoolean Boolean 139 | hi def link swiftString String 140 | hi def link swiftInterpolation Special 141 | hi def link swiftComment Comment 142 | hi def link swiftLineComment Comment 143 | hi def link swiftDecimal Number 144 | hi def link swiftHex Number 145 | hi def link swiftOct Number 146 | hi def link swiftBin Number 147 | hi def link swiftOperator Function 148 | hi def link swiftChar Character 149 | hi def link swiftLabel Label 150 | hi def link swiftNew Operator 151 | 152 | hi def link silStage Special 153 | hi def link silStages Type 154 | hi def link silConvention Special 155 | hi def link silConventionParameter Special 156 | hi def link silConventions Type 157 | hi def link silIdentifier Identifier 158 | hi def link silFunctionType Special 159 | hi def link silMetatypeType Special 160 | hi def link silAttribute PreProc 161 | 162 | let b:current_syntax = "sil" 163 | -------------------------------------------------------------------------------- /syntax/swift.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: swift 3 | " Maintainer: Joe Groff 4 | " Last Change: 2018 Jan 21 5 | 6 | if exists("b:current_syntax") 7 | finish 8 | endif 9 | 10 | syn keyword swiftKeyword 11 | \ associatedtype 12 | \ break 13 | \ catch 14 | \ continue 15 | \ defer 16 | \ do 17 | \ else 18 | \ fallthrough 19 | \ for 20 | \ guard 21 | \ if 22 | \ in 23 | \ repeat 24 | \ return 25 | \ switch 26 | \ throw 27 | \ try 28 | \ where 29 | \ while 30 | syn match swiftMultiwordKeyword 31 | \ "indirect case" 32 | 33 | syn keyword swiftImport skipwhite skipempty nextgroup=swiftImportModule 34 | \ import 35 | 36 | syn keyword swiftDefinitionModifier 37 | \ convenience 38 | \ dynamic 39 | \ fileprivate 40 | \ final 41 | \ internal 42 | \ lazy 43 | \ nonmutating 44 | \ open 45 | \ override 46 | \ prefix 47 | \ private 48 | \ public 49 | \ required 50 | \ rethrows 51 | \ static 52 | \ throws 53 | \ weak 54 | 55 | syn keyword swiftInOutKeyword skipwhite skipempty nextgroup=swiftTypeName 56 | \ inout 57 | 58 | syn keyword swiftIdentifierKeyword 59 | \ Self 60 | \ metatype 61 | \ self 62 | \ super 63 | 64 | syn keyword swiftFuncKeywordGeneral skipwhite skipempty nextgroup=swiftTypeParameters 65 | \ init 66 | 67 | syn keyword swiftFuncKeyword 68 | \ deinit 69 | \ subscript 70 | 71 | syn keyword swiftScope 72 | \ autoreleasepool 73 | 74 | syn keyword swiftMutating skipwhite skipempty nextgroup=swiftFuncDefinition 75 | \ mutating 76 | syn keyword swiftFuncDefinition skipwhite skipempty nextgroup=swiftTypeName,swiftOperator 77 | \ func 78 | 79 | syn keyword swiftTypeDefinition skipwhite skipempty nextgroup=swiftTypeName 80 | \ class 81 | \ enum 82 | \ extension 83 | \ protocol 84 | \ struct 85 | 86 | syn keyword swiftTypeAliasDefinition skipwhite skipempty nextgroup=swiftTypeAliasName 87 | \ typealias 88 | 89 | syn match swiftMultiwordTypeDefinition skipwhite skipempty nextgroup=swiftTypeName 90 | \ "indirect enum" 91 | 92 | syn keyword swiftVarDefinition skipwhite skipempty nextgroup=swiftVarName 93 | \ let 94 | \ var 95 | 96 | syn keyword swiftLabel 97 | \ get 98 | \ set 99 | \ didSet 100 | \ willSet 101 | 102 | syn keyword swiftBoolean 103 | \ false 104 | \ true 105 | 106 | syn keyword swiftNil 107 | \ nil 108 | 109 | syn match swiftImportModule contained nextgroup=swiftImportComponent 110 | \ /\<[A-Za-z_][A-Za-z_0-9]*\>/ 111 | syn match swiftImportComponent contained nextgroup=swiftImportComponent 112 | \ /\.\<[A-Za-z_][A-Za-z_0-9]*\>/ 113 | 114 | syn match swiftTypeAliasName contained skipwhite skipempty nextgroup=swiftTypeAliasValue 115 | \ /\<[A-Za-z_][A-Za-z_0-9]*\>/ 116 | syn match swiftTypeName contained skipwhite skipempty nextgroup=swiftTypeParameters 117 | \ /\<[A-Za-z_][A-Za-z_0-9\.]*\>/ 118 | syn match swiftVarName contained skipwhite skipempty nextgroup=swiftTypeDeclaration 119 | \ /\<[A-Za-z_][A-Za-z_0-9]*\>/ 120 | syn match swiftImplicitVarName 121 | \ /\$\<[A-Za-z_0-9]\+\>/ 122 | 123 | " TypeName[Optionality]? 124 | syn match swiftType contained skipwhite skipempty nextgroup=swiftTypeParameters 125 | \ /\<[A-Za-z_][A-Za-z_0-9\.]*\>[!?]\?/ 126 | " [Type:Type] (dictionary) or [Type] (array) 127 | syn region swiftType contained contains=swiftTypePair,swiftType 128 | \ matchgroup=Delimiter start=/\[/ end=/\]/ 129 | syn match swiftTypePair contained skipwhite skipempty nextgroup=swiftTypeParameters,swiftTypeDeclaration 130 | \ /\<[A-Za-z_][A-Za-z_0-9\.]*\>[!?]\?/ 131 | " (Type[, Type]) (tuple) 132 | " FIXME: we should be able to use skip="," and drop swiftParamDelim 133 | syn region swiftType contained contains=swiftType,swiftParamDelim 134 | \ matchgroup=Delimiter start="[^@]\?(" end=")" matchgroup=NONE skip="," 135 | syn match swiftParamDelim contained 136 | \ /,/ 137 | " (generics) 138 | syn region swiftTypeParameters contained contains=swiftVarName,swiftConstraint 139 | \ matchgroup=Delimiter start="<" end=">" matchgroup=NONE skip="," 140 | syn keyword swiftConstraint contained 141 | \ where 142 | 143 | syn match swiftTypeAliasValue skipwhite skipempty nextgroup=swiftType 144 | \ /=/ 145 | syn match swiftTypeDeclaration skipwhite skipempty nextgroup=swiftType,swiftInOutKeyword 146 | \ /:/ 147 | syn match swiftTypeDeclaration skipwhite skipempty nextgroup=swiftType 148 | \ /->/ 149 | 150 | syn match swiftKeyword 151 | \ /\/ 152 | syn region swiftCaseLabelRegion 153 | \ matchgroup=swiftKeyword start=/\/ matchgroup=Delimiter end=/:/ oneline contains=TOP 154 | syn region swiftDefaultLabelRegion 155 | \ matchgroup=swiftKeyword start=/\/ matchgroup=Delimiter end=/:/ oneline 156 | 157 | syn region swiftParenthesisRegion matchgroup=NONE start=/(/ end=/)/ contains=TOP 158 | 159 | syn region swiftString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=swiftInterpolationRegion 160 | syn region swiftInterpolationRegion matchgroup=swiftInterpolation start=/\\(/ end=/)/ contained contains=TOP 161 | syn region swiftComment start="/\*" end="\*/" contains=swiftComment,swiftLineComment,swiftTodo 162 | syn region swiftLineComment start="//" end="$" contains=swiftComment,swiftTodo 163 | 164 | syn match swiftDecimal /[+\-]\?\<\([0-9][0-9_]*\)\([.][0-9_]*\)\?\([eE][+\-]\?[0-9][0-9_]*\)\?\>/ 165 | syn match swiftHex /[+\-]\?\<0x[0-9A-Fa-f][0-9A-Fa-f_]*\(\([.][0-9A-Fa-f_]*\)\?[pP][+\-]\?[0-9][0-9_]*\)\?\>/ 166 | syn match swiftOct /[+\-]\?\<0o[0-7][0-7_]*\>/ 167 | syn match swiftBin /[+\-]\?\<0b[01][01_]*\>/ 168 | 169 | syn match swiftOperator +\.\@!&|^~]\@!&|^~]*\|*/\@![/=\-+*%<>!&|^~]*\|->\@![/=\-+*%<>!&|^~]*\|[=+%<>!&|^~][/=\-+*%<>!&|^~]*\)+ skipwhite skipempty nextgroup=swiftTypeParameters 170 | syn match swiftOperator "\.\.[<.]" skipwhite skipempty nextgroup=swiftTypeParameters 171 | 172 | syn match swiftChar /'\([^'\\]\|\\\(["'tnr0\\]\|x[0-9a-fA-F]\{2}\|u[0-9a-fA-F]\{4}\|U[0-9a-fA-F]\{8}\)\)'/ 173 | 174 | syn match swiftTupleIndexNumber contains=swiftDecimal 175 | \ /\.[0-9]\+/ 176 | syn match swiftDecimal contained 177 | \ /[0-9]\+/ 178 | 179 | syn match swiftPreproc /#\(\\|\\|\\)/ 180 | syn match swiftPreproc /^\s*#\(\\|\\|\\|\\|\\|\\)/ 181 | syn region swiftPreprocFalse start="^\s*#\\s\+\" end="^\s*#\(\\|\\|\\)" 182 | 183 | syn match swiftAttribute /@\<\w\+\>/ skipwhite skipempty nextgroup=swiftType,swiftTypeDefinition 184 | 185 | syn keyword swiftTodo MARK TODO FIXME contained 186 | 187 | syn match swiftCastOp "\" skipwhite skipempty nextgroup=swiftType 188 | syn match swiftCastOp "\[!?]\?" skipwhite skipempty nextgroup=swiftType 189 | 190 | syn match swiftNilOps "??" 191 | 192 | syn region swiftReservedIdentifier oneline 193 | \ start=/`/ end=/`/ 194 | 195 | hi def link swiftImport Include 196 | hi def link swiftImportModule Title 197 | hi def link swiftImportComponent Identifier 198 | hi def link swiftKeyword Statement 199 | hi def link swiftMultiwordKeyword Statement 200 | hi def link swiftTypeDefinition Define 201 | hi def link swiftMultiwordTypeDefinition Define 202 | hi def link swiftType Type 203 | hi def link swiftTypePair Type 204 | hi def link swiftTypeAliasName Identifier 205 | hi def link swiftTypeName Function 206 | hi def link swiftConstraint Special 207 | hi def link swiftFuncDefinition Define 208 | hi def link swiftDefinitionModifier Operator 209 | hi def link swiftInOutKeyword Define 210 | hi def link swiftFuncKeyword Function 211 | hi def link swiftFuncKeywordGeneral Function 212 | hi def link swiftTypeAliasDefinition Define 213 | hi def link swiftVarDefinition Define 214 | hi def link swiftVarName Identifier 215 | hi def link swiftImplicitVarName Identifier 216 | hi def link swiftIdentifierKeyword Identifier 217 | hi def link swiftTypeAliasValue Delimiter 218 | hi def link swiftTypeDeclaration Delimiter 219 | hi def link swiftTypeParameters Delimiter 220 | hi def link swiftBoolean Boolean 221 | hi def link swiftString String 222 | hi def link swiftInterpolation Special 223 | hi def link swiftComment Comment 224 | hi def link swiftLineComment Comment 225 | hi def link swiftDecimal Number 226 | hi def link swiftHex Number 227 | hi def link swiftOct Number 228 | hi def link swiftBin Number 229 | hi def link swiftOperator Function 230 | hi def link swiftChar Character 231 | hi def link swiftLabel Operator 232 | hi def link swiftMutating Statement 233 | hi def link swiftPreproc PreCondit 234 | hi def link swiftPreprocFalse Comment 235 | hi def link swiftAttribute Type 236 | hi def link swiftTodo Todo 237 | hi def link swiftNil Constant 238 | hi def link swiftCastOp Operator 239 | hi def link swiftNilOps Operator 240 | hi def link swiftScope PreProc 241 | 242 | let b:current_syntax = "swift" 243 | -------------------------------------------------------------------------------- /syntax/swiftgyb.vim: -------------------------------------------------------------------------------- 1 | " Vim syntax file 2 | " Language: gyb on swift 3 | 4 | runtime! syntax/swift.vim 5 | unlet b:current_syntax 6 | 7 | syn include @Python syntax/python.vim 8 | syn region pythonCode matchgroup=gybPythonCode start=+^ *%+ end=+$+ contains=@Python keepend 9 | syn region pythonCode matchgroup=gybPythonCode start=+%{+ end=+}%+ contains=@Python keepend 10 | syn match gybPythonCode /\${[^}]*}/ 11 | hi def link gybPythonCode CursorLineNr 12 | 13 | let b:current_syntax = "swiftgyb" 14 | 15 | --------------------------------------------------------------------------------