Registers: Vim commands you NEED TO KNOW #7

preview_player
Показать описание

Tired of pasting the word you just deleted? In this short, we take a quick look at registers in Vim to understand how to stop making this mistake.

Let's get after it.
Рекомендации по теме
Комментарии
Автор

I knew it would go to the register but didn't know there was a way to access like that, amazing tip! thanks master vimcraft

Redyf
Автор

What you said is mostly right. Only the "yank" (copy) command puts stuff into the 0th register. The deletes are stored in the registers 1-9. So no matter how many deletes you make, the 0th register contains your last "yank."

ElPikacupacabra
Автор

i usually do
yiw then go to the word i want and do viwp and done, though this is a cool way to show the power of registers in vim

thanks nerd!

jamlie
Автор

You can also paste from a register in insert mode with Ctrl+r and then the register ID. If you have which-key installed, both that and " will give you the register list without having to enter the :reg command first

daliareds
Автор

Ah, my nemesis, the register
Im always having trouble with this.
I would love an indepth video about the register. I already greatly appreciate the current shorts you have posted!

fliplucky
Автор

Every short from this guy makes me feel like I gain superpowers

HamtaroCappy
Автор

I feel so dumb not knowing there was more than one register

Rossvanzyl
Автор

Man, this is pure gold. Please keep going. This format is super 🫶

bezludny
Автор

The proper and repeatable (with `. `) is to do yiw to pop in zero register (it immediately goes there not like he mentioned. " register is for small deletes / changes. Then go over what you want to replace and type ciwC-r0

That does a change in word, putting you in insert mode and removes the word, and then CtrlR0 pastes 0 register in insert mode.

Go over other words and hit 0 and it automatically replaces them. Whatever word you deleted with ciw is kept in " register (does not increment)

bengamedev
Автор

I DESPERATELY NEEDED THIS 5 HOURS AGO but I will also desperately need it in the future so thank you nerd. Saint of all nerds.

shaartmcl
Автор

I actually left a like on this video. You might be the first YT Short I have ever liked.

KeplerEmeritus
Автор

Nerd knows when we need something that we need <3.

laggedskapari
Автор

In this case in specific I would just do vep to select the word and then paste it over 😊

miguelacero
Автор

I always do yiw to copy the word and then I
viwP. The capital P makes the difference because that way your previously yanked word stays in the register! :)

uchto
Автор

Is there a way to disable the feature of delete and paste? Only yanked text can be pasted. And maybe have a different custom keybinding for yank and then delete. Is it a good idea?

lilamdahal
Автор

Thank this causes me so much frustration 🙆🏾

oumardicko
Автор

Great explanation of register .
For quick things like this I’d rather yank and then viw + p . Visual mode and paste over

stephanegmt
Автор

The more I watch VIM tutorials the less I want to use it

Rokazz
Автор

I usually do viw on the second word and press paste to avoid that extra registry thingy. But good one ☝️

svunzzzz
Автор

That local diarrhea can be a pain tho…

AlEbnereza
join shbcf.ru