Тёмный

Find and Replace Text in 1 or More Files Using Vim, fzf and ripgrep 

Nick Janetakis
Подписаться 21 тыс.
Просмотров 25 тыс.
50% 1

Опубликовано:

 

24 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 60   
@NickJanetakis
@NickJanetakis 5 лет назад
Here's the time stamps since this is a long one: 0:55 -- Cloning an example project to work with 1:43 -- Finding or jumping to a word on a single line 3:25 -- Finding a term in the current file 4:57 -- Automatically clearing search highlights on cursor move 6:37 -- Manually replacing text in the current file 7:33 -- Using the star mapping to search a word under your cursor 7:54 -- Replacing the last searched word using a custom mapping 10:45 -- Using the visual star plugin to search for any selected term 11:59 -- Replacing any selected term using a custom mapping 13:31 -- Replacing text inside of a visual selection 14:48 -- A multiple cursors alternative in Vim 18:28 -- Custom key mapping to quickly replace near by text 19:53 -- Finding terms in multiple files based on where you opened Vim 21:33 -- Opening search results in vsplits, splits or tabs 22:42 -- Opening multiple search results at once 23:22 -- Seeing real time search results when finding text in multiple files 24:02 -- Filtering multiple file search results by file type 24:48 -- Finding files, viewing git commits and more with the fzf.vim plugin 26:50 -- Installing and configuring fzf 28:26 -- Installing and configuring fzf.vim 30:26 -- Installing and configuring ripgrep to work with fzf and fzf.vim 32:41 -- Finding and replacing text in multiple files with vim-grepper 35:42 -- Finding and replacing a phrase or regexp in multiple files 39:15 -- Installing and configuring the vim-grepper plugin 40:48 -- Running vim-grepper manually for more complex find / replace
@JJ-wt4ym
@JJ-wt4ym 5 лет назад
.........................this is a crazy video. search and replace in vim have been bothered me a lot and you just saved me on this. I love you Nick. I will visit your youtube and learn more about vim. thank you so much!!!!!!!!
@NickJanetakis
@NickJanetakis 5 лет назад
No problem. Yeah it's definitely tricky in Vim, although after hooking up these binds and plugins I think it's quicker and easier to find / replace text than in any other editor I've used.
@paweczajka1101
@paweczajka1101 4 года назад
This is awesome. This is exacly what I and probably every other vimmer needs
@NickJanetakis
@NickJanetakis 4 года назад
Thanks!
@josemaria8205
@josemaria8205 4 года назад
Thanks Nick! This video is a gem.
@sillaceestekay2069
@sillaceestekay2069 Год назад
This was imensely helpful, Thank You!
@NickJanetakis
@NickJanetakis Год назад
No problem, thanks for watching.
@MohamedSaleh01
@MohamedSaleh01 3 года назад
06:55 I mapped my esc key in normal mode to clear the highlighted search: nnoremap :noh
@gregloesch588
@gregloesch588 2 года назад
ctrl-l in neovim works fwiw
@lpanebr
@lpanebr 4 года назад
This video is exactly what I was looking for. Thanks!!
@Linux.Learner
@Linux.Learner 4 месяца назад
THANK YOU SIRE!🙂
@stevehof
@stevehof 3 года назад
This was so helpful. Thank you!
@bharat9835
@bharat9835 4 года назад
This is Gold. Thanks.
@dave4347
@dave4347 4 года назад
Great video, thank you! I also think it would be great if vim-grepper was not necessary and we could do the same thing with fzf rg. Rg is pretty powerful, I imagine there is a way, I just haven’t figured it out yet.
@NickJanetakis
@NickJanetakis 4 года назад
No problem. If you ever figure out a better work flow, please let us know!
@luks1337
@luks1337 3 года назад
Really helpful video ty.
@YuvalHelman
@YuvalHelman 4 года назад
at 12:44 you say using the asterisk sign (*) on a visual selection requires a plugin. works without it for me though. maybe it's available in a new version or something.. Great videos. thanks! I learned some cool new stuff from you.
@NickJanetakis
@NickJanetakis 4 года назад
Hi, it will work on a single word without a plugin, but if you want to visually select a phrase or multiple words, I don't think that will work by default. Unless you have another plugin doing that?
@aaronwang6304
@aaronwang6304 4 года назад
I ran into the same issue but looks like github.com/haya14busa/vim-asterisk solves exactly that
@NickJanetakis
@NickJanetakis 4 года назад
@@aaronwang6304 I happen to use github.com/nelstrom/vim-visual-star-search but both do roughly the same thing for the visual * aspect.
@jamiemackenzie9708
@jamiemackenzie9708 Год назад
Nice tips 👍
@NoPudieronConGuevara
@NoPudieronConGuevara 4 года назад
This is a pretty iseful video atleast for Vim begginers like me, I suggest you to use a more compressed video format in 20 or 10 instead of 40 minutes, you covered a lot of useful stuff in this guide, but i think i t could be done, anyways thanks for this, you really helped me a lot.
@NickJanetakis
@NickJanetakis 4 года назад
Thanks for the feedback. The pinned comment has timestamps to jump around to specific things btw and thanks to your reminder, I just added them to the description too so they should show up in the timeline of the video.
@SzTz100
@SzTz100 4 года назад
Your videos are great
@NickJanetakis
@NickJanetakis 4 года назад
Thanks a lot.
@saichandneeli5927
@saichandneeli5927 2 года назад
How did you apply gruvbox theme to terminal and tmux?
@NickJanetakis
@NickJanetakis 2 года назад
Everything is in my dotfiles at github.com/nickjj/dotfiles, which has both text and video links to setting it all up.
@xinsun6806
@xinsun6806 4 года назад
very good
@NickJanetakis
@NickJanetakis 4 года назад
Thanks!
@nnutipa
@nnutipa 5 лет назад
Thanks, Nick! Very interesting material as always. One thing is bothering me when I need to do things with vim is replacing strings full of special symbols. That is a real pain for me, I just want to replace these strings as I do for example in VSCode, where I don't care about how many special symbols in my strings or how to escape them. How do you deal with that?
@NickJanetakis
@NickJanetakis 5 лет назад
No problem. I have the same issue as you. I've just gotten used to escaping those characters (it's just putting a \ before the character) but I do agree it's not ideal. I'm not sure if there's really a way around that. On the bright side, you don't need to escape too many characters. $, ^, [, \ and / come to mind but there's probably others. Also, you only need to escape them in the find part of the find / replace.
@deepakpatre4874
@deepakpatre4874 2 года назад
@@NickJanetakis I think you should try very magic feature of regex (\v) and then no need to escape them. Like for exact search: /\ “ By escaping them With very magic: /\v
@NickJanetakis
@NickJanetakis 2 года назад
@@deepakpatre4874 Thanks, I didn't know that existed. I will try it out.
@rafkhachatryan2000
@rafkhachatryan2000 2 года назад
which key combination is pressed in 33:18?
@NickJanetakis
@NickJanetakis 2 года назад
That would be leader + shift + r. In this case "leader" is set to spacebar if you're using my dotfiles. In practice this means hitting the spacebar and then very quickly doing shift+r afterwards.
@snk0202
@snk0202 4 года назад
Hi Nick, thanks for this awesome video. It would be great if you can provide .vimrc/init.vim used in this video in some repo or something.
@NickJanetakis
@NickJanetakis 4 года назад
Hi, check the description. It has a link to my dotfiles on github, along with links to everything mentioned in the video.
@kez99
@kez99 4 года назад
Hi, has anyone had performance issues with wsl, like it seems to load processes very slow as you use it more?
@NickJanetakis
@NickJanetakis 4 года назад
I have not noticed that. I use these routines all the time and only reboot whenever Windows forces a reboot. Have you tried disabling Windows defender? That's known to cause a lot of performance issues, especially in WSL.
@TheStringKing7
@TheStringKing7 4 года назад
Nick please help. Copied your dotfiles but when trying to use ctrl-v with Rg it pastes from clipboard in the field instead of opening the file in a vertical split. I don't know why.
@NickJanetakis
@NickJanetakis 4 года назад
Hmm, what terminal do you use? Maybe it has that hotkey defined.
@TheStringKing7
@TheStringKing7 4 года назад
@@NickJanetakis I use windows terminal and run wsl 2.
@NickJanetakis
@NickJanetakis 4 года назад
@@TheStringKing7 Did you make a custom bind in that terminal to support CTRL+v pasting? I don't have that behavior here, even outside of Vim.
@TheStringKing7
@TheStringKing7 4 года назад
@@NickJanetakis No, i haven't done anything. I literally just installed wsl 2 and windows terminal and copied your dotfiles. I guess i'll figure it out. Thanks for replying though. I won't waste anymore of your time.
@Zeioth
@Zeioth 4 года назад
I really like far. It's interactive so you can actually see what is going to change before you apply, and exclude items if you need. Really cool shit. github.com/brooth/far.vim
@Zeioth
@Zeioth 4 года назад
Those who come from Atom will find it very familiar.
@bob7ii690
@bob7ii690 4 года назад
32:43
@NickJanetakis
@NickJanetakis 4 года назад
Thanks. The timestamps are also in the description and pinned comment too btw.
@linuxgeek64
@linuxgeek64 5 лет назад
how'd you get blatant spam onto the front page of slashdot, and why did you feel it was necessary to do so? regards.
@NickJanetakis
@NickJanetakis 5 лет назад
I'm not sure what you mean. I never submit anything to Slashdot. I think I made about 5 comments on that site in the ~15 years I've been reading it. How is a video about finding / replacing text in Vim spam? Also I don't see this video on Slashdot, do you have a link to it?
@subhadeepsamantaray725
@subhadeepsamantaray725 4 года назад
Goo info but you are diverting a lot of the topic and the video is super long. It would be great if you just show how to do multiple replace in like 10 minutes, instead of trying to cover unrelated/slightly related things in detail.
@NickJanetakis
@NickJanetakis 4 года назад
Thanks. There's time stamps almost every minute if you want to skim around and I'm not sure if I could fit all of those use cases together in 10 minutes unless I skipped important information. The theme of the video was finding and replacing things in 1 or more files, not just multiple replace, but if you only cared about multi-replace you can jump to the 32:41 mark and watch the 8 minutes of that.
Далее
My Favorite Vim Tricks
14:39
Просмотров 183 тыс.
Vim Tips You Probably Never Heard of
12:11
Просмотров 121 тыс.
진 (Jin) 'I'll Be There' Official MV
03:15
Просмотров 3,5 млн
Гравировка на iPhone, iPad и Apple Watch
00:40
Пресс-конференция перед UFC 308
49:51
Effective Neovim: Instant IDE
16:16
Просмотров 818 тыс.
Vim universe. fzf - command line fuzzy finder
13:41
Просмотров 233 тыс.
FZF will change your workflow completely
13:29
Просмотров 116 тыс.
Advanced Vim Workflows
10:41
Просмотров 84 тыс.
Handling Multiple Files in vim
8:58
Просмотров 71 тыс.