redguardtoo / counsel-etags

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

当tag搜索不到想要的内容时回退到使用ripgrep #89

Closed heheda123123 closed 1 year ago

heheda123123 commented 1 year ago

比如看emacs源码的时候,在生成tag前用counsel-etags-find-tag去找make-process,再输入defun就能找到。 但是在生成源码之后就找不到了,可能是因为emacs中定义make-process是用宏定义的,比较奇葩。ctags并不能把这个符号识别为一个tag。 不过对于使用counsel-etags的体验而言,生成etags之后反而下降了 最好可以在tag搜索不到时按一个键就可以回退到使用ripgrep

redguardtoo commented 1 year ago

C-h v counsel-etags-ctags-options-file

See https://docs.ctags.io/en/latest/option-file.html and https://docs.ctags.io/en/latest/optlib.html

heheda123123 commented 1 year ago

分别配置不同的按键解决了

    (evil-define-key '(normal visual motion) 'global (kbd "<leader>tt") 'counsel-etags-find-tag)
    (evil-define-key '(normal visual motion) 'global (kbd "<leader>tl") 'counsel-etags-list-tag)
    (evil-define-key '(normal visual motion) 'global (kbd "<leader>tg") 'counsel-etags-scan-code)
    (evil-define-key '(normal visual motion) 'global (kbd "<leader>tq") 'counsel-etags-grep)
redguardtoo commented 1 year ago

分别配置不同的按键解决了

    (evil-define-key '(normal visual motion) 'global (kbd "<leader>tt") 'counsel-etags-find-tag)
    (evil-define-key '(normal visual motion) 'global (kbd "<leader>tl") 'counsel-etags-list-tag)
    (evil-define-key '(normal visual motion) 'global (kbd "<leader>tg") 'counsel-etags-scan-code)
    (evil-define-key '(normal visual motion) 'global (kbd "<leader>tq") 'counsel-etags-grep)

我意思是可以改一下 ctags设置, 加个regex,让ctags能解析出tag

heheda123123 commented 1 year ago

分别配置不同的按键解决了

    (evil-define-key '(normal visual motion) 'global (kbd "<leader>tt") 'counsel-etags-find-tag)
    (evil-define-key '(normal visual motion) 'global (kbd "<leader>tl") 'counsel-etags-list-tag)
    (evil-define-key '(normal visual motion) 'global (kbd "<leader>tg") 'counsel-etags-scan-code)
    (evil-define-key '(normal visual motion) 'global (kbd "<leader>tq") 'counsel-etags-grep)

我意思是可以改一下 ctags设置, 加个regex,让ctags能解析出tag

嗯,我明白大佬的意思,不过单独设置按键也解决了我的需求