redguardtoo / counsel-etags

Fast, energy-saving, and powerful code navigation solution
174 stars 15 forks source link

Adds async ripgrep (via counsel-rg) and ivy action "g" to switch to grep from tag search #63

Closed xenodium closed 4 years ago

xenodium commented 4 years ago

First of, thanks for counsel-etags. It's wonderful and simplifies lots.

Unsure if these are of interest, but here are a couple of features I found handy.

async ripgrep (via counsel-etags-async-ripgrep).

This is using counsel-rg as a fallback grepping function. A couple of benefits:

  1. counsel-rg is non-blocking, which helps on really large codebases or slow filesystems (Emacs would block for up to 6 seconds at times).
  2. counsel-rg can receive additional flags (like --glob README).

To use counsel-etags-async-ripgrep as a fallback, set counsel-etags-fallback-search-function to it.

counsel-grep-async

grep ivy action

Addingg another ivy action to be able to switch from tag narrowing to grepping. Ivy actions are typically available via M-o. The grep option is available via "g" key, but can be configured via counsel-etags-find-tag-grep-action-key. It's title can also be changed with counsel-etags-find-tag-grep-action-title.

counsel-grep-action

redguardtoo commented 4 years ago

it's good idea to use third party searching command. It's better that user can use any command though. I added counsel-etags-fallback-grep-function instead.

dc4c779 add `counsel-etags-fallback-grep-function' (Chen Bin)

xenodium commented 4 years ago

Thank you! That works.

What do you think of ivy-add-actions to easily switch to grep from tag narrowing (using “g” action)?

xenodium commented 4 years ago

Thinking about the ivy action a little more, it doesn't seem like the right place to grep-switch since it's not operating on the selection, but rather initial symbol at point. A binding on the ivy-read's keymap may be more appropriate. I'll have a play with it.

Thanks for the change. Closing PR.