From d096ff3dbec1ee9c8ded1b5bec8154deea3c804c Mon Sep 17 00:00:00 2001 From: Jojo Brandon Coffman Date: Thu, 7 Sep 2017 17:35:11 -0400 Subject: [PATCH 1/2] Allow pulsing even if on same line --- README.md | 5 +++++ autoload/search_pulse.vim | 3 +++ doc/search-pulse.txt | 4 ++++ plugin/search_pulse.vim | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/README.md b/README.md index c22c441..a020f87 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,10 @@ or just the search pattern: let g:vim_search_pulse_mode = 'pattern' +and whether or not to allow not pulsing the same pattern/line (1 is default) + + let g:vim_search_pulse_disable_if_same_line_pattern = 1 + If you want to set your own mappings, do: let g:vim_search_pulse_disable_auto_mappings = 1 @@ -51,6 +55,7 @@ the following global variable. For example: let g:vim_search_pulse_duration = 400 + The colors used by the pulse are `[237, 238, 239, 240, 241]` (gray scale) by default. A color map can be found at: http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html diff --git a/autoload/search_pulse.vim b/autoload/search_pulse.vim index 1a37d9f..8ede575 100644 --- a/autoload/search_pulse.vim +++ b/autoload/search_pulse.vim @@ -195,6 +195,9 @@ func! s:IsLineTooLong() endf func! s:IsPatternOnTheSameLine() + if !g:vim_search_pulse_disable_if_same_line_pattern + return + endif if !exists('s:old_line') let s:old_line = line('.') diff --git a/doc/search-pulse.txt b/doc/search-pulse.txt index 1de9635..33d4c9f 100644 --- a/doc/search-pulse.txt +++ b/doc/search-pulse.txt @@ -50,6 +50,10 @@ or just the search pattern: let g:vim_search_pulse_mode = 'pattern' +and whether or not to allow not pulsing the same pattern/line (1 is default) + + let g:vim_search_pulse_disable_if_same_line_pattern = 1 + If you want to set your own mappings, do: let g:vim_search_pulse_disable_auto_mappings = 1 diff --git a/plugin/search_pulse.vim b/plugin/search_pulse.vim index f035f36..3b942e8 100644 --- a/plugin/search_pulse.vim +++ b/plugin/search_pulse.vim @@ -12,6 +12,10 @@ nnoremap \ \ Pulse :call search_pulse#Pulse() +if !has_key(g:, 'vim_search_pulse_disable_if_same_line_pattern') + let g:vim_search_pulse_disable_if_same_line_pattern = 1 +endif + if get(g:, 'vim_search_pulse_disable_auto_mappings') != 0 finish endif From f5c9c0aa5cd3988f22bb04cd0d7c2d24b28f1b1d Mon Sep 17 00:00:00 2001 From: Jojo Brandon Coffman Date: Thu, 7 Sep 2017 17:38:31 -0400 Subject: [PATCH 2/2] Begin my adventure to make extended mappings for pulsing --- plugin/search_pulse.vim | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/plugin/search_pulse.vim b/plugin/search_pulse.vim index 3b942e8..8df15e2 100644 --- a/plugin/search_pulse.vim +++ b/plugin/search_pulse.vim @@ -27,3 +27,24 @@ nmap # #Pulse " Pulses cursor line on first match " when doing search with / or ? cmap search_pulse#PulseFirst() + +if get(g:, 'vim_search_pulse_disable_auto_extended_mappings') != 0 + finish +endif + +nmap Pulse +nmap Pulse +nmap G GPulse +nmap H HPulse +nmap M MPulse +nmap L LPulse +nmap ( (Pulse +nmap ) )Pulse +nmap [[ [[Pulse +nmap ]] ]]Pulse +nmap `[ `[Pulse +nmap `] `]Pulse +nmap { {Pulse +nmap } }Pulse +nmap zj zjPulse +nmap zk zkPulse