stefandtw / quickfix-reflector.vim

Change code right in the quickfix window
MIT License
347 stars 18 forks source link

I don't get the idea. #1

Closed ReneFroger closed 10 years ago

ReneFroger commented 10 years ago

Hi there!

First, thanks for sharing this tool with us!

But alas, I'm trying to get a idea of this. A quickfix window is a window, where you can edit files? But is that not the same with Vim?

I'm sorry, I can't get any idea what the point of this tool is.

stefandtw commented 10 years ago

Hi!

For instance, you would like to rename a function in your code that is used in many files. One way to do this, is first to search for function_name in the current directory, and open the results in the quickfix window:

:vimgrep /function_name/g * | botright cw

Vim displays a list of all occurences of function_name. Maybe some are relevant to your refactoring, and some are not. Now, instead of stepping through each of the search results and editing them manually, quickfix-reflector allows you to edit the list of the search results directly. Instead of editing one file at a time, you can edit many at once. Combined with commands like g/function_name_not_relevant/d and %s/function_name/new_name/g inside the quickfix buffer, it is very easy to refine the refactoring in a quick and Vim-like way.

Of course there are other ways to do something similar, like using sed, Vim's argdo or other plug-ins. But I prefer it like this, because it integrates very well with Vim's existing toolset (the quickfix window). So, mostly it should be useful for anyone already using Vim's quickfix window.

See :h quickfix

ReneFroger commented 10 years ago

Ooh, that's nice! Thanks for your reply. I didn't knew about the quickfix. I'm still amazed about how big Vim really is.

Good plugin to have it! Now I'm installing it. Thanks for sharing, much appreciated!