1
Fork 0

Allow custom linking of prefixed group

master
Joshua Potter 2017-05-26 10:05:27 -07:00
parent ef0e11d86d
commit 758449bd72
4 changed files with 30 additions and 11 deletions

View File

@ -283,7 +283,7 @@ function! highlight#clear_register(reg)
endif endif
if a:reg ==# s:active_register if a:reg ==# s:active_register
hi! link Search NONE hi! link Search NONE
exe 'hi! link' g:highlight_register_prefix 'NONE' exe 'hi! link' g:highlight_register_prefix g:highlight_register_prefix_link
endif endif
endfunction endfunction

View File

@ -68,6 +68,14 @@ g:persist_unnamed_register
regard the unnamed register to implicitly imply use of the last activated regard the unnamed register to implicitly imply use of the last activated
register. register.
g:highlight_register_prefix
Prefix used in naming the generating highlight register highlight groups.
g:highlight_register_prefix_link
Default link the highligh group g:highlight_register_prefix points to.
============================================================================== ==============================================================================
Section 3: Statusline *highlight-statusline* Section 3: Statusline *highlight-statusline*

View File

@ -1,7 +1,6 @@
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ highlight-commands highlight.txt /*highlight-commands*
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ highlight-contents highlight.txt /*highlight-contents*
!_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/ highlight-registry highlight.txt /*highlight-registry*
!_TAG_PROGRAM_AUTHOR Universal Ctags Team // highlight-statusline highlight.txt /*highlight-statusline*
!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/ highlight-usage highlight.txt /*highlight-usage*
!_TAG_PROGRAM_URL https://ctags.io/ /official site/ highlight-variables highlight.txt /*highlight-variables*
!_TAG_PROGRAM_VERSION 0.0.0 /f1de2a89/

View File

@ -32,7 +32,7 @@ let g:loaded_highlight_registry = 1
if !exists('g:highlight_registry') if !exists('g:highlight_registry')
function! s:InitializeHighlightRegistry() function! s:InitializeHighlightRegistry()
let g:highlight_registry = {} let g:highlight_registry = {}
let l:colors = [ 'Yellow', 'Blue', 'Red', 'Magenta', 'Green', 'Cyan', let l:colors = [ 'Yellow', 'LightBlue', 'Red', 'Magenta', 'Green', 'Cyan',
\ 'DarkYellow', 'White', 'Gray', 'Black' ] \ 'DarkYellow', 'White', 'Gray', 'Black' ]
let l:index = 0 let l:index = 0
while l:index < len(l:colors) while l:index < len(l:colors)
@ -58,14 +58,26 @@ endif
" g:highlight_register_prefix :: String {{{2 " g:highlight_register_prefix :: String {{{2
" ------------------------------------------------------------------------------ " ------------------------------------------------------------------------------
" Prefix used for group names and for link between Search highlight group and " Prefix used for group names and for link between Search highlight group and
" the highlight registries. That is, hi link Search {g:highlight_register_prefix} " the highlight registries. That is,
" and hi link {g:highlight_register_prefix} {active search register}. " hi link Search {g:highlight_register_prefix}
" and
" hi link {g:highlight_register_prefix} {active search register}.
if !exists('g:highlight_register_prefix') if !exists('g:highlight_register_prefix')
let g:highlight_register_prefix = 'HighlightRegister' let g:highlight_register_prefix = 'HighlightRegister'
endif endif
" g:highlight_register_prefix_link :: String
" ------------------------------------------------------------------------------
" Name of the highlight group the highlight_register_prefix group should be
" linked to when no longer active. By default, this is NONE.
if !exists('g:highlight_register_prefix_link')
let g:highlight_register_prefix_link = 'NONE'
endif
" MAPPINGS: {{{1 " MAPPINGS: {{{1
" ============================================================================== " ==============================================================================