Vim As You Editor - Advanced Motions P1
HTML-код
- Опубликовано: 10 сен 2022
- YES!! that is right. A new vim series.
IF YOU LIKE THIS, BETTER LIKE THE VIDEO BECAUSE I'LL TAKE THIS FAR IF THERE IS ENOUGH LIKES
Twitch
Everything is built live on twitch
Twitch : bit.ly/3xhFO3E
Discord: discord.gg/ThePrimeagen
Spotify DevHour: open.spotify.com/show/4MLaDrQ...
Editor
All my videos are edited by Flip. Give him a follow! / flipmediaprod He is also open to do more editing, so slide deeeeeeeeep into his dms.
Links
Linode: linode.com/prime
/ discord
Twitch: / theprimeagen
Insta: / theprimeagen
Twitter: / theprimeagen
VimRC & i3: github.com/ThePrimeagen/.dotf...
Keyboard 15% off bit.ly/Prime360 USE CODE PRIME360
#vim #programming #softwareengineering Наука
Great video! I'd love a video about working with multiple files, or "project-based navigation" whether it's using buffers, split windows, tabs, harpoon, whatever. Most of the time, I find myself cd-ing into the project and repeatedly opening/closing files for editing. I think a dedicated video about this topic would be great. Cheers from Germany!
I solved partially this problem by using the fuzzy search in recently opened files/git files. I use Telescope for the search, and have some remap to navigate in the list without leaving the main key (I dont use the arrows).
Sometimes, I use :e path to open a file, or netrw in a folder, so I never quit vim even if I search a file in my files manually.
@@BigToinE976 Gret tip re: telescope. One problem I suffer from is that when I close the last file, my whole Neovim instance terminates. Instead I'd love to have an empty buffer or netrw instance that is "un-quittable" (sometimes I want to close all files to regain control of my environment). Were you able to address this issue somehow?
@@aydiology You could use :bd (buffer delete) with a remap. It deletes the buffer and leaves you with an empty vim if it was the last buffer you had.
Just use keymaps for buffers and a fuzzy finder
For searching im using FZF search + fzf 'grep' kind of search if I don't remember where I have an object im looking for.
For jumping back and forth between func/object definitions/implementations Im using lsp go to definition / implementation, this feature is godsent, so fast and convenient, Im using it all the time.
If I need a grasp on a project structure (for example if I haven't worked on it for couple months, or if its just a new project I aint familliar with), or if I need to create a new file without rebooting vim (by default you have to if you are using lsp or other linters/type checkers etc), im using nerd tree
For console actions (i.e. for git, shell commands etc) I have a tmux hsplit and a few other tabs if I wanna run tests / ssh to a server / run a dev server etc
Also I am using auto save plugin, cause using multiple buffers without it could be a mess, and in general its just very convenient, if you accidentally changed something, you can just revert it using git, but it practically never happens
So my workflow looks like that:
Im opening my nvim from a project root folder (not a concrete file)
Im using fzf, fzf grep or nerdtree to find and jump to a file I wanna work with
If I need to have some kind of a reference file in front of me, Im using vsplit, Im practically never editing 2 splits simultaneously, If I have 2, im doing all my editing in 1, and using 2nd just for a reference (with rare exceptions)
If I need to jump to a function/class definition/implementation im using lsp goto definition/implementation, then fixing something there, and jumping back with vim default goto previous buffer. It's very convenient to open object's definition, check it, jump back to a place where you found its implementation, change something there, jump back to definition, change (or yank, or just check a signature) something there, then jump back etc. All of it within a single buffer and with a few convenient keybindings
After I made some changes, Im jumping to another tmux tab (or to my vertical tmux split) to run tests/run a local server etc
Once I've joined you live on twitch and you stopped all you were doing to give a motivation speech since I had problems with impostor syndrome.
Just wanted to thank you for that, because of it, now I've pushed through and have graduated at university. Thanks for all the vim lessons and stuff.
Cheers from Brazil
I recently read something about Imposter syndrome(which I struggle with also).
It said that struggling with Imposter syndrome might be a good thing, since it means that you are learning every day. That you are not comfortable not knowing something yet.
That you are outside your comfort zone, which is where all the new stuff and the learning and the experiences are.
wholesome
The fun part is very true! The way I've explained it to friends and colleagues, it's like putting in very specific actions/inputs for combos in a fighting game. Very satisfying to pull off clever moves!
"Master the concrete"
I'm going to use that phrase in one of our meetings at work. 👍
All joking aside, thanks for sharing this video. I definitely learned a few things!
We've got bigger fish to tackle.
That was just the right time, Prime! I just opened neovim and thought it would be cool to see your new vim series release! Cheers from Brazil.
Cheers from South Dakota!
Cheers 🥂 from east India 🇮🇳
Saludos desde El Salvador!
Cheers from Buenos Aires, wishing to be in South Dakota!
Cheers from VietNam!
I feel like I always learn something watching someone else's vim workflow. One thing I noticed that wasn't included was that you can yank everything after the cursor with Y, so if you're in the beginning of the line this will grab everything instead of doing VY or yy you can do it with one character. Loving the content!
Once again great video. Love these series. I've been using vim (and nowadays neovim) since the beginnen when I started with Linux. Everyday still loving it.
But when I see your videos I feel like a N00b.
Keep them coming. 💪🏻👍🏻🎉
Been using vim for around year and a half and got myself stuck doing the naive methods I think all of us finding ourselves doing at some point. The methods you described here make so much more sense to reduce unnecessary keystrokes. Look forward to the future of this series!
Don't worry, I've been using vi and vim since about '93 and I still had to replay this video at 0.75x speed.
This is simply gold. I am working now about a year with vim motions in VSCode and this is really upgrading my workflow.
Great! I hope this series gets you tons of new followers.
I'm a emacs user, however I went with the evil-mode keybindings and it's a winner combination.
One I use very often: when you have to modify numbers, start of the line -> ctrl + a to move to closest number, usually followed by cw. Great content, keep it coming!
ctrl + a actually increases the number by one, and ctrl + x decreases it
Never gets old the beauty of vim. Love you work, your enthusiasm is just awesome. Thank you. You and vim need to get a room ;)
Thank you very much sir! I've been using neovim for basic YAML editing for 10 months as a DevOps Engineer, but this video unlocked a whole new level. I recently started practicing a lot of Python and this video helped me so much.
Just revisiting my comment, this video has truly unlocked the power of vim to me and I am steadily getting better and faster. This video really did a great job of demonstrating what you can do.
It's fun to learn with you again, because one of the reasons for me embarking into the linux rabbit whole was doing exotic things, and after 2 years I thought I was already pretty good with vim and I learned a bunch of emacs workflow too(I know, I'm sorry), this will defintly change my worflow for me, you once did teach, now you do it again, absolute mad lad. Cheers from Brazil.
I love the way you explain things, waiting for "BLAZINGLY FASTpart 2 " 🤪
FML this really blows my mind! So super awesome this series of your!
Thank you, Mr. ThePrimeagen! This is amazing! Love your videos!
I've been all over your videos Prime and somehow I never came accros this one.
Saves me a lot of time.
Thanks Prime
WOOOOW I needed that paste remap for a long time... Thanks a lot, love your work and content!
Great, great, great! Looking forward to this series!!!
I LOVE this kind of practical teaching
Ohh, that p (and d) are awesome! Will use those a ton in the future. Thanks!
thank you .. i started using VIM since 15 days and i'm enjoying it ..it is FUN ...no more TYPING !
Much to learn, I still have! Every time I go to a Vim meetup or see a video like this I am reminded of this fact.
Ayy yea, please more videos like this.
Im at my 1 year mark with vim and feeling really fast, but these improvements would make me a lot faster.
Thanks!
Thank you very much! I'm eagerly looking forward to the next oily Vim videos!
Hi prime, just wanna say ive been using neovim for 2 weeks now after watching your tutorial. Super duper loved it. Thanks from malaysia ❤.
Being using vim since I starting learn to program last year and I'm happy I did. Vim makes the process of writing a bunch of code fun. And one fun thing is that there's always something new to learn with vim that you never thought you needed and now you can't leave without it.
Now I'm building a 36-key ZMK powered keyboard so I can use vim at its max and also make all my coworkers never use my PC anymore
Your "greatest remap ever" is indeed, the greatest remap ever. Thank you!
LET'S GO VERY. Thanks prime for the usual awesome content
Quite literally couldn't have come at a better time. Just finished the free part of the learning vim game, but I don't think things will stick well with that for me. Little too abstracted.
Damn you Primeagen for making me excited to learn a text editor.
Edit: Should've watched the first minute and realized that I need to go back to the drawing board, shoutouts to me
Really really inspiring! Thank you and looking forward to part 2~
This is what I was needing rn... thanks prime
These are the kinds of hints I love seeing! Thanks for more coconut oil-y goodness
Fantastic. I never bothered to look up f motions, and, even though you don't even go over them in this video, a whole new world just opened up to me lol
Also, small note for motions including [ ], { }, and ( ). On some keyboard layouts some, if not all of these, are pretty awkward to type, so for ( ) you can use b as an identifier instead (so, for example, to select everything inside of ( ) you can press vib), and for { } you can likewise use B.
Dude please make more videos like this. I’ve been using vim for a few years now and I just haven’t grown how I use it. This is so helpful for seeing speedtech others use.
Waiting at the Helsinki airport before headed back to Stockholm Sweden, amazing finding this to pass some time and pick up something new. 🤘
Prime aka the master of concrete... seriously though this is priceless thank you for sharing!
Oh my God, leader p is something I needed so much
That's a really nice vid you have here! I always get overwhelmed by your style of presentation, but that's part of the fun, right?
the remap for persisting your copied text across replace is frekin amazing. I currently do it without using "v" so I pasted then deleted the extra stuff then copied the newly pasted thing I want to use again for some other section. Sick stuff!! Gonna use the remap in visual mode going forward!!
Leader P remap to clear paste register just blew my mind. SO GOOD
That's exactly what i wanted to watch! Thanks!
Time stamps:
horizontal selection - 1:35
special paste remap - 6:00
two key instead of double tapping - 7:17
as for f F t T, there's a cool plugin called eyeliner.nvim, it helps you see the fastest way to get to the wanted word by highligting the letter in this word that is not in between cursor and the word. Really love it, as it doesn't change vim mechanics like lightspeed, hop and others.
I love your Dr.Disrespect vibes, super funny and informative.
you are seriously the best youtuber of all time hands down
I've been using vim for 2 years now and I didn't know about the capital letters when selecting things, this is dope!
Me too and I just tried it out live! It feels like a super power. It sounds like an insect. It's as fast as humanly possible I swear.
As always amazing !
This is going to be a series! BUT I NEED YOUR HELP!!
1. Comment on things i have missed (its always hard to come up with examples for everything)
2. LIKE THE VIDEO. IT SENDS THE CLEAREST SIGN
3. IF YOU ARE NOT SUBBED, JUST DO IT ALREADY. AGAIN METRICS PEOPLE, METRICS
the best series ever!
sure man ✌🏻
oki
are you gonna talk about that keyboard?
Number 1 tip here I think is missing is repeating most of these actions with `.` This, in my opinion, is the #1 reason why people should be using motion workflows like this and not relying on visual mode so much.
An example that comes to mind, that I even think I use instead of your p workaround, is that if I needed to change something in parentheses in 5-6 places to the same thing, I could simply do:
ci(, and then, all I have to do is get somewhere inside the parentheses I also wanted to change to the same thing and hit `.`
That p was Sick!
One of the best tutorial for VIM
The amount of information in this video is absolutely astonishing! Awesome.
yt!
Good stuff. I always wondered why there isn't more advanced vimtutor like documents in a git repo somewhere.
(do the exercises, when done git reset head )
I know you are in favor of just using neovim, but the fact that the vi motions can be used with plugins in any good editor is underrated and a good starting point for most people. I use vi motions in Eclipse (java), VS Code because the other support those give me that is a pita to set up in pure vim. For quick stuff like notes and such I might just use vim in terminal or even gvim.
This is madness. I love it.
Wow, that’s awesome! Honestly thought I’d know all the motions but you’ve humbled me. I see a lot of yiW in my future 😅
Great video, I just learned something I didnt know were possible.
This was great lil golden nugget to freshen up my game
More like this! Congrats on the 100k
I dub thee: "Man who follows hole of rabbit at speed of lightning."
At the moment that the last programmer types anything at all, you will be the fastest (future-time thread bundle predicts: October 21st, 2025).
You are a wonder and an inspiration.
This is awesome, I now understand better the crazy shit you do on stream haha
Prime just keeps dropping bangers
oh my god! i always get blown away with how much i don't know everything there is to know about vim motions! you should've dropped the whole series like how netflix does it Prime
Nice video Prime. Have you tried the treesitter textobjects plugin? It allows you to extend the number of vimobjects you have and makes them aware of the language's syntax, so you can do something like yif to copy inside the function or dac to delete the function call.
I appreciate your content so much!
finally a guide made by love, thank u senpai
Awesome video and great info as always.
Just a suggestion for fellow vim users:
I increased my speed in the magnitude of coconut oil after mapping
to ciw
Eew. What's the leader?
ciw might as well be the home row
Using this for quickly switching back and forwards between the two most recent buffers.
Great Video! That leader-p is about to be part of my config!
it should be!!
Thanks that helped a lot! Especially the pasting trick
vim is like jiu-jitsu, you're constantly learning new moves and mastering what you learned previously
Thanks for solving a problem that has annoyed me for almost 20 years! ❤️ I mean, of course, loosing the register content, at 6:00. Sometimes that replacement is quite useful, but sometimes I'd really like to avoid it. Now I know how! 😎
Prime.
I type horribly. Everything I input is on PURPOSE.
You are legend.
It’s the “Ghost ride the whip…” at the end for me haha
We stay hyphy at The Startup
YUSSS new key combo unlocked! Thanks!
this man's keyboard gives him instant validation
These are facts
you don't need to bind the p command with , if you overwrite the "p" in insert mode, then you can do viw or viW and then p to replace the selected with the 0 reg. without overwrite it with the selected text, so you can do it again and again with the same text.
Didn't know you can paste over a highlighted text to replace it. You saved me sooo much time with this simple trick :D
No idea why but usually I'd delete the text I wanted to replace and then select the replacement and then move back to the place I deleted what I was replacing and then pasting the replacement but selecting the replacement text and pasting over it with something you already have in your paste register is wayyy better, no need to potentially need to go back and forth. Muscle memory sucks sometimes lol
"Mastering the concrete" ..
Yes please more videos on this series....I feel like I just got knowledge from a firehose.
Also we need a Primeagen shirt with "remove = VD"
Out of this World
Thanks for the vid! I usually struggle more with vertical navigation, a video on that would be great :)
ThePrimeagen You're the greatest of all time.
The v-motion-paste move is so common that I use a little plugin called ReplaceWithRegister, which makes just that a single mapping and does away with the underscore register problem. It doesn't save many keystrokes by itself but it does make the entire replacement a single period-repeatable edit which is very handy.
IDK if it's been mentioned, but my favorite way to use this series is to go through and watch it, find a few motions that address pain points that I've been having, integrate those 2-3 motions, then when those feel fluid come back to the series and watch through for the next 1 or 2 I want to add. Obviously you start w/ just the basics of hjkl and num+jk, then you watch through the series and see what commands jump out at you (if you are dedicated and learning quickly you might come back 3-4 times in 1 day)
Legendary!
Watching as a noob, it's mind blowing 🤯
I think every editor/workflow can be good if you really take the time to practice and master it. For example, in windows if you pin apps you can use windows+number keys to switch like 'random access' alt tab (repeating cycles the instances of the app) so you don't need the mouse all that much. Windows+c/v are multi copy/paste built in to the os, and it works just fine with ubuntu/wsl ;)
Awesome video, keep it coming!
@ThePrimeagen , nice video, and it would be nice to see more videos like this one. However, regarding the vim map, wouldn't it be better using the built-in register 0? A map like: "0p . Or do your map with this other combination? The 0 register keeps the last yanked text in it, even when you replace something with some yanked text.
Great tips Prime!
That was epic!
A lot of people have a rocky start to their vim journey, and it's mostly vimtutor's fault.
One of the very first things that vimtutor says - and I quote - "Now, make sure that your Caps-Lock key is NOT depressed".
Who among us is capable of determining the mental state of our Caps-Lock key? I also get concerned about tllde and backtick - sometimes they just seem a little 'off', but their behaviour seems more 'oppositional defiance' than 'depression'. And don't get me started about SysReq - that's NPD right there.
I use Arch btw.
the fact i know how to exit and move up and down made me feel good, one step at a time. now to follow this tutorial
thank you prime, let's get some coconut oil and start having fun!
best vim videos in the world, easy
"v a {" from outside - I had to pause because my brain exploded from too much coconut oil
I've been meaning to learn VIM for awhile now but keep stalling. I'm going to follow this series and see where i end at the end of it.
Hopefully you get faster faster and faster
Great as usual ;)
Im just starting (installed yesterday) to learn motion on vscodevim. I want to be able to one day switch to neovim and this video is really useful.
Man, the W tip is gonna be pretty life changing. Not gonna lie.
Cool video. I mapped H to ^ and L to $ which i find more useful and fun than jumping to the top/bottom of the screen. (Horizontal movements)