mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated plugins
This commit is contained in:
@ -9,102 +9,6 @@ if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Set settings to default values.
|
||||
if !exists("g:go_highlight_array_whitespace_error")
|
||||
let g:go_highlight_array_whitespace_error = 0
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_chan_whitespace_error")
|
||||
let g:go_highlight_chan_whitespace_error = 0
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_extra_types")
|
||||
let g:go_highlight_extra_types = 0
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_space_tab_error")
|
||||
let g:go_highlight_space_tab_error = 0
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_trailing_whitespace_error")
|
||||
let g:go_highlight_trailing_whitespace_error = 0
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_operators")
|
||||
let g:go_highlight_operators = 0
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_functions")
|
||||
let g:go_highlight_functions = 0
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_function_arguments")
|
||||
let g:go_highlight_function_arguments = 0
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_function_calls")
|
||||
let g:go_highlight_function_calls = 0
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_fields")
|
||||
let g:go_highlight_fields = 0
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_types")
|
||||
let g:go_highlight_types = 0
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_build_constraints")
|
||||
let g:go_highlight_build_constraints = 0
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_string_spellcheck")
|
||||
let g:go_highlight_string_spellcheck = 1
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_format_strings")
|
||||
let g:go_highlight_format_strings = 1
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_generate_tags")
|
||||
let g:go_highlight_generate_tags = 0
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_variable_assignments")
|
||||
let g:go_highlight_variable_assignments = 0
|
||||
endif
|
||||
|
||||
if !exists("g:go_highlight_variable_declarations")
|
||||
let g:go_highlight_variable_declarations = 0
|
||||
endif
|
||||
|
||||
let s:fold_block = 1
|
||||
let s:fold_import = 1
|
||||
let s:fold_varconst = 1
|
||||
let s:fold_package_comment = 1
|
||||
let s:fold_comment = 0
|
||||
|
||||
if exists("g:go_fold_enable")
|
||||
" Enabled by default.
|
||||
if index(g:go_fold_enable, 'block') == -1
|
||||
let s:fold_block = 0
|
||||
endif
|
||||
if index(g:go_fold_enable, 'import') == -1
|
||||
let s:fold_import = 0
|
||||
endif
|
||||
if index(g:go_fold_enable, 'varconst') == -1
|
||||
let s:fold_varconst = 0
|
||||
endif
|
||||
if index(g:go_fold_enable, 'package_comment') == -1
|
||||
let s:fold_package_comment = 0
|
||||
endif
|
||||
|
||||
" Disabled by default.
|
||||
if index(g:go_fold_enable, 'comment') > -1
|
||||
let s:fold_comment = 1
|
||||
endif
|
||||
endif
|
||||
|
||||
syn case match
|
||||
|
||||
syn keyword goPackage package
|
||||
@ -142,7 +46,6 @@ hi def link goUnsignedInts Type
|
||||
hi def link goFloats Type
|
||||
hi def link goComplexes Type
|
||||
|
||||
|
||||
" Predefined functions and values
|
||||
syn match goBuiltins /\<\v(append|cap|close|complex|copy|delete|imag|len)\ze\(/
|
||||
syn match goBuiltins /\<\v(make|new|panic|print|println|real|recover)\ze\(/
|
||||
@ -158,7 +61,7 @@ syn keyword goTodo contained TODO FIXME XXX BUG
|
||||
syn cluster goCommentGroup contains=goTodo
|
||||
|
||||
syn region goComment start="//" end="$" contains=goGenerate,@goCommentGroup,@Spell
|
||||
if s:fold_comment
|
||||
if go#config#FoldEnable('comment')
|
||||
syn region goComment start="/\*" end="\*/" contains=@goCommentGroup,@Spell fold
|
||||
syn match goComment "\v(^\s*//.*\n)+" contains=goGenerate,@goCommentGroup,@Spell fold
|
||||
else
|
||||
@ -168,7 +71,7 @@ endif
|
||||
hi def link goComment Comment
|
||||
hi def link goTodo Todo
|
||||
|
||||
if g:go_highlight_generate_tags != 0
|
||||
if go#config#HighlightGenerateTags()
|
||||
syn match goGenerateVariables contained /\(\$GOARCH\|\$GOOS\|\$GOFILE\|\$GOLINE\|\$GOPACKAGE\|\$DOLLAR\)\>/
|
||||
syn region goGenerate start="^\s*//go:generate" end="$" contains=goGenerateVariables
|
||||
hi def link goGenerate PreProc
|
||||
@ -193,7 +96,7 @@ hi def link goEscapeError Error
|
||||
|
||||
" Strings and their contents
|
||||
syn cluster goStringGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU,goEscapeError
|
||||
if g:go_highlight_string_spellcheck != 0
|
||||
if go#config#HighlightStringSpellcheck()
|
||||
syn region goString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup,@Spell
|
||||
syn region goRawString start=+`+ end=+`+ contains=@Spell
|
||||
else
|
||||
@ -201,7 +104,7 @@ else
|
||||
syn region goRawString start=+`+ end=+`+
|
||||
endif
|
||||
|
||||
if g:go_highlight_format_strings != 0
|
||||
if go#config#HighlightFormatStrings()
|
||||
" [n] notation is valid for specifying explicit argument indexes
|
||||
" 1. Match a literal % not preceded by a %.
|
||||
" 2. Match any number of -, #, 0, space, or +
|
||||
@ -229,21 +132,21 @@ hi def link goCharacter Character
|
||||
|
||||
" Regions
|
||||
syn region goParen start='(' end=')' transparent
|
||||
if s:fold_block
|
||||
if go#config#FoldEnable('block')
|
||||
syn region goBlock start="{" end="}" transparent fold
|
||||
else
|
||||
syn region goBlock start="{" end="}" transparent
|
||||
endif
|
||||
|
||||
" import
|
||||
if s:fold_import
|
||||
if go#config#FoldEnable('import')
|
||||
syn region goImport start='import (' end=')' transparent fold contains=goImport,goString,goComment
|
||||
else
|
||||
syn region goImport start='import (' end=')' transparent contains=goImport,goString,goComment
|
||||
endif
|
||||
|
||||
" var, const
|
||||
if s:fold_varconst
|
||||
if go#config#FoldEnable('varconst')
|
||||
syn region goVar start='var (' end='^\s*)$' transparent fold
|
||||
\ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goArgumentName,goArgumentType,goSimpleArguments
|
||||
syn region goConst start='const (' end='^\s*)$' transparent fold
|
||||
@ -286,12 +189,12 @@ hi def link goImaginary Number
|
||||
hi def link goImaginaryFloat Float
|
||||
|
||||
" Spaces after "[]"
|
||||
if g:go_highlight_array_whitespace_error != 0
|
||||
if go#config#HighlightArrayWhitespaceError()
|
||||
syn match goSpaceError display "\(\[\]\)\@<=\s\+"
|
||||
endif
|
||||
|
||||
" Spacing errors around the 'chan' keyword
|
||||
if g:go_highlight_chan_whitespace_error != 0
|
||||
if go#config#HighlightChanWhitespaceError()
|
||||
" receive-only annotation on chan type
|
||||
"
|
||||
" \(\<chan\>\)\@<!<- (only pick arrow when it doesn't come after a chan)
|
||||
@ -309,7 +212,7 @@ if g:go_highlight_chan_whitespace_error != 0
|
||||
endif
|
||||
|
||||
" Extra types commonly seen
|
||||
if g:go_highlight_extra_types != 0
|
||||
if go#config#HighlightExtraTypes()
|
||||
syn match goExtraType /\<bytes\.\(Buffer\)\>/
|
||||
syn match goExtraType /\<io\.\(Reader\|ReadSeeker\|ReadWriter\|ReadCloser\|ReadWriteCloser\|Writer\|WriteCloser\|Seeker\)\>/
|
||||
syn match goExtraType /\<reflect\.\(Kind\|Type\|Value\)\>/
|
||||
@ -317,12 +220,12 @@ if g:go_highlight_extra_types != 0
|
||||
endif
|
||||
|
||||
" Space-tab error
|
||||
if g:go_highlight_space_tab_error != 0
|
||||
if go#config#HighlightSpaceTabError()
|
||||
syn match goSpaceError display " \+\t"me=e-1
|
||||
endif
|
||||
|
||||
" Trailing white space error
|
||||
if g:go_highlight_trailing_whitespace_error != 0
|
||||
if go#config#HighlightTrailingWhitespaceError()
|
||||
syn match goSpaceError display excludenl "\s\+$"
|
||||
endif
|
||||
|
||||
@ -340,7 +243,7 @@ hi def link goTodo Todo
|
||||
syn match goVarArgs /\.\.\./
|
||||
|
||||
" Operators;
|
||||
if g:go_highlight_operators != 0
|
||||
if go#config#HighlightOperators()
|
||||
" match single-char operators: - + % < > ! & | ^ * =
|
||||
" and corresponding two-char operators: -= += %= <= >= != &= |= ^= *= ==
|
||||
syn match goOperator /[-+%<>!&|^*=]=\?/
|
||||
@ -359,13 +262,13 @@ endif
|
||||
hi def link goOperator Operator
|
||||
|
||||
" Functions;
|
||||
if g:go_highlight_functions isnot 0 || g:go_highlight_function_arguments isnot 0
|
||||
if go#config#HighlightFunctions() || go#config#HighlightFunctionArguments()
|
||||
syn match goDeclaration /\<func\>/ nextgroup=goReceiver,goFunction,goSimpleArguments skipwhite skipnl
|
||||
syn match goReceiverVar /\w\+\ze\s\+\(\w\|\*\)/ nextgroup=goPointerOperator,goReceiverType skipwhite skipnl contained
|
||||
syn match goPointerOperator /\*/ nextgroup=goReceiverType contained skipwhite skipnl
|
||||
syn match goFunction /\w\+/ nextgroup=goSimpleArguments contained skipwhite skipnl
|
||||
syn match goReceiverType /\w\+/ contained
|
||||
if g:go_highlight_function_arguments isnot 0
|
||||
if go#config#HighlightFunctionArguments()
|
||||
syn match goSimpleArguments /(\(\w\|\_s\|[*\.\[\],\{\}<>-]\)*)/ contained contains=goArgumentName nextgroup=goSimpleArguments skipwhite skipnl
|
||||
syn match goArgumentName /\w\+\(\s*,\s*\w\+\)*\ze\s\+\(\w\|\.\|\*\|\[\)/ contained nextgroup=goArgumentType skipwhite skipnl
|
||||
syn match goArgumentType /\([^,)]\|\_s\)\+,\?/ contained nextgroup=goArgumentName skipwhite skipnl
|
||||
@ -380,19 +283,19 @@ endif
|
||||
hi def link goFunction Function
|
||||
|
||||
" Function calls;
|
||||
if g:go_highlight_function_calls != 0
|
||||
if go#config#HighlightFunctionCalls()
|
||||
syn match goFunctionCall /\w\+\ze(/ contains=goBuiltins,goDeclaration
|
||||
endif
|
||||
hi def link goFunctionCall Type
|
||||
|
||||
" Fields;
|
||||
if g:go_highlight_fields != 0
|
||||
if go#config#HighlightFields()
|
||||
syn match goField /\.\w\+\([.\ \n\r\:\)\[,]\)\@=/hs=s+1
|
||||
endif
|
||||
hi def link goField Identifier
|
||||
|
||||
" Structs & Interfaces;
|
||||
if g:go_highlight_types != 0
|
||||
if go#config#HighlightTypes()
|
||||
syn match goTypeConstructor /\<\w\+{\@=/
|
||||
syn match goTypeDecl /\<type\>/ nextgroup=goTypeName skipwhite skipnl
|
||||
syn match goTypeName /\w\+/ contained nextgroup=goDeclType skipwhite skipnl
|
||||
@ -408,19 +311,19 @@ hi def link goTypeDecl Keyword
|
||||
hi def link goDeclType Keyword
|
||||
|
||||
" Variable Assignments
|
||||
if g:go_highlight_variable_assignments != 0
|
||||
if go#config#HighlightVariableAssignments()
|
||||
syn match goVarAssign /\v[_.[:alnum:]]+(,\s*[_.[:alnum:]]+)*\ze(\s*([-^+|^\/%&]|\*|\<\<|\>\>|\&\^)?\=[^=])/
|
||||
hi def link goVarAssign Special
|
||||
endif
|
||||
|
||||
" Variable Declarations
|
||||
if g:go_highlight_variable_declarations != 0
|
||||
if go#config#HighlightVariableDeclarations()
|
||||
syn match goVarDefs /\v\w+(,\s*\w+)*\ze(\s*:\=)/
|
||||
hi def link goVarDefs Special
|
||||
endif
|
||||
|
||||
" Build Constraints
|
||||
if g:go_highlight_build_constraints != 0
|
||||
if go#config#HighlightBuildConstraints()
|
||||
syn match goBuildKeyword display contained "+build"
|
||||
" Highlight the known values of GOOS, GOARCH, and other +build options.
|
||||
syn keyword goBuildDirectives contained
|
||||
@ -442,7 +345,7 @@ if g:go_highlight_build_constraints != 0
|
||||
hi def link goBuildKeyword PreProc
|
||||
endif
|
||||
|
||||
if g:go_highlight_build_constraints != 0 || s:fold_package_comment
|
||||
if go#config#HighlightBuildConstraints() || go#config#FoldEnable('package_comment')
|
||||
" One or more line comments that are followed immediately by a "package"
|
||||
" declaration are treated like package documentation, so these must be
|
||||
" matched as comments to avoid looking like working build constraints.
|
||||
@ -451,11 +354,11 @@ if g:go_highlight_build_constraints != 0 || s:fold_package_comment
|
||||
exe 'syn region goPackageComment start=/\v(\/\/.*\n)+\s*package/'
|
||||
\ . ' end=/\v\n\s*package/he=e-7,me=e-7,re=e-7'
|
||||
\ . ' contains=@goCommentGroup,@Spell'
|
||||
\ . (s:fold_package_comment ? ' fold' : '')
|
||||
exe 'syn region goPackageComment start=/\v\/\*.*\n(.*\n)*\s*\*\/\npackage/'
|
||||
\ . (go#config#FoldEnable('package_comment') ? ' fold' : '')
|
||||
exe 'syn region goPackageComment start=/\v^\s*\/\*.*\n(.*\n)*\s*\*\/\npackage/'
|
||||
\ . ' end=/\v\*\/\n\s*package/he=e-7,me=e-7,re=e-7'
|
||||
\ . ' contains=@goCommentGroup,@Spell'
|
||||
\ . (s:fold_package_comment ? ' fold' : '')
|
||||
\ . (go#config#FoldEnable('package_comment') ? ' fold' : '')
|
||||
hi def link goPackageComment Comment
|
||||
endif
|
||||
|
||||
@ -468,6 +371,10 @@ function! s:hi()
|
||||
" :GoCoverage commands
|
||||
hi def goCoverageCovered ctermfg=green guifg=#A6E22E
|
||||
hi def goCoverageUncover ctermfg=red guifg=#F92672
|
||||
|
||||
" :GoDebug commands
|
||||
hi GoDebugBreakpoint term=standout ctermbg=117 ctermfg=0 guibg=#BAD4F5 guifg=Black
|
||||
hi GoDebugCurrent term=reverse ctermbg=12 ctermfg=7 guibg=DarkBlue guifg=White
|
||||
endfunction
|
||||
|
||||
augroup vim-go-hi
|
||||
|
@ -10,6 +10,8 @@ runtime! syntax/gotexttmpl.vim
|
||||
runtime! syntax/html.vim
|
||||
unlet b:current_syntax
|
||||
|
||||
syn cluster htmlPreproc add=gotplAction,goTplComment
|
||||
|
||||
let b:current_syntax = "gohtmltmpl"
|
||||
|
||||
" vim: sw=2 ts=2 et
|
||||
|
Reference in New Issue
Block a user