diff --git a/doc/sneak.txt b/doc/sneak.txt index 762772f..133a92b 100644 --- a/doc/sneak.txt +++ b/doc/sneak.txt @@ -61,7 +61,7 @@ NORMAL-MODE~ [count]S{char}{char} | Invoke backwards |sneak-vertical-scope| {operator}z{char}{char} | Perform {operator} from the cursor to the next | occurrence of {char}{char} - {operator}Z{char}{char} | Perform {operator} from the cursor to the + {operator}Z{char}{char} | Perform {operator} from the cursor to the | previous occurrence of {char}{char} NOTE: s and S go to the next/previous match immediately after invoking @@ -259,6 +259,13 @@ OPTIONS *sneak-options* To change an option, add a |let| statement in your |vimrc|. Example: > let g:sneak#use_ic_scs = 0 < +g:sneak#no_default_mappings = 0 + + 0: Apply all the default |sneak-mappings| that escape from the checks + through hasmapto() and mapcheck(). + + 1: Disable any |sneak-mappings|. See |sneak-custom-mappings|. + g:sneak#f_reset = 1 g:sneak#t_reset = 1 diff --git a/plugin/sneak.vim b/plugin/sneak.vim index 1759927..46fdd71 100644 --- a/plugin/sneak.vim +++ b/plugin/sneak.vim @@ -363,41 +363,43 @@ xnoremap SneakLabel_S :call sneak#wrap(visualmode(), 2, 1, 2 onoremap SneakLabel_s :call sneak#wrap(v:operator, 2, 0, 2, 2) onoremap SneakLabel_S :call sneak#wrap(v:operator, 2, 1, 2, 2) -if !hasmapto('SneakForward') && !hasmapto('Sneak_s', 'n') && mapcheck('s', 'n') ==# '' - nmap s Sneak_s -endif -if !hasmapto('SneakBackward') && !hasmapto('Sneak_S', 'n') && mapcheck('S', 'n') ==# '' - nmap S Sneak_S -endif -if !hasmapto('Sneak_s', 'o') && mapcheck('z', 'o') ==# '' - omap z Sneak_s -endif -if !hasmapto('Sneak_S', 'o') && mapcheck('Z', 'o') ==# '' - omap Z Sneak_S -endif +if !get(g:, 'sneak#no_default_mappings', 0) + if !hasmapto('SneakForward') && !hasmapto('Sneak_s', 'n') && mapcheck('s', 'n') ==# '' + nmap s Sneak_s + endif + if !hasmapto('SneakBackward') && !hasmapto('Sneak_S', 'n') && mapcheck('S', 'n') ==# '' + nmap S Sneak_S + endif + if !hasmapto('Sneak_s', 'o') && mapcheck('z', 'o') ==# '' + omap z Sneak_s + endif + if !hasmapto('Sneak_S', 'o') && mapcheck('Z', 'o') ==# '' + omap Z Sneak_S + endif -if !hasmapto('Sneak_;', 'n') && !hasmapto('SneakNext', 'n') && mapcheck(';', 'n') ==# '' - nmap ; Sneak_; - omap ; Sneak_; - xmap ; Sneak_; -endif -if !hasmapto('Sneak_,', 'n') && !hasmapto('SneakPrevious', 'n') - if mapcheck(',', 'n') ==# '' - nmap , Sneak_, - omap , Sneak_, - xmap , Sneak_, - elseif mapcheck('\', 'n') ==# '' || mapcheck('\', 'n') ==# ',' - nmap \ Sneak_, - omap \ Sneak_, - xmap \ Sneak_, + if !hasmapto('Sneak_;', 'n') && !hasmapto('SneakNext', 'n') && mapcheck(';', 'n') ==# '' + nmap ; Sneak_; + omap ; Sneak_; + xmap ; Sneak_; + endif + if !hasmapto('Sneak_,', 'n') && !hasmapto('SneakPrevious', 'n') + if mapcheck(',', 'n') ==# '' + nmap , Sneak_, + omap , Sneak_, + xmap , Sneak_, + elseif mapcheck('\', 'n') ==# '' || mapcheck('\', 'n') ==# ',' + nmap \ Sneak_, + omap \ Sneak_, + xmap \ Sneak_, + endif endif -endif -if !hasmapto('VSneakForward') && !hasmapto('Sneak_s', 'v') && mapcheck('s', 'x') ==# '' - xmap s Sneak_s -endif -if !hasmapto('VSneakBackward') && !hasmapto('Sneak_S', 'v') && mapcheck('Z', 'x') ==# '' - xmap Z Sneak_S + if !hasmapto('VSneakForward') && !hasmapto('Sneak_s', 'v') && mapcheck('s', 'x') ==# '' + xmap s Sneak_s + endif + if !hasmapto('VSneakBackward') && !hasmapto('Sneak_S', 'v') && mapcheck('Z', 'x') ==# '' + xmap Z Sneak_S + endif endif " redundant legacy mappings for backwards compatibility (must come _after_ the hasmapto('Sneak_S') checks above)