/g in sed command means global in line, not in entire file. So without /g replacement will be done for the first occurrence in each line where we have matching
v + i + w + y (to copy the selected word) can be done with y + i + w (yank inside word)
I always went boinker with macros but now i Understand them!
I am a beginner, I hated VIM at first and I told myself I would never touch it again. But I kept learning things little by little. Your channel helped me a lot, it has made me fall in love with VIM. I am also following your playlist to learn to make my own Neovim config. Thanks nerd!
Did you know you can append to a named register? “xY will yank the current line into register x. “XY will append the current line to register x. This lets you build up a register to paste later. For example: you want to grab a couple lines of code from several locations and paste them into a new function, you can gather them all into that register and then do one paste when you have them assembled. Also, because a macro is just executing a register, you can edit a macro by pasting the contents of the register, modify it, then yank the new macro back into the register ready to run the modified macro. One last item: a macro can call another macro or even itself. Writing recursive macros to update thousands of lines can be quite satisfying, but is most useful if making a regex substitution is just too difficult or not quite fully repeatable.
If you already have it already highlighted by the *, you can simply :%s//replacement/g, you don’t have to repeat what was highlighted
🚨 I misspoke!! 🚨 Typically with Vim videos, I tend to do them from top-of-my-head knowledge. For some reason, I always think of the "substitute" command as "sed". "s" is substitute, not "sed" sorry for any confusion, hope you like the video!!
i've been vimming for too long to not know about that * motion 😭 that's gonna be useful
3:40 you can just yiw without visual mode.
I've been using VI for over 30 years and I learned a few super-useful things from this video. Thank you!
Thanks moustache man, I needed this.
how did i not know about macros yet...
For anyone for whom the special register yank at around 7:00 doesn't work on Linux: - Run `sudo apt install vim-gtk3` - Verify clipboard support by running `vim --version | grep clipboard` . If you get an output containing `+clipboard` then it is supported, an `-clipboard` indicates it is not. - Update/Reinstall neovim. Should now work.
Great tips! With macros you can do @@ to replay last played macro. Also while recording a macro,.you can also replay that macro inifonitely until vim.encounters an error. I.e. for your example qah //start recording into h i"<escape>E",<eacape> // addquotes around word, then add comma @h //.start replaying entire macro recursively, i.e. this will keep replaying the 'h' macro until error encountered. A couple more register tips. Add to init.vim or .vimrc set clipboard unnamedplus //Always yank/paste from system clipboard. One register tip: "_d //delete without overwriting default register In visual mode.ypu can do P to paste without overwriting. Here's a couple other honorable mentions. Use the global command to delete all lines containing search. :g/search/d And its inverse (delete lines not containing search) :!/search/d
Hi! I’m a content creator in the same space, and I really appreciate the quality of your videos and the work it requires to create them. This video is a great guide for beginners and showcases the power of vim editing in such an effortless way, Keep up the good work!
bring the part 2 with more 50 commands
Both * and + registers work for the Windows clipboard
<C-^> will toggle between the current and previous buffers, you can mash it to go back and forth kinda like harpoon. Also <C-o> lets you go backwards in the jump table if you wana navigate back a line or two or three etc.
About macros, try 'qq' to start recording into 'q', because 'shift+q' does the same thing as '@<key>'.
@typecraft_dev