I edit a lot of Scala code in Vim, which means I hit f =
a lot, as I head to the RHS of a case statement (or whatever else):
case PatternMatch(a, b, c) => RHS Here
But Scala supports unicode characters, which means that a lot of people will use ⇒
instead of =>
and that makes f ...
a pain in the butt. Does anyone know how if there's a way to make f =
move to the next =
or ⇒
, whichever comes first?
Try adding this to your vimrc:
nmap f= :call search('=\\|⇒')<CR>
That will alias (map) f=
to a call to the search function that will jump to the next =
or ⇒
.
bundacia's answer is the one you asked for. Another option is to use digraphs. You can type ⇒
in vim by typing <C-k>=>
in insert mode. You can also use this digraph with the f
command (e.g. f<C-k>=>
). No need for mappings etc. though it may be somewhat inconvenient to type.
I prefer this solution since it preserves other operator pending commands such as df=
, cf=
, etc. and allows the use of F
, t
, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With