Many times, especially with customizable software stacks, there are aspects or features of the software that we wish they were done differently. Fortunately, when using open-source software, configuring said software to do our bidding could be within a few (hundred) keystrokes. This is nothing new. In fact, it is one of the key selling points of open-source software.
There are times that some software tool we use has some irk that bugs us for long time, but overall it works reasonably well so we do not think of spending time learning how to really fix that. This usually goes on until one of these things happen:
- We stop using that software
- The problem becomes unbearable and we are forced to fix it
- We stumble upon the solution and it is surprisingly easy
The third point is precisely what I want to present here. Consider the following screenshot of the fzf.vim feature using ripgrep to apply fuzzy search across the project:
Now consider the same search but with the file names excluded from the search results:
Infinitely more useful! I still wonder why this is not the default behavior, but never mind. I actually got fed up with this so I searched for the fix and it turned out, it is pretty easy:
command! -bang -nargs=* Rg call fzf#vim#grep("rg --column --line-number --no-heading --color=always --smart-case ".shellescape(<q-args>), 1, {'options': '--delimiter : --nth 4..'}, <bang>0)
Put the above in your .vimrc
file and you are ready to go! For those that
wounder why or how this works, check the links below. I really wish I
found this way sooner. Hopefully this will somehow help you to make your
vim writing / development a little bit easier. Enjoy!