" ============================================================================== " File: highlight.vim " Maintainer: Joshua Potter " " ============================================================================== if exists('g:loaded_highlight_registry') finish endif let g:loaded_highlight_registry = 1 " GLOBAL VARIABLES: " ============================================================================== " g:highlight_registry :: { String : String } {{{2 " ------------------------------------------------------------------------------ " The following dictionary corresponds to registers 0-9 and their respective " colors. Adjust this to set the colors for a given register. If a register " isn't added to this dictionary before being attempted to be used, one of the " least most colors will be chosen instead. See *cterm-colors*. " TODO(jrpotter): Allow for better automatic color choices. if !exists('g:highlight_registry') let g:highlight_registry = { '0' : 'Yellow', \ '1' : 'Blue', \ '2' : 'Red', \ '3' : 'Magenta', \ '4' : 'Green', \ '5' : 'Cyan', \ '6' : 'DarkYellow', \ '7' : 'White', \ '8' : 'Gray', \ '9' : 'Black', \ } endif " MAPPINGS: {{{1 " ============================================================================== " Append Searches noremap HRegistry_AppendToSearch \ :call highlight#append_to_search(v:register, 'c') \ call highlight#count_pattern('c') noremap HRegistry_GAppendToSearch \ :call highlight#append_to_search(v:register, 'g') \ call highlight#count_pattern('g') noremap HRegistry_VisualAppendToSearch \ :call highlight#append_to_search(v:register, 'v') \ call highlight#count_pattern('v') " Remove Searches noremap HRegistry_RemoveFromSearch \ :call highlight#remove_from_search(v:register, 'c') noremap HRegistry_VisualRemoveFromSearch \ :call highlight#remove_from_search(v:register, 'v') " Other Modifications noremap HRegistry_ClearRegister \ :call highlight#clear_register(v:register) \ call highlight#activate_register(v:register) noremap HRegistry_ActivateRegister \ :call highlight#activate_register(v:register) noremap HRegistry_CountLastSeen \ :call highlight#count_pattern('c') " Normal Mappings nmap & HRegistry_AppendToSearch nmap g& HRegistry_GAppendToSearch nmap y& HRegistry_ActivateRegister nmap d& HRegistry_RemoveFromSearch nmap c& HRegistry_ClearRegister nmap * :silent norm! *& nmap g* :silent norm! *g& nmap # :silent norm! #& nmap g# :silent norm! #g& " Visual Mappings vmap & HRegistry_VisualAppendToSearch'< vmap d& HRegistry_VisualRemoveFromSearch'< vmap * &nHRegistry_CountLastSeen vmap # &NHRegistry_CountLastSeen " PROCEDURE: Commands {{1 " ============================================================================== command ClearHighlightRegistry :call highlight#reset() " PROCEDURE: Initialize {{{1 " ============================================================================== call highlight#reset()