mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-15 15:03:50 -05:00
Update (periodic rebuild)
I originally meant to run this before adding haproxy, but accidentally
pushed that into my branch. If you'd like to see that content, it's at
414ad25c3a.
This commit is contained in:
@@ -3,28 +3,23 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ansible') == -1
|
||||
" Vim syntax file
|
||||
" Language: Ansible YAML/Jinja templates
|
||||
" Maintainer: Dave Honneffer <pearofducks@gmail.com>
|
||||
" Last Change: 2015.09.06
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
" Last Change: 2018.02.08
|
||||
|
||||
if !exists("main_syntax")
|
||||
let main_syntax = 'yaml'
|
||||
endif
|
||||
|
||||
let b:current_syntax = ''
|
||||
unlet b:current_syntax
|
||||
runtime! syntax/yaml.vim
|
||||
if exists('b:current_syntax')
|
||||
let s:current_syntax=b:current_syntax
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
|
||||
let b:current_syntax = ''
|
||||
unlet b:current_syntax
|
||||
syntax include @Yaml syntax/yaml.vim
|
||||
|
||||
let b:current_syntax = ''
|
||||
unlet b:current_syntax
|
||||
syntax include @Jinja syntax/jinja2.vim
|
||||
|
||||
if exists('s:current_syntax')
|
||||
let b:current_syntax=s:current_syntax
|
||||
endif
|
||||
|
||||
" Jinja
|
||||
" ================================
|
||||
|
||||
@@ -39,6 +34,12 @@ highlight link jinjaVarDelim Delimiter
|
||||
" YAML
|
||||
" ================================
|
||||
|
||||
if exists("g:ansible_yamlKeyName")
|
||||
let s:yamlKey = g:ansible_yamlKeyName
|
||||
else
|
||||
let s:yamlKey = "yamlBlockMappingKey"
|
||||
endif
|
||||
|
||||
" Reset some YAML to plain styling
|
||||
" the number 80 in Ansible isn't any more important than the word root
|
||||
highlight link yamlInteger NONE
|
||||
@@ -46,58 +47,9 @@ highlight link yamlBool NONE
|
||||
highlight link yamlFlowString NONE
|
||||
" but it does make sense we visualize quotes easily
|
||||
highlight link yamlFlowStringDelimiter Delimiter
|
||||
|
||||
fun! s:normal_keywords_highlight(name)
|
||||
if a:name == 'Comment'
|
||||
highlight link ansible_normal_keywords Comment
|
||||
elseif a:name == 'Constant'
|
||||
highlight link ansible_normal_keywords Constant
|
||||
elseif a:name == 'Identifier'
|
||||
highlight link ansible_normal_keywords Identifier
|
||||
elseif a:name == 'Statement'
|
||||
highlight link ansible_normal_keywords Statement
|
||||
elseif a:name == 'PreProc'
|
||||
highlight link ansible_normal_keywords PreProc
|
||||
elseif a:name == 'Type'
|
||||
highlight link ansible_normal_keywords Type
|
||||
elseif a:name == 'Special'
|
||||
highlight link ansible_normal_keywords Special
|
||||
elseif a:name == 'Underlined'
|
||||
highlight link ansible_normal_keywords Underlined
|
||||
elseif a:name == 'Ignore'
|
||||
highlight link ansible_normal_keywords Ignore
|
||||
elseif a:name == 'Error'
|
||||
highlight link ansible_normal_keywords Error
|
||||
elseif a:name == 'Todo'
|
||||
highlight link ansible_normal_keywords Todo
|
||||
endif
|
||||
endfun
|
||||
|
||||
fun! s:with_keywords_highlight(name)
|
||||
if a:name == 'Comment'
|
||||
highlight link ansible_with_keywords Comment
|
||||
elseif a:name == 'Constant'
|
||||
highlight link ansible_with_keywords Constant
|
||||
elseif a:name == 'Identifier'
|
||||
highlight link ansible_with_keywords Identifier
|
||||
elseif a:name == 'Statement'
|
||||
highlight link ansible_with_keywords Statement
|
||||
elseif a:name == 'PreProc'
|
||||
highlight link ansible_with_keywords PreProc
|
||||
elseif a:name == 'Type'
|
||||
highlight link ansible_with_keywords Type
|
||||
elseif a:name == 'Special'
|
||||
highlight link ansible_with_keywords Special
|
||||
elseif a:name == 'Underlined'
|
||||
highlight link ansible_with_keywords Underlined
|
||||
elseif a:name == 'Ignore'
|
||||
highlight link ansible_with_keywords Ignore
|
||||
elseif a:name == 'Error'
|
||||
highlight link ansible_with_keywords Error
|
||||
elseif a:name == 'Todo'
|
||||
highlight link ansible_with_keywords Todo
|
||||
endif
|
||||
endfun
|
||||
" This is only found in stephypy/vim-yaml, since it's one line it isn't worth
|
||||
" making conditional
|
||||
highlight link yamlConstant NONE
|
||||
|
||||
fun! s:attribute_highlight(attributes)
|
||||
if a:attributes =~ 'a'
|
||||
@@ -121,7 +73,7 @@ else
|
||||
endif
|
||||
|
||||
if exists("g:ansible_name_highlight")
|
||||
syn keyword ansible_name name containedin=yamlBlockMappingKey contained
|
||||
execute 'syn keyword ansible_name name containedin='.s:yamlKey.' contained'
|
||||
if g:ansible_name_highlight =~ 'd'
|
||||
highlight link ansible_name Comment
|
||||
else
|
||||
@@ -129,24 +81,24 @@ if exists("g:ansible_name_highlight")
|
||||
endif
|
||||
endif
|
||||
|
||||
syn keyword ansible_debug_keywords debug containedin=yamlBlockMappingKey contained
|
||||
execute 'syn keyword ansible_debug_keywords debug containedin='.s:yamlKey.' contained'
|
||||
highlight link ansible_debug_keywords Debug
|
||||
|
||||
if exists("g:ansible_extra_keywords_highlight")
|
||||
syn keyword ansible_extra_special_keywords register always_run changed_when failed_when no_log args vars delegate_to ignore_errors containedin=yamlBlockMappingKey contained
|
||||
execute 'syn keyword ansible_extra_special_keywords register always_run changed_when failed_when no_log args vars delegate_to ignore_errors containedin='.s:yamlKey.' contained'
|
||||
highlight link ansible_extra_special_keywords Statement
|
||||
endif
|
||||
|
||||
syn keyword ansible_normal_keywords include include_tasks import_tasks until retries delay when only_if become become_user block rescue always notify containedin=yamlBlockMappingKey contained
|
||||
execute 'syn keyword ansible_normal_keywords include include_tasks import_tasks until retries delay when only_if become become_user block rescue always notify containedin='.s:yamlKey.' contained'
|
||||
if exists("g:ansible_normal_keywords_highlight")
|
||||
call s:normal_keywords_highlight(g:ansible_normal_keywords_highlight)
|
||||
execute 'highlight link ansible_normal_keywords '.g:ansible_normal_keywords_highlight
|
||||
else
|
||||
highlight link ansible_normal_keywords Statement
|
||||
endif
|
||||
|
||||
syn match ansible_with_keywords "\vwith_.+" containedin=yamlBlockMappingKey contained
|
||||
execute 'syn match ansible_with_keywords "\vwith_.+" containedin='.s:yamlKey.' contained'
|
||||
if exists("g:ansible_with_keywords_highlight")
|
||||
call s:with_keywords_highlight(g:ansible_with_keywords_highlight)
|
||||
execute 'highlight link ansible_with_keywords '.g:ansible_with_keywords_highlight
|
||||
else
|
||||
highlight link ansible_with_keywords Statement
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user