Become A Neovim Kangaroo
HTML-код
- Опубликовано: 25 июн 2024
- A quick tour of the Leap plugin for Neovim, which allows you to move your cursor to any place in the window extremely quickly.
00:00 Traditional vim movements
00:59 Leap movement
02:48 Predecessors of Leap
03:53 More Leap Features
05:39 Groups
06:34 Conclusion
-
Stuff I use to make these videos - I absolutely love all of these products. Using these links is an easy way to support the channel, thank you so much if you do so!!!
Camera: Canon EOS R5 amzn.to/3CCrxzl
Monitor: Dell U4914DW 49in amzn.to/3MJV1jx
Lens: Sigma 24mm f/1.4 DG HSM Art for Canon EF amzn.to/3hZ10mz
SSD for Video Editing: VectoTech Rapid 8TB amzn.to/3hXz9TM
Microphone: Rode NT1-A amzn.to/3vWM4gL
Microphone Interface: Focusrite Clarett+ 2Pre amzn.to/3J5dy7S
Tripod: JOBY GorillaPod 5K amzn.to/3JaPxMA
Keyboard: Redragon Mechanical Gaming Keyboard amzn.to/3I1A7ZD
Mouse: Razer DeathAdder amzn.to/3J9fYCf
Computer: 2021 Macbook Pro amzn.to/3J7FXtW
Caffeine: High Brew Cold Brew Coffee amzn.to/3hXyx0q
More Caffeine: Monster Energy Juice, Pipeline Punch amzn.to/3Czmfox
Building A Second Brain book: amzn.to/3cIShWf Наука
This is how I always wanted to use VIM back in my university days. I think removing cognitive overhead and the number of core commands is a huge win and gets us closer to the simplicity of what a mouse offers with see, click, action
agree 💯. Recently I've been using avy in emacs which is great, but isn't quite as good as leap imo
This is amazing. I couldn't understand this concept with sneak, etc. So I just kept using hop. I'll have to take a leap now.
Nice, yeah it's worth giving a try!
The jump to splits is flipping awesome!
I agree! I'm currently using something called avy in emacs to do something similar, but the experience isn't quite as good as what Leap provides.
Thinking about optimising for the number of keystrokes is not what I expected my day to look like. Love your videos.
It was a good idea to compare the plugin with default functionality to show the value of it.
Definitely going to add this plugin and start using it. Was looking for a plugin to help me get into these motions. This is it
Nice, hope you like it!
Just for a change, distilling complexity into palatable pills for us lazy devs. Leap looks amazing, thanks again for yet more extremely useful content!
Thanks MrKeebs! I think laziness can be a virtue in our field 😎
Thanks for sharing, great plug in 🎉
This blown me away about how effective this plugin does! Very simple, but very effective, makes my brain 1 less vim combo to jump, I guess I should take a leap
I agree it's pretty great!
This is exactly what I am looking for. I was starting to use vimium for browser and it does like similiar thing with f key and clicking on links. Thanks for video
I use leap it's great.
But Vim's native search has some awesome features:
Navigate matches easily:
n ➡ next match
N ⬅ previous match
2n ⏩ 2 matches forward
2N ⏪ 2 matches backward
Jumplist integration for quick navigation:
c-o 🔄 move backward through visited matches
c-i 🔄 move forward through visited matches
Can be used as a motion so for example, you can edit matches directly:
dn ✂ delete up to next match
d2n ✂ delete up to 2nd next match, and so on
dN ✂ delete up to previous match
d2N ✂ delete up to 2nd previous match, and so on
Give native search a try and improve your Neovim workflow! 🚀
This how the vim bindings chrome extension works. It’s my most used chrome shortcut!
This is insanely good
assuming you're talking about Leap - I agree! If that's not the case and you're referring to the video - I still agree! 🙃
@@codetothemoon both things
I saw Leap come up on Hacker News, and for whatever reason I just couldn't understand from reading about it how it was different from Sneak. Very clear on video. Thanks!
Thanks Jack, glad you found it valuable!
this is eye opening for someone new to neovim!
nice, glad you got something out of it!
Amazing video! Thanks!!
Recently started using this plugin. Definitely saves a ton of keystrokes!
Nice!! That was my take on it as well
Definitely going for this one. Have been missing such a feature since I left VS Code with MetaGo plugin installed
Thank you for introducing me to metago
god damnit another kickass tip. This is a game changer...no more helix
Great video, thanks!
glad you liked it, thanks for watching!
2 AM in the morning...
her: he must be out cheating
me: I am becoming a neovim kangaroo!
hah! indeed...
This should be the new default way of navigating in vim. So much more intuitive than relative numbers, with the added benefit of jumping directly to the character you want to land on.
Using lightspeed, I'm really excited to try leap 👍
It's great, even better than lightspeed 😃
Holy shit.
I was briefly confused why there where some labels multiple times and then it hit me and I LOVE it.
Just from a technical and usability standpoint that’s so awesome.
Agree 💯 - sometimes I feel like I am controlling the cursor with my mind 🙃
Cool, I have Hop and Lightspeed installed, I might just replace them and try to use it more.
I never considered the other plugins. But this is really nice
I agree!
Cool plug. I'll give it a try! Also I couldn't help but notice your incorrect use of "preceding" - I think postceding is the word you are thinking of.
I had always wondered why there wasn’t vertical version of f and t. I guess there kind of is with this!
I hadn't thought of it that way!
I guess with leap or other similar motion plugin you are only jumping around the the visible part and for other cases you still need to use / to find.
Have you tried Hop and how would you compare these two?
Thank you for sharing the experience with the new useful plugin, but what about the easymotion plugin? I use it for a long time and it's quite cool.
Yeah, I'm not sure how this is an improvement to easymotion as well and would have to experiment to find out.
I am used to EasyMotion, so Leap placing the label on the third character was confusing, but it does make sense to not obscure the target.
first example: L{-d/chain_ then press Return ... Ctrl-o twice to get back ... you don't have to think, you just move (if you know how to use vim) ... learn to navigate vim/nvim better and use ex commands more effectively, and you will eliminate most of your plugins. And yes, I use basically all of the movement commands like this probably four-thousand times per day. I just "speak vim". Yes, I know no one starts there, but that's the beauty of [n]vim. maybe if you try to keep learning and avoiding plugins (more often than not), you can also keep improving.
Nope, `-d/chain_` will delete everything from the start of the line up to but not including the `chain_`. Also if we there is no `chain_` it's gonna be wild deletion!
@@gauff3r /chain_dgn or /chdf_ or a billion other things
The character that comes after "c," the "h," would be the character that FOLLOWS the first one, not the one that PRECEDES the first one.
wow the concept of colored groups is COOL! BUT I wish they used that for the previous and after instead of using capital S s respectively. But cool nonetheless
I didn't like the plugin until I used the plugin vimium in firefox, which does ruffly the same when browsing threw the internet. I really like it because i dont have to move my hand for the mouse.
At this point, I began to like the 'sneak' plugin, but it got 1 disadvantage: You can't combine it with other vim moves.
the real save is focusing the relative line number which is quite an effort, i still don't know if this is worth a plugin
So it's like easy_motion in normal vim
I’d need to think of a suitable key to use instead of ‘s’. I know there are alternatives to ‘s’ in normal mode but it’s just too ingrained. I do like the general idea though and use a similar, less refined way to follow web page links (f/F with the Vimium extension)
Have you found a good key for this, I’ve got the same problem
@@Tijme no, I'm just accustomed to non-optimal horizontal movements now!
@@Tijme if I were to install and use this, I'd probably try 'q'. I don't use that for much - just 'Q' as a shortcut for 'gq'. No good if you use macros a lot though...
I'm liking how LazyVim uses / for leap. Then you could map s back to substitute.
Do you explain it very well thank you very much for it because the author of the plug-in didn’t made a very good work at that. However, I still prefer pounce. It allows me to jump back-and-forth, also between splits, and I can type as much or as few as I need
thanks glad you got something out of it! I hadn't heard of Pounce, maybe I'll check it out 😎
@@codetothemoon I recommend it to test it. It al boils down to your mental model, but for my way of thinking pounce is a better fit
emacs has a similar plugin, and when it runs out of letter in the alphabet uses 2 letter labels.
What font are you using here?
I was reading Lazy nvim keybindings and spotted leap keybindings, didn't know what it was.
it's cool that LazyVim includes Leap out of the box! When I made this video I actually hadn't tried any of the nvim config frameworks yet, but I think now I may be using something like NvChad or LazyVim when I'm not using emacs
Didn't it break your 'change' 'till' command? In my case, if I type 'ct' while in normal mode, it did not do the expected action; I deleted this plugin and it started working again.
Weird I didn't have that problem - the only thing that "broke" for me were the original functions of 's' and 'S', which doesn't really matter because 'cc' and 'cl' do the same thing
I kind of live with the problem that the plugin author wants to solve. My tricks: Skip pressing n multiple times using L, maybe M or }, then n when it's nearer.
Search for boundaries, not beginnings. By first instinct I'd type /_ch in that first example. Jump to `fn load....` with /n l instead of /lo
Reminds me of Vimium
you forgot my favorite option. jjjjjjjjjjjjjwwwwwwlllllllllllllllllllll
This man vims
And my favorite option. Ctrl+C, Ctrl+C … Reboot via power button. Open the file in a different editor. Click where you want to set the cursor.
@@31redorange08 ye honestly this guy is like "oh wow this method is 8 keys and this is 7 keys", bruh mouse is one key instantly there
But i love using the s key for substitute as in default vim. Which key should i map leap to?
you could map leap to any key you don't use in normal mode like ; for example
in my case i like using s for leap as i search more often than substitue, but can still substitute by typing cl
This looks great, but I am worried about conflicts with sandwich (similar to surround) with the use of the "s". Not sure how to remap things.
I found using z maybe for the leap plugin would make sense.
I haven't personally used sandwich so I'm not sure. I believe I was using only the default key bindings when I was using Leap. I heard Flash.nvim is all the rage these days, but I haven't tried it yet...
whats the font you're using
Does anyone else just use builtin (neovim|vim) sed replacement? It's a feature I use daily since it supports backreferences
I use it all the time!
Which colorscheme and font is this? looks great
Plug 'sainnhe/sonokai'
colorscheme sonokai
😎
font is Monaco
@@codetothemoon thank you very much!
This just looks like avy for (neo)vi(m)
Always funny watching y'all (re)discover classic emacs packages in your ecosystem
I've actually started using emacs recently (and I think I might be hooked). I had been wondering about the equivalent to Leap in emacs, I'm definitely going to be checking out avy!
I use hop and didn't know about leap. Now I'm confused 🙂 A comparison would be useful.
Leap tries to be smarter about not needing labels if it doesn't have to. I've tried leap but prefer hop because it has a consistent workflow by always showing labels unless there's exactly one match.
Hey! What do you think about creating a Discord server for your channel?
Is this better than vim-easymotion?
my understanding is that it's intended to be a successor of sorts to vim-easymotion, but I haven't tried it so I can't say for sure whether it achieves this
do you use nvim for knowledge management? if so then how
great question - currently no - for better or worse I currently use Notion, which I actually love. But I foresee myself switching to something like org mode in the near future, though I'm not entirely sure with which editor - possibly nvim. I'll probably make a video about this once the dust settles!
@@codetothemoon would like to see that, im using obsidian and used notion for a while. i wish i could have obsidian inside neovim
@@Heshamelfakharani You can, almost - use telekasten, it's great
I use the standard 's' a lot. If I used this plugin, I'd map it to another character instead.
I think 'cl' does the same thing - would you be using that functionality more than Leap movements?
It is remapping standard s and S keys, I use s with sandwich plugin, and I use S a lot, probably I can change them to leader-s and leader-S.
I initially had issues with this as well, then I realized cc does the same thing as S!
@@codetothemoon good to know, thanks
I have enabled mouse support. I simply click on on c in choice and do a `dw`. Just a click and one motion. No plugin needed. No mental overhead.
Different folks prefer different tradeoffs and I think that's ok! Personally I find moving my right hand between the keyboard and the mouse extremely expensive compared to tapping a few keys on the keyboard. Of course on a time scale of a few minutes it's not ultra perceptible, but when considered in the context of an 8-10 hour workday, for me the difference in speed and fatigue is huge.
@@codetothemoon Respect that. Every workflow is different and it's a good thing to have many choices that can cater to different styles. More power to you.
Is there something like this for vscode?
Yeah, easymotion vim plugin is included in vscode-vim. Or, if you don't want to use vim in vscode, you can you Code Ace Jumper plugin.
use the mouse
This seems like easymotion
yeah very similar idea, with a slightly different approach that some may prefer
Better than hop
Why not just type n immediately after typing sc?
It seems this method allows Leap to use duplicate labels when there are more matches than the alphabet.
i use touchpad :)
But i thought you use emacs
touche! I use whatever editor I prefer at the time, and that has definately fluctuated a bit in the past year or so 😎
I just use my mouse to click on the word where I want my cursor to be.. 1 click.
Next level! 😎
But you also moved your arm, plus have to move it back to get to where you were. So 3 moves? (Arguably larger/intensive movement too...)
@@oktokt How about you keep your fingers on the keyboard while using your thumbs on the touchpad... solved?
@@returntosender9778 the precision of that will be much lower than with a mouse, and will still be slower than using vim motions
@@returntosender9778 using thumbs on touchpad is uncomfortable af
or just double click the word in vscode/sublime text editor and hit delete ? what's so wrong with the mouse guys, for real
I don't think the problem is with the mouse specifically. For me at least, the issue is the overhead of switching back and forth between the mouse and keyboard. It doesn't seem like much when looked at in isolation, but when you're doing it 1000 times in a day, pruning it out of your workflow becomes incredibly freeing. It's something that's really hard to quantify the benefit of, which I think is why most folks are still using the mouse.
@@codetothemoon dang I think I will try this at some point. there's just so much more I want to learn that I don't want to go into yet another tangential rabbithole :D
I would do this :%s/_chain_file/_file
I know vim community has a different mindset... but..... why can't you just drag the mouse over to where you want your cursor to jump?
because of the overhead of shuttling your hand between the mouse and keyboard. Wouldn't be an issue if you were only doing it ~10 times a day, but when you're doing it hundreds or thousands of times a day, it becomes pretty incredible to be able to just keep your hands on the keyboard the entire time
seems somewhat clunky, as you need to wait for and process visual feedback.
it's pretty much easymotion too
yeah i should have mentioned that one! like the other predecessors it does seem to have a bit of an edge over it too
"Is there already something out there". Its called a mouse 😂
Mouse? Never heard of it 😎
I notice a lot of people [still] obsessing about key strokes. I am more worried about expending mental energy. When I want to do something, I need to do it without thinking, so I can focus on the task. I have found that as I learned to use the defaults of vim better, I was able to "speak" to the editor without thinking. Even though something like L{kf_;ld; seems like a lot of key strokes, to me this is a very simple sentence that reads "go to last blank line before bottom of screen" (`L{`), then "go up a line" (`k`), then "find '_' and then go to the right of the next '_'" (`f_;l`), and finally "delete until the next '_' that was already matched" (`d;`). I, personally, don't have to think about that at all. It is like speaking English. Okay, it was very "verbose" compared to 4 key strokes, but it is way more general and I can type pretty fast. When you are writing English sentences in prose, do you think about how many key strokes you could save by copying and pasting the word "the"? No, you don't. I don't think this plugin is useless, but I think that there is an emphasis on saving key strokes when the emphasis should be on timeliness and mental energy conservation.
And if you want to vim golf things for no reason other than it's fun or you like to get things to be as short as possible L?chdf_
you kept saying "preceding" instead of "following"
thanks - turns out i made up my own word. I thought "proceding" was actually a word that meant after, just like "preceding" means before. turns out there is no such word. kind of embarrassing 🙃
:%s/chain_\(file(\)/\1/g
Now it's fixed everywhere else you made the same mistake too! I'm not sure like this plugin. You already have H/M/L to jump to positions on the screen. On this case originally, the function you were trying to change was really close to the middle, so you could just do M5W and be very close to the spot you're trying to edit in 3 key strokes.
Also, with a bit of regex practice, you could search for ch.*_ to uniquely jump to that exact spot and skip over the similar alternatives
This is only useful if you are intelligent and want to save time and get more done.
If you just showed leap I would've gone "wow awesome"
You didn't have to show that you're bad at vim lol
Ouch! What can I do to improve?
@@codetothemoon try :h smile
@@serpico3w767 I've used it - was there something I did sub-optimally in the video? I'm always looking to improve!
@@codetothemoon you have jumped several times in the first method. You could've done it in 1 if you had searched for n_f
@@serpico3w767 searching for n_f would be 5 keystrokes, not 1 right? Definitely better than 8 - but the point here is there might be code between your cursor and the target that may make getting there efficiently via a search infeasible.
any idea why when I hit "s" it tries to go into insert mode? I tried to use this as my packer config
use {
'ggandor/leap.nvim',
config = function()
require('leap').add_default_mappings()
end,
}
nvm I fixed it...required putting the add_default_keymaps in another file, didn't like it being in the "config" there at least in my case
Nice, glad you were able to get it working!
@@codetothemoon thank you :) have delved further into your channel since posting, great rust content!
I prefer Hop.nvim
I haven't tried it - maybe I'll check it out!