Mercurial > ec-dotfiles
comparison vendor/vim-packs/srcery-vim/autoload/srcery/helper.vim @ 739:2cf87b7ca09a
Update vendored stuff
| author | nanaya <me@nanaya.net> |
|---|---|
| date | Thu, 09 Jan 2025 03:28:23 +0900 |
| parents | 1e0f578f6752 |
| children |
comparison
equal
deleted
inserted
replaced
| 738:687d9ee4a5c9 | 739:2cf87b7ca09a |
|---|---|
| 20 let l:term_color = synIDattr(hlID(a:group), l:what, 'cterm') | 20 let l:term_color = synIDattr(hlID(a:group), l:what, 'cterm') |
| 21 | 21 |
| 22 return [ l:gui_color, l:term_color ] | 22 return [ l:gui_color, l:term_color ] |
| 23 endfunction | 23 endfunction |
| 24 | 24 |
| 25 " With the help of dracula! | |
| 26 " Helper function that takes a variadic list of filetypes as args and returns | |
| 27 " whether or not the execution of the ftplugin should be aborted. | |
| 28 function! srcery#helper#ShouldAbort(...) abort | |
| 29 if ! exists('g:colors_name') || g:colors_name !=# 'srcery' | |
| 30 return 1 | |
| 31 elseif a:0 > 0 && (! exists('b:current_syntax') || index(a:000, b:current_syntax) == -1) | |
| 32 return 1 | |
| 33 endif | |
| 34 return 0 | |
| 35 endfunction | |
| 36 | |
| 37 function! srcery#helper#Highlight(group, fg, ...) abort | |
| 38 " Arguments: group, guifg, guibg, gui, guisp | |
| 39 | |
| 40 " foreground | |
| 41 let l:fg = a:fg | |
| 42 | |
| 43 " background | |
| 44 if a:0 >= 1 | |
| 45 let l:bg = a:1 | |
| 46 else | |
| 47 let l:bg = g:srcery#palette.none | |
| 48 endif | |
| 49 | |
| 50 " emphasis | |
| 51 if a:0 >= 2 && strlen(a:2) | |
| 52 let l:emstr = a:2 | |
| 53 else | |
| 54 let l:emstr = 'NONE,' | |
| 55 endif | |
| 56 | |
| 57 " special fallback | |
| 58 if a:0 >= 3 | |
| 59 if g:srcery_guisp_fallback !=# 'NONE' | |
| 60 let fg = a:3 | |
| 61 endif | |
| 62 | |
| 63 " bg fallback mode should invert higlighting | |
| 64 if g:srcery_guisp_fallback ==# 'bg' | |
| 65 let emstr .= 'inverse,' | |
| 66 endif | |
| 67 endif | |
| 68 | |
| 69 let l:histring = [ 'hi', a:group, | |
| 70 \ 'guifg=' . l:fg[0], 'ctermfg=' . l:fg[1], | |
| 71 \ 'guibg=' . l:bg[0], 'ctermbg=' . l:bg[1], | |
| 72 \ 'gui=' . l:emstr[:-2], 'cterm=' . l:emstr[:-2] | |
| 73 \ ] | |
| 74 | |
| 75 " special | |
| 76 if a:0 >= 3 | |
| 77 call add(l:histring, 'guisp=' . a:3[0]) | |
| 78 endif | |
| 79 | |
| 80 execute join(l:histring, ' ') | |
| 81 endfunction | |
| 82 | |
| 83 " vim: fdm=marker ts=2 sts=2 sw=2 fdl=0: | 25 " vim: fdm=marker ts=2 sts=2 sw=2 fdl=0: |
