This is a companion discussion topic for the original entry at https://thoughtbot.com/upcase/videos/onramp-to-vim-command-language
Totally awesome. I love the /search n . combo.
Thanks! Glad youâre enjoying it.
Very useful video, vim is getting more and more useful for me!
One question: Wouldnât /<search term or character>
work for any situation, making both f<search character>
or t<search character>
redundant?
@sstgithub you certainly could use search for any t
or T
motion, but I find the explicitness of f
, t
, F
, and T
to map well to what Iâm thinking. Also, searches only go up to the matching text, so you canât replicate f
directly.
This is awesome.
Great stuff. Thanks a bunch.
Great episode! What I still canât figure out though is how to jump camel or snake case parts of variable, method, and class names?
Hi @alexvbush, thanks for the kind words! For snake case motion you can use f_
to âfindâ the next underscore, then ;
to repeat that motion to find the next, and the next, and the next. That said, Iâd probably use a search to more directly target the thing youâre after, but either would work.
For camel case, you can likely get there directly by targeting the capitalized letter youâre seeking as it will likely be unique, so given hello[W]orldVariableNameHere
, with your cursor on the W
in word, you could use fN
to jump to the N
in name. Again, a search would also work here, and would likely be what Iâd use.
More generally, if you regularly find yourself wanting to move via word based things like that, you might want to check out plugins like CamelCaseMotion or vim-wordmotion.