Jump to any location specified by two characters.
Sneak is a powerful, reliable, yet minimal motion plugin for Vim. It works with multiple
lines, operators (including repeat .
and surround), motion-repeat
(;
and ,
), keymaps, visual mode, multibyte text, and
macros.
Try label-mode for a minimalist alternative to EasyMotion:
let g:sneak#label = 1
Sneak is invoked with s
followed by exactly two characters:
s{char}{char}
sab
to move the cursor immediately to the next instance of the text "ab".;
to go to the next match (or s
again, if s_next
is enabled; see :help sneak
).3;
to skip to the third match from the current position.ctrl-o
or ``
to go back to the starting point.s
invocation—not repeats—so you can
abandon a trail of ;
or ,
by a single ctrl-o
or ``
.s<Enter>
at any time to repeat the last Sneak-search.S
to search backwards.Sneak can be limited to a vertical scope by prefixing s
with a count.
5sxy
to go immediately to the next instance of "xy" within 5 columns
of the cursor.Sneak is invoked with operators
via z
(because s
is taken by surround.vim).
3dzqt
to delete up to the third instance of "qt"..
to repeat the 3dzqt
operation.2.
to repeat twice.d;
to delete up to the next match.4d;
to delete up to the fourth next match.yszxy]
to surround in brackets up to xy
..
to repeat the surround operation.gUz\}
to upper-case the text from the cursor until the next instance
of the literal text \}
.
to repeat the gUz\}
operation.Requires Vim 7.3+ or Nvim. Label-mode requires Vim 7.4.792+. With Nvim 0.5+ label-mode is driven by virtual text instead of the legacy "conceal" feature.
Plug 'justinmk/vim-sneak'
git clone git://github.com/justinmk/vim-sneak.git ~/.vim/bundle/vim-sneak
.vim
directory.To repeat Sneak operations (like dzab
) with dot .
,
repeat.vim is required.
/
?For the same reason that Vim has motions
like f
and t
: common operations should use the fewest keystrokes.
/ab<cr>
requires 33% more keystrokes than sab
;
, then return to the start with a single ctrl-o
or ``
f
?f
or t
s
?You can specify any mapping for Sneak (see :help sneak
).
By the way: cl
is equivalent to s
, and cc
is equivalent to S
.
f
with Sneak?map f <Plug>Sneak_s
map F <Plug>Sneak_S
f
and/or t
with one-character Sneak?Sneak has <Plug>
mappings for f
and t
1-character-sneak.
These mappings do not invoke label-mode, even if you have it enabled.
map f <Plug>Sneak_f
map F <Plug>Sneak_F
map t <Plug>Sneak_t
map T <Plug>Sneak_T
Copyright © Justin M. Keyes. Distributed under the MIT license.