Multi-file search and replace in Neovim

Поделиться
HTML-код
  • Опубликовано: 27 авг 2024

Комментарии • 30

  • @ascourter
    @ascourter  Год назад +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 10 месяцев назад

      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  10 месяцев назад

      @@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 4 месяца назад +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 Год назад +2

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

    • @ascourter
      @ascourter  Год назад +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 4 месяца назад +3

    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 Год назад +2

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

  • @olivierbegassat851
    @olivierbegassat851 7 месяцев назад

    I didn't know about !
    Thanks 🙂

  • @king-zu3ih
    @king-zu3ih Год назад +1

    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

  • @iliadmitriev01
    @iliadmitriev01 3 месяца назад

    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  3 месяца назад

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

  • @neveriodev350
    @neveriodev350 9 месяцев назад

    Thanks Andrew!

    • @ascourter
      @ascourter  9 месяцев назад

      Thanks for watching!

  • @user-uh3zr7mo4i
    @user-uh3zr7mo4i Год назад +1

    amazing video as always (:

  • @kiyov09
    @kiyov09 Год назад

    Cool! Thnx for sharing!

    • @ascourter
      @ascourter  Год назад +1

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

  • @fabienpenso
    @fabienpenso 11 месяцев назад

    Damn didn’t know about ctrl q in telescope

  • @martinstendorf1773
    @martinstendorf1773 10 месяцев назад

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

    • @ascourter
      @ascourter  10 месяцев назад

      You can configure this in your terminal emulator. Here's a link to Josh Medeski explaining it.
      ruclips.net/video/BLp61-Lq0kQ/видео.htmlsi=cvtVUWFlJilY3vku

    • @ascourter
      @ascourter  10 месяцев назад

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

  • @youngsinatra2645
    @youngsinatra2645 2 месяца назад +1

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

    • @ascourter
      @ascourter  2 месяца назад

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

  • @CheapHomeTech
    @CheapHomeTech 2 месяца назад

    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  2 месяца назад

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

    • @CheapHomeTech
      @CheapHomeTech 2 месяца назад

      @@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  2 месяца назад

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