Skip to content

Commit

Permalink
Merge pull request #110 from arrow2nd/feat-nvim-treesitter
Browse files Browse the repository at this point in the history
Update nvim-treesitter highlights
  • Loading branch information
cocopon authored Nov 23, 2022
2 parents a94c2a9 + 2a94957 commit e01ac08
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 14 deletions.
56 changes: 52 additions & 4 deletions colors/iceberg.vim
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"
" File: iceberg.vim
" Maintainer: cocopon <[email protected]>
" Modified: 2022-04-26 21:56+0900
" Modified: 2022-11-16 22:13+0900
" License: MIT


Expand Down Expand Up @@ -113,12 +113,12 @@ if &background == 'light'
hi SyntasticStyleErrorSign ctermbg=253 ctermfg=125 guibg=#dcdfe7 guifg=#cc517a
hi SyntasticStyleWarningSign ctermbg=253 ctermfg=130 guibg=#dcdfe7 guifg=#c57339
hi SyntasticWarningSign ctermbg=253 ctermfg=130 guibg=#dcdfe7 guifg=#c57339
hi ZenSpace ctermbg=125 guibg=#cc517a
hi TSFunction ctermfg=237 guifg=#505695
hi TSFunctionBuiltin ctermfg=237 guifg=#505695
hi TSFunctionMacro ctermfg=237 guifg=#505695
hi TSMethod ctermfg=237 guifg=#505695
hi TSURI cterm=underline ctermfg=31 gui=underline guifg=#3f83a6 term=underline
hi ZenSpace ctermbg=125 guibg=#cc517a
hi DiagnosticUnderlineInfo cterm=underline ctermfg=31 gui=underline guisp=#3f83a6 term=underline
hi DiagnosticInfo ctermfg=31 guifg=#3f83a6
hi DiagnosticSignInfo ctermbg=253 ctermfg=31 guibg=#dcdfe7 guifg=#3f83a6
Expand Down Expand Up @@ -247,12 +247,12 @@ else
hi SyntasticStyleErrorSign ctermbg=235 ctermfg=203 guibg=#1e2132 guifg=#e27878
hi SyntasticStyleWarningSign ctermbg=235 ctermfg=216 guibg=#1e2132 guifg=#e2a478
hi SyntasticWarningSign ctermbg=235 ctermfg=216 guibg=#1e2132 guifg=#e2a478
hi ZenSpace ctermbg=203 guibg=#e27878
hi TSFunction ctermfg=252 guifg=#a3adcb
hi TSFunctionBuiltin ctermfg=252 guifg=#a3adcb
hi TSFunctionMacro ctermfg=252 guifg=#a3adcb
hi TSMethod ctermfg=252 guifg=#a3adcb
hi TSURI cterm=underline ctermfg=109 gui=underline guifg=#89b8c2 term=underline
hi ZenSpace ctermbg=203 guibg=#e27878
hi DiagnosticUnderlineInfo cterm=underline ctermfg=109 gui=underline guisp=#89b8c2 term=underline
hi DiagnosticInfo ctermfg=109 guifg=#89b8c2
hi DiagnosticSignInfo ctermbg=235 ctermfg=109 guibg=#1e2132 guifg=#89b8c2
Expand Down Expand Up @@ -421,7 +421,7 @@ hi! link TSNumber Constant
hi! link TSOperator icebergNormalFg
hi! link TSParameter icebergNormalFg
hi! link TSParameterReference icebergNormalFg
hi! link TSProperty TSField
hi! link TSProperty icebergNormalFg
hi! link TSPunctDelimiter icebergNormalFg
hi! link TSPunctBracket icebergNormalFg
hi! link TSPunctSpecial Special
Expand Down Expand Up @@ -449,6 +449,54 @@ hi! link typescriptMessage icebergNormalFg
hi! link typescriptNull Constant
hi! link typescriptParens icebergNormalFg

if has('nvim-0.8')
hi! link @attribute TSAttribute
hi! link @boolean TSBoolean
hi! link @character TSCharacter
hi! link @comment TSComment
hi! link @constructor TSConstructor
hi! link @conditional TSConditional
hi! link @constant TSConstant
hi! link @constant.builtin TSConstBuiltin
hi! link @constant.macro TSConstMacro
hi! link @error TSError
hi! link @exception TSException
hi! link @field TSField
hi! link @float TSFloat
hi! link @function TSFunction
hi! link @function.builtin TSFunctionBuiltin
hi! link @function.macro TSFunctionMacro
hi! link @include TSInclude
hi! link @keyword TSKeyword
hi! link @keyword.function TSKeywordFunction
hi! link @label TSLabel
hi! link @method TSMethod
hi! link @namespace TSNamespace
hi! link @number TSNumber
hi! link @operator TSOperator
hi! link @parameter TSParameter
hi! link @parameter.reference TSParameterReference
hi! link @property TSProperty
hi! link @punctuation.delimiter TSPunctDelimiter
hi! link @punctuation.bracket TSPunctBracket
hi! link @punctuation.special TSPunctSpecial
hi! link @repeat TSRepeat
hi! link @string TSString
hi! link @string.regex TSStringRegex
hi! link @string.escape TSStringEscape
hi! link @tag TSTag
hi! link @tag.attribute TSTagAttribute
hi! link @tag.delimiter TSTagDelimiter
hi! link @text TSText
hi! link @text.note Todo
hi! link @text.title TSTitle
hi! link @text.uri TSURI
hi! link @type TSType
hi! link @type.builtin TSTypeBuiltin
hi! link @variable TSVariable
hi! link @variable.builtin TSVariableBuiltin
endif

if !has('nvim')
hi! link SpecialKey Whitespace
endif
77 changes: 67 additions & 10 deletions src/iceberg.vim
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,14 @@ function! s:create_colors(palette) abort
\ 'guifg': g.orange,
\ }))

" [Tree-sitter](https://github.com/nvim-treesitter/nvim-treesitter)
" [zenspace.vim](https://github.com/thinca/vim-zenspace)
call extend(rules, pgmnt#hi#group(
\ 'ZenSpace', {
\ 'ctermbg': c.red,
\ 'guibg': g.red,
\ }))

" [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
call extend(rules, pgmnt#hi#group(
\ ['TSFunction', 'TSFunctionBuiltin', 'TSFunctionMacro'], {
\ 'ctermfg': c.pale,
Expand All @@ -585,13 +592,6 @@ function! s:create_colors(palette) abort
\ 'guifg': g.lblue,
\ 'term': 'underline',
\ }))

" [zenspace.vim](https://github.com/thinca/vim-zenspace)
call extend(rules, pgmnt#hi#group(
\ 'ZenSpace', {
\ 'ctermbg': c.red,
\ 'guibg': g.red,
\ }))
" }}}

" [Neovim built-in diagnostics](https://neovim.io/doc/user/diagnostic.html) {{{
Expand Down Expand Up @@ -830,7 +830,7 @@ function! s:create_links() abort
" [vim-swift](https://github.com/toyamarinyon/vim-swift)
call add(links, pgmnt#hi#link('swiftIdentifier', 'icebergNormalFg'))

" [Tree-sitter](https://github.com/nvim-treesitter/nvim-treesitter)
" [nvim-treesitter (old declaration)](https://github.com/nvim-treesitter/nvim-treesitter)
call add(links, pgmnt#hi#link('TSAttribute', 'Special'))
call add(links, pgmnt#hi#link('TSBoolean', 'Constant'))
call add(links, pgmnt#hi#link('TSCharacter', 'Constant'))
Expand All @@ -853,7 +853,7 @@ function! s:create_links() abort
call add(links, pgmnt#hi#link('TSOperator', 'icebergNormalFg'))
call add(links, pgmnt#hi#link('TSParameter', 'icebergNormalFg'))
call add(links, pgmnt#hi#link('TSParameterReference', 'icebergNormalFg'))
call add(links, pgmnt#hi#link('TSProperty', 'TSField'))
call add(links, pgmnt#hi#link('TSProperty', 'icebergNormalFg'))
call add(links, pgmnt#hi#link('TSPunctDelimiter', 'icebergNormalFg'))
call add(links, pgmnt#hi#link('TSPunctBracket', 'icebergNormalFg'))
call add(links, pgmnt#hi#link('TSPunctSpecial', 'Special'))
Expand Down Expand Up @@ -887,12 +887,68 @@ function! s:create_links() abort
return links
endfunction

function! s:create_neovim_08_links() abort
let links = []

" Rules for only Neovim 0.8 or higher plugins {{{
" [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
call add(links, pgmnt#hi#link('@attribute', 'TSAttribute'))
call add(links, pgmnt#hi#link('@boolean', 'TSBoolean'))
call add(links, pgmnt#hi#link('@character', 'TSCharacter'))
call add(links, pgmnt#hi#link('@comment', 'TSComment'))
call add(links, pgmnt#hi#link('@constructor', 'TSConstructor'))
call add(links, pgmnt#hi#link('@conditional', 'TSConditional'))
call add(links, pgmnt#hi#link('@constant', 'TSConstant'))
call add(links, pgmnt#hi#link('@constant.builtin', 'TSConstBuiltin'))
call add(links, pgmnt#hi#link('@constant.macro', 'TSConstMacro'))
call add(links, pgmnt#hi#link('@error', 'TSError'))
call add(links, pgmnt#hi#link('@exception', 'TSException'))
call add(links, pgmnt#hi#link('@field', 'TSField'))
call add(links, pgmnt#hi#link('@float', 'TSFloat'))
call add(links, pgmnt#hi#link('@function', 'TSFunction'))
call add(links, pgmnt#hi#link('@function.builtin', 'TSFunctionBuiltin'))
call add(links, pgmnt#hi#link('@function.macro', 'TSFunctionMacro'))
call add(links, pgmnt#hi#link('@include', 'TSInclude'))
call add(links, pgmnt#hi#link('@keyword', 'TSKeyword'))
call add(links, pgmnt#hi#link('@keyword.function', 'TSKeywordFunction'))
call add(links, pgmnt#hi#link('@label', 'TSLabel'))
call add(links, pgmnt#hi#link('@method', 'TSMethod'))
call add(links, pgmnt#hi#link('@namespace', 'TSNamespace'))
call add(links, pgmnt#hi#link('@number', 'TSNumber'))
call add(links, pgmnt#hi#link('@operator', 'TSOperator'))
call add(links, pgmnt#hi#link('@parameter', 'TSParameter'))
call add(links, pgmnt#hi#link('@parameter.reference', 'TSParameterReference'))
call add(links, pgmnt#hi#link('@property', 'TSProperty'))
call add(links, pgmnt#hi#link('@punctuation.delimiter', 'TSPunctDelimiter'))
call add(links, pgmnt#hi#link('@punctuation.bracket', 'TSPunctBracket'))
call add(links, pgmnt#hi#link('@punctuation.special', 'TSPunctSpecial'))
call add(links, pgmnt#hi#link('@repeat', 'TSRepeat'))
call add(links, pgmnt#hi#link('@string', 'TSString'))
call add(links, pgmnt#hi#link('@string.regex', 'TSStringRegex'))
call add(links, pgmnt#hi#link('@string.escape', 'TSStringEscape'))
call add(links, pgmnt#hi#link('@tag', 'TSTag'))
call add(links, pgmnt#hi#link('@tag.attribute', 'TSTagAttribute'))
call add(links, pgmnt#hi#link('@tag.delimiter', 'TSTagDelimiter'))
call add(links, pgmnt#hi#link('@text', 'TSText'))
call add(links, pgmnt#hi#link('@text.note', 'Todo'))
call add(links, pgmnt#hi#link('@text.title', 'TSTitle'))
call add(links, pgmnt#hi#link('@text.uri', 'TSURI'))
call add(links, pgmnt#hi#link('@type', 'TSType'))
call add(links, pgmnt#hi#link('@type.builtin', 'TSTypeBuiltin'))
call add(links, pgmnt#hi#link('@variable', 'TSVariable'))
call add(links, pgmnt#hi#link('@variable.builtin', 'TSVariableBuiltin'))
" }}}

return links
endfunction

function! s:create_context() abort
let d = s:create_colors(
\ iceberg#palette#dark#create())
let l = s:create_colors(
\ iceberg#palette#light#create())
let links = s:create_links()
let neovim_08_links = s:create_neovim_08_links()

return {
\ 'modified': strftime('%Y-%m-%d %H:%M%z'),
Expand All @@ -903,6 +959,7 @@ function! s:create_context() abort
\ 'light_neovim_term_defs': l.neovim_term_defs,
\ 'light_vim_term_defs': l.vim_term_defs,
\ 'links': links,
\ 'neovim_08_links': neovim_08_links,
\ }
endfunction

Expand Down
4 changes: 4 additions & 0 deletions src/template.vim
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ endif

{{ links }}

if has('nvim-0.8')
{{ neovim_08_links }}
endif

if !has('nvim')
hi! link SpecialKey Whitespace
endif

0 comments on commit e01ac08

Please sign in to comment.