cosmicexplorer / helm-rg

ripgrep is nice
GNU General Public License v3.0
101 stars 21 forks source link

How to limit the search in the current buffer? #12

Open shakaxi opened 5 years ago

shakaxi commented 5 years ago

Thanks for your great effort for helm-rg, and I am trying to use rg instead of ag.

By default, the helm-rg provides interface to search in a directory. But I found it cannot limit the search in the current buffer yet, which could bring about great convenience. Do you have any intention or plan in the near future?

Thanks.

codygman commented 5 years ago

I need this as well, in the meantime I'll use helm-ag I suppose.

Edit: it should be relatively easy to hack together our own helm-rg-this-file function, but it's late for me atm.

liuzhishan commented 1 year ago

hi, I found a way to specify the directory, just add these codes in config.el

(defun helm-rg-dir ()
   (interactive)
  (let ((helm-rg--current-dir
       (read-directory-name "rg directory: " helm-rg--current-dir nil t)))
       (helm-rg (helm-rg--get-thing-at-pt))))

It can also be binded to some key: (map! :leader :desc "do rg under directory" :n "s a" #'helm-rg-dir)

And just press "SPC s a" to do the rg under some directory.