Multi-file search and replace in Neovim
Vložit
- čas přidán 2. 08. 2024
- In this video I walk through a few different ways to search and replace across many files in Neovim using plugins and some builtin functionality.
Neovim config: github.com/exosyphon/nvim
Plugins:
github.com/nvim-pack/nvim-spe...
github.com/dyng/ctrlsf.vim
Companion Article: / multi-file-search-and-...
Join this channel to get access to perks:
www.youtube.com/@ascourter/join
Twitter: / exosyphon
Website: andrewcourter.com
Twitch: / exosyphon
Gear:
Mic: amzn.to/40GUGFg
Mic Interface: amzn.to/3YGxaGE
Mic preamp: amzn.to/3XtBXtY
Webcam: amzn.to/3OEOZRU
Boom Arm: amzn.to/3qLr0GE
Vissles (VS II switches): vissles.com/?ref=69zn8aei20 - Coupon Code for $5 off: ANDREWCOURTER
IQUNIX F97 (TTC ACE switches): iqunix.store/collections/f97-...
Audo:
::::::::::::::::::::
Music: Dreams - Bensound
www.bensound.com
Support by RFM - NCM: bit.ly/2xGHypM
::::::::::::::::::::
0:00 Intro
0:33 Telescope and Quickfix list
2:18 Builtin Neovim LSP
3:14 Nvim-spectre Plugin
6:06 CtrlSF Plugin
9:43 Outro
#neovim #coding #programming - Věda a technologie
From some feedback, I mention the LSP rename which will rename the references of symbol under cursor. This means Neovim will rename across files if it is a symbol and not just some text.
sometimes lsp renames a variable to alias (smallest change), converting to alias is not what I want, is there anyway to fully change not alias?
for example. when I try to rename foo to bar, it makes alias
const { foo: bar } = useHooks()
@@devstefancho Oh interesting. I haven't seen that one before. Which LSP are you using? I assume this file is a typescriptreact file?
Just replaced vscode with neovim as my daily editor. I was really lost until I came across your videos, I appreciate how quick and to the point they are. Keep up the solid work man
Thank you!!
I've always wanted to learn about the quickfix list. Thanks Andrew!
There's a ton you can do with the quickfix list. I hope to make another video going more into depth on it since many plugins leverage it. Thanks for watching!
One thing worth mentioning about the first method is that you probably want to run `:cfdo w` to save all the changed files from the quickfix list
cdo is a great option. didn't know it existed. thanks
I didn't know about !
Thanks 🙂
amazing video as always (:
Thank you!
Thanks Andrew!
Thanks for watching!
Cool! Thnx for sharing!
Thanks for the suggestion on :cdo! Learned that one from you.
on nvim-spectre if you have rust you can try to build oxi so you don't get that error on UI because of vim regex
Damn didn’t know about ctrl q in telescope
for the first example it's better to use :cfdo command instead of :cdo.
:cfdo executes command for every file in the quickfix list
Thanks for sharing. cfdo is a good one for running one command per file like you mentioned.
How did you bind cmd-k to open the tmux session manager?
You can configure this in your terminal emulator. Here's a link to Josh Medeski explaining it.
czcams.com/video/BLp61-Lq0kQ/video.htmlsi=cvtVUWFlJilY3vku
I use his smart tmux session manager. Would highly recommend it.
None of them work for me. I'm editing lots of adoc files so LSP is out. The rest require plugins and I use pure nvim.
Seems like the quickfix list and cfdo or cdo is your path to get the renames.
@@ascourter I use quickfix for development work but for working with customer records I resort to command line greps and scripts. Usually very unique stuff across tens of thousands of files. I'm at a loss when trying to imagine how a quickfix window would help. Thanks for your response. I'll keep cdo and cfdo in mind and maybe in the future I'll figure out some situations where it could help.
@@CheapHomeTech Ah ok I didn't know it was across so many files. If the records are also in files then you could run vimgrep from within Neovim and it should show up in the quickfix list and then you can apply changes using cfdo. Something like vimgrep /match/ ** as a simple example.
mini.pick > telescope, grug-far > nvim-spectre
Oh I haven't tried mini.pick. I'll have to check that one out