Multi-file search and replace in Neovim

Sdílet
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

Komentáře • 30

  • @ascourter
    @ascourter  Před 11 měsíci +2

    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.

    • @devstefancho
      @devstefancho Před 9 měsíci

      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()

    • @ascourter
      @ascourter  Před 9 měsíci

      @@devstefancho Oh interesting. I haven't seen that one before. Which LSP are you using? I assume this file is a typescriptreact file?

  • @tuckerbeauchamp8192
    @tuckerbeauchamp8192 Před 3 měsíci +1

    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

  • @stoicfloor
    @stoicfloor Před 11 měsíci +2

    I've always wanted to learn about the quickfix list. Thanks Andrew!

    • @ascourter
      @ascourter  Před 11 měsíci +1

      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!

  • @kefirmsk
    @kefirmsk Před 3 měsíci +2

    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

  • @mohitkumar-jv2bx
    @mohitkumar-jv2bx Před 11 měsíci +2

    cdo is a great option. didn't know it existed. thanks

  • @olivierbegassat851
    @olivierbegassat851 Před 6 měsíci

    I didn't know about !
    Thanks 🙂

  • @user-uh3zr7mo4i
    @user-uh3zr7mo4i Před 11 měsíci +1

    amazing video as always (:

  • @neveriodev350
    @neveriodev350 Před 8 měsíci

    Thanks Andrew!

  • @kiyov09
    @kiyov09 Před 11 měsíci

    Cool! Thnx for sharing!

    • @ascourter
      @ascourter  Před 11 měsíci +1

      Thanks for the suggestion on :cdo! Learned that one from you.

  • @king-zu3ih
    @king-zu3ih Před 11 měsíci

    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

  • @fabienpenso
    @fabienpenso Před 11 měsíci

    Damn didn’t know about ctrl q in telescope

  • @iliadmitriev01
    @iliadmitriev01 Před 2 měsíci

    for the first example it's better to use :cfdo command instead of :cdo.
    :cfdo executes command for every file in the quickfix list

    • @ascourter
      @ascourter  Před 2 měsíci

      Thanks for sharing. cfdo is a good one for running one command per file like you mentioned.

  • @martinstendorf1773
    @martinstendorf1773 Před 9 měsíci

    How did you bind cmd-k to open the tmux session manager?

    • @ascourter
      @ascourter  Před 9 měsíci

      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

    • @ascourter
      @ascourter  Před 9 měsíci

      I use his smart tmux session manager. Would highly recommend it.

  • @CheapHomeTech
    @CheapHomeTech Před 2 měsíci

    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.

    • @ascourter
      @ascourter  Před 2 měsíci

      Seems like the quickfix list and cfdo or cdo is your path to get the renames.

    • @CheapHomeTech
      @CheapHomeTech Před měsícem

      @@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.

    • @ascourter
      @ascourter  Před měsícem

      @@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.

  • @youngsinatra2645
    @youngsinatra2645 Před měsícem +1

    mini.pick > telescope, grug-far > nvim-spectre

    • @ascourter
      @ascourter  Před měsícem

      Oh I haven't tried mini.pick. I'll have to check that one out