Skip to content

Commit

Permalink
Add API: sneak#is_sneaking()
Browse files Browse the repository at this point in the history
This api provides more flexible mapping using `<expr>`
Especially for customizing clever_s feature

Example:

    nmap gs <Plug>Sneak_s
    nmap <expr> s sneak#is_sneaking() ? '<Plug>SneakNext' : 's'
  • Loading branch information
haya14busa committed Mar 19, 2014
1 parent efb8c19 commit 577d2a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugin/sneak.vim
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ endf

call sneak#init()

func! s:is_sneaking()
func! sneak#is_sneaking()
return exists("#SneakPlugin#CursorMoved#<buffer>")
endf

Expand All @@ -48,7 +48,7 @@ func! sneak#wrap(op, inputlen, reverse, inclusive, streak) range abort
"TRICKY: use v:prevcount for visual mapping because we <esc> before the ex command.
let l:count = max([1, v ? v:prevcount : v:count1])

if g:sneak#opt.s_next && (v || empty(a:op)) && s:is_sneaking() && is_similar_invocation
if g:sneak#opt.s_next && (v || empty(a:op)) && sneak#is_sneaking() && is_similar_invocation
call sneak#rpt(a:op, l:count, a:reverse) " s goes to next match
else " s invokes new search
call sneak#to(a:op, s:getnchars(a:inputlen, a:op), a:inputlen, l:count, 0, a:reverse, a:inclusive, a:streak)
Expand Down

0 comments on commit 577d2a7

Please sign in to comment.