dotfiles icon indicating copy to clipboard operation
dotfiles copied to clipboard

Grep operator

Open gabebw opened this issue 6 years ago • 5 comments

<Leader>gt; would be cool: http://learnvimscriptthehardway.stevelosh.com/chapters/33.html

gabebw avatar Mar 19 '18 19:03 gabebw

For what it's worth I use https://github.com/rgrinberg/vim-operator-gsearch, which provides exactly this (if I'm reading this issue right :) )

bobwhitelock avatar Mar 19 '18 21:03 bobwhitelock

I have this mapped to gr for :grep and gl for :lgrep: https://github.com/teoljungberg/vim-grep-motion

teoljungberg avatar Mar 26 '18 18:03 teoljungberg

@teoljungberg Thank you for the dotfiles help today 😄!

According to :help lgrep, it searches the location list, which is "a window-local quickfix list".

I've never used the location list, and I'm not sure when (or why) it's better than the quickfix list. When would you use lgrep instead of grep?

gabebw avatar Mar 26 '18 18:03 gabebw

@bobwhitelock Thank you for the pointer! 🎉

gabebw avatar Mar 26 '18 18:03 gabebw

The quickfix list is shared globally, between all tabs and windows. And the location list is specific to a given window, as the name suggests. Meaning if I :lgrep for something from a window, and move away - my location list is then reset. My use-case for the location list is to quickly grep up where some token comes from, questions who's answers doesn't need to stick around than the scope of the current window.

I have been toying with the workflow of running linters through :lmake, but I haven't done that fully just yet.

teoljungberg avatar Mar 26 '18 19:03 teoljungberg