From a71ced9846d4276c15243bbab8da6b7ab351e66c Mon Sep 17 00:00:00 2001 From: Joshua Potter Date: Tue, 23 May 2017 21:04:02 -0700 Subject: [PATCH] Added expand_register option. --- autoload/highlight.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/autoload/highlight.vim b/autoload/highlight.vim index 2af8aa9..82c1367 100644 --- a/autoload/highlight.vim +++ b/autoload/highlight.vim @@ -30,6 +30,21 @@ let s:active_register = "\"" let s:registry = {} +" FUNCTION: ExpandRegister(reg) {{{1 +" ============================================================================== +" Convenience method to determine which register is being currently used. +" The unnamed register defaults to the last used register to avoid having to +" constantly prefix registration. This can be changed by setting the value of +" g:persist_unnamed_register to 1. + +function! highlight#expand_register(reg) + if !g:persist_unnamed_register && a:reg ==# '"' + return s:active_register + endif + return a:reg +endfunction + + " FUNCTION: ExpandFlag(flag) {{{1 " ============================================================================== " Convenience method used to make the mappings in plugin/highlight.vim a bit