An introduction to regular expressions in Vim

preview_player
Показать описание
This is a brief overview that covers probably 80% of typical regular expression use cases for refactoring applications.

I had a brain fart about halfway through, if you want to select a region based on regular expressions, your command is this:

:g/[pattern1]/ s/[pattern-to-sub]/[replacement]/[flags]

Not worth re-recording the video for one line :).

NOTE: It was pointed out to me that my history example would BREAK if the commands include a semicolon. This is absolutely correct. The date capture group could be done like this instead: (:\s+\d*:\d;) or is a little more sly way (:.\{-};). Thanks to u/pyz3n for the catch!
Рекомендации по теме
Комментарии
Автор

cool video, learned few things here - didn't know such a preview search plugin existed, very useful - thanks

MilMike
Автор

Thanks for explaining such an amazing topic

DavidSoles
Автор

Was not aware there was a sort command. Good to know. Great video!

glyakk
Автор

Wow! This is just genius, thanks for the video...

avimehenwal
Автор

Useful stuff. Keep up with the good work.

MyName-rkzh
Автор

Transparent terminals are so 5 years ago

penvzila
Автор

The very magic seems to me like it should be the default when dealing with regex, unless there's a silent way to do a regex search (as in very magic on by default)

benvella
Автор

This is great, I just took a firefox backup html and got rid of a whole bunch of garbage in a few minutes.

Question, when you are doing %s/whatever yours is highlighting all of the occurrences rather than just the first occurrence like mine. How can I get mine to do that?

weedeater
visit shbcf.ru