Coder Social home page Coder Social logo

color-rg's People

Contributors

c1tas avatar chongqing520 avatar dalugm avatar harumikiyama avatar heheda123123 avatar hsingko avatar lennonwoo avatar manateelazycat avatar matthewzmd avatar owensys avatar pengpengxp avatar renwenshan avatar shuxiao9058 avatar smallzhan avatar twlz0ne avatar xlshiz avatar yilin-zhang avatar ynjxsjmh avatar yqrashawn avatar zw963 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

color-rg's Issues

Please enable to search specific file only

Before begin to search, mark the files which:

  1. match a specific file extension (like .log, .txt, etc...)
  2. match a regxp for the file name (like 2018_08_08.log, 2018_08_09.log -> \d{4}\d{2}\d{2}.log)

then search those marked files only.

Thank you very much!

Color-rg cannot show correct result on Windows 10

在windows10上emacs内搜索,显示无搜索结果,linux上可以正确显示搜索结果。

  1. 使用color-rg窗口中生成的命令,在命令行执行可以正确显示搜索结果。
  2. 注释掉 encoding 部分的代码,情况没有变化。
  3. setq color-rg-search-ignore-rules nil,情况没有变化。
    以上2-3的测试在命令行中均能得到正确的结果。
    猜想是否是由于windows上rg返回的查询内容中,rg默认把路径后半部分(相对路径)设置成"\",而前半部分(文件所在的绝对路径)由color-rg插件给出的是"/",导致color-rg无法正确获得rg搜索的结果?我比对相同的搜索命令,在windows和linux上返回的结果除此之外没有其他的不同。

搜索完成后,按r全局替换无效

原生的Emacs环境下,在搜索完成后的结果中,使用r全局替换无效;
OS:ArchLinux
Version: 28.0.50
color-rg: 1ad93ce

是我的操作中少了什么步骤吗?
或者还需要其它的什么信息?

package exec-path-form-shell

Hi

I try to use your great package, but when I install it by manual, it seems like just put color-rg file is not enough, I also need to install exec-path-from-shell package, maybe you could put the package-dependency message on the README.md

Can't jump to the file position

Can't jump to file position on Windows.
M-x rg output buffer line is "file-path:line-number: result",
then <enter/return> will be jump to the file and goto line.

But color-rg outpub buffer line is "line-number:column-number: result",
then <enter/return> will be open a new buffer, buffer name is "line-number:column-number: result".

screenshot

是否考虑加一个 color-rg-rerun-in-project 函数?

我目前用 color-rg 的方式和 VSCode 相同,一个全局快捷键绑定 color-rg-search-input-in-project.

这有个问题,有时候结果的确太多,而且我得配置不少 color-rg-search-ignore-rules.

看你 blog 里,说你常用的是 color-rg-search-input, 这个也挺好的,也可以用 o 在上一级目录搜索。

但是如果可以一个键,从 color-rg-search-input 直接切换到 color-rg-rerun-in-project,就更好了。

这样的话,我可以全局默认为 color-rg-search-input, 如果找不到,再选择向上或直接项目内搜索了。

有兴趣的话,我可以晚点尝试提个 PR.

Symbol's function definition is void: tramp-tramp-file-p

你好,今天更新使用新版本color-rg时报错Symbol's function definition is void: tramp-tramp-file-p,查看你的commit记录了解到,新版本已支持搜索tramp路径,对于未安装tramp的用户来说会出现这个问题。是否应该在color-rg-filter-tramp-path函数加上以下判断条件来解决这个问题:
(if (and (fboundp 'tramp-tramp-file-p) (tramp-tramp-file-p x)) (let ...) x)

使用 r 键尝试 replace, 并取消后,显示有错。

假设现在用 BrightnessChangedEvent 搜索项目,得到三个文件内的若干结果。

尝试按下 r 做替换, 替换为 BrightnessChangedEvent123

此时 minibuffer 提示如下 (见截图)

image

按下回车执行替换,此时 minibuffer 可能因为最近改了配置原因,只是显示一个 r-, (见截图)

image

刚开始并未理解是怎么回事儿,因此我会 C-g 取消掉。

然后再次按下 r 尝试替换时,显示如下: (见截图)

image

这个显示是错的,因为文件中内容并没有完成替换。

当搜索到的对象有特殊字符时出错

如题,看着和正则有关!

-*- mode: color-rg; default-directory: "~/.config/doom/" -*-
color-rg started at Tue Apr 23 11:01:41

rg --column --color=always --heading --smart-case -e \+hlissner\:multi-previous-line /Users/jiya/.config/doom/
regex parse error:
    +hlissner:multi-previous-line
    ^
error: repetition operator missing expression

color-rg 

color-rg-apply-changed 在最新的 emacs --HEAD 中无效

平台: MacOS, emacs 27.0.50

emacs 安装方式:
brew install emacs-plus --HEAD --with-xwidgets --with-jansson --without-spacemacs-icon
xwidgets 补丁使用了 d12frosted/homebrew-emacs-plus#149

症状:
emacs -q 启动, 然后随意找个文件, color-rg-search-input-in-current-file 搜索,在搜索结果中,e 进入 edit 模式,编辑后通过 C-c C-c 发送 color-rg-apply-changed 命令,Minibuffer 提示 Text is read only.
然后打开的文件变成了 read-only 模式, 此时 emacs 也无法退出, C-x C-c 提示 Text is read only

emacs 26.2 中上述操作表现正常。

Publish on MELPA and/or Non-GNU ELPA (prefer both)

Fetching from source works for me, but I hold the opinion that this project being available in an ELPA gives me and others the following advantages:

  • Users are more accustomed and typically face less immediate friction when fetching from an ELPA. This usually results in more users. More users usually means more bug reports and more feature requests. This tends to result in better software.

  • If this repository becomes compromised with malware, there is an additional way of taking access to the repository down. I.e., besides reporting to GitHub, one can report to the ELPA's maintainers. Either one of these organizations taking action will likely result in the compromised version of the project no longer being available on the ELPA. A user that is fetching from ELPA gets to benefit from the faster of the two, instead of only the repository hosting provider.

  • In case this project archives this location and moves to another location (e.g., GitLab), the project's then-maintainer will likely forget to update the ELPA's "recipe" (MELPA terminology) less often than they forget to somehow redirect from-source users to the new location. This is because ELPA users will be likely more common; mention of fetching the project from ELPA will be likely more common than mention of fetching the project from source. Forgetting this means users run a high risk of using a stale project for a long time.

Why both:

  • The project will benefit from the potential quality increase that comes from going through an additional ELPA maintainer team's review(s).

  • More access typically means more users; this typically results in better software, as mentioned before.

color-rg 搜索 org 中的代码块出现乱码

如图
image
我希望搜索文件中的 hugo 关键词,但是当这个关键词出现在 org 的代码块里面时,搜索就会出现这样的结果。奇怪的是,搜索代码块有些其他内容时不会出错。

我用 emacs -Q 也进行了测试,同样存在这个问题:
image

测试文件在:https://drive.google.com/file/d/1G8oRxwqWMLS5lgzS2SC8T7BCMJdlNsKq/view?usp=sharing

使用 color-rg-search-input-in-current-file 搜索关键词 hugo 就会出现这个问题

先按下 u (color-rg-unfilter), 然后再按下 L 或 R 出错。

下面是出错信息:

Debugger entered--Lisp error: (wrong-type-argument consp nil)
  color-rg-rerun()
  color-rg-rerun-literal()
  funcall-interactively(color-rg-rerun-literal)
  #<subr command-execute>(color-rg-rerun-literal nil nil nil)
  ad-Advice-command-execute(#<subr command-execute> color-rg-rerun-literal)
  apply(ad-Advice-command-execute #<subr command-execute> color-rg-rerun-literal)
  command-execute(color-rg-rerun-literal)

重现:

  1. 随便搜索个关键字,得到若干结果。(此时结果全部为同一文件类型)
  2. 按一下 u, 因为只有一个文件类型,而且之前也没有通过 x 或 X 过滤过,此时没有任何提示。
  3. 按下 L 或 R, 出现上述错误。

evil-mode compatibility issue

This extension is really cool however it doesn't work well in my Emacs. I have evil-mode and evil-collection installed. The search works fine but I cannot visit the file from the result buffer. RET key just keep moving to next line.

A similar extension called deadgrep had the similar issue but solved by this commit in evil-collection. dab8f383

I hope this bug can be fixed. Thanks for the awesome work!

提个建议

我看代码的时候比较多

是不是可以把buffer的名字改成与key相关的

并用 cur-search 保存调用的 current-buffer,这样就可以在两个buffer之间切换了

可以走的更远一点 : 一个buffer可以与多个 color-rg 相关

While searching in dired mode, occurs "No such file or directory" error

command:

rg --column --color=always -H --heading --max-columns 3000 --no-ignore -g '!node_modules' -g '!dist' --smart-case -e tags "~/Documents/"

command didn't expand ~ to home directory path, because it was quoted.

In the dired buffer, the default-directory is shown as ~/Documents instead of the complete path /home/user/Documents.

Idea: Support `ripgrep` 's `-A`, `-B` and `-C` option

Hello,

I want to express my gratitude for your amazing color-rg project.

I noticed that ripgrep has the following options: --after-context, --before-context, and --context. These options allow for displaying more contextual information in the search results.

$ rg -h | grep  context
    -A, --after-context <NUM>                    Show NUM lines after each match.
    -B, --before-context <NUM>                   Show NUM lines before each match.
    -C, --context <NUM>                          Show NUM lines before and after each match.

It would be wonderful if color-rg could support these options as well, along with the ability to customize the context number in the result buffer of color-rg-mode.

If you find this idea appealing, I would be delighted to submit a pull request. 💟

color-rg will modify file automatically

If I use color-rg-jump-next-keyword' color-rg-jump-prev-keyword' and `color-rg-open-file', color-rg will modify the corresponding buffer.

Not occur everytime. It's occasionally.

没有`goto-column'函数

你好,我使用过程中发现,我的emacs里面没有 `goto-column' 这个函数。

我的emacs版本如下:

GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2018-06-15

怎么和swiper一起用

swiper比isearch好用,怎么把isearch-toggle-color-rg改成适合swiper啊

(defun swiper-toggle-color-rg ()
(interactive)
(color-rg-search-input isearch-string))

我再啰嗦一句

可以提供对外的访问接口

这样或许更容易和其它的包交互

比如说

提供一个 color-rg-map-file

还可以有一个 color-rg-map-matches

color-rg在win10下当前目录搜索失败

我尝试M+x 运行color-rg-search-symbol,不管是搜索中文还是英文,都没有任何结果。
我把出错的rg命令复制出来,
rg --column --color=always -H --heading --max-columns 3000 --no-ignore -g '!node_modules' -g '!dist' --smart-case --type org -e "test" "c:/Users/Administrator/.emacs.d/"
在cmd里运行结果和在emacs里运行一样。
测试了几遍以后,发现是
-g '!node_modules' -g '!dist'
的问题。
去掉这两个(setq color-rg-search-ignore-rules "")以后,color-rg-search-symbol-with-type能够正常在当前目录搜索。
我的问题是

  1. 这两个参数的含义是什么,去掉之后会对color-rg-search-symbol-with-type有影响吗(虽然它当前正常运行),比如遗漏一些文件
  2. 我能 setq color-rg-search-ignore-rules "" 使用color-rg吗
    不太了解rg,谢谢。

无法搜索包含中文的路径

Windows下,路径中如果包含中文就无法搜索
The system cannot find the file specified. (os error 2)
但路径下的中文版文件名的内容是可以搜索的

请提供默认快捷键支持

可以方便直接将一组快捷键应用到mode上,或者增加一个 color-rg-command-map用来用户自己绑定前缀。

参考projectile的绑定方式

 (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)

Compatibility problem with some ripgrep options

Some ripgrep options cause color-rg does not work. rg takes these options from ~/.ripgreprc file defined by user. Seems, color-rg should ignore ripgrep config file.

diff --git a/color-rg.el b/color-rg.el
index 11bb772..7148e6e 100644
--- a/color-rg.el
+++ b/color-rg.el
@@ -733,7 +733,7 @@ CASE-SENSITIVE determinies if search is case-sensitive."
   (let ((command-line
          (append
 
-          (list "--column --color=always -H")
+          (list "--no-config --column --color=always -H")
 
           ;; NOTE:                      ;
           ;;

default keybindings seems weired

In the keymap:

(defvar color-rg-mode-map
  (let ((map (make-sparse-keymap)))
   ...
    (define-key map (kbd "h") 'color-rg-jump-next-file)
    (define-key map (kbd "l") 'color-rg-jump-prev-file)
   ...

exchange these two keybindings maybe more comfortable for vim-style users?

Dyed the wrong areas

I used color-rg to search my notes written via org-mode, integrating it into my spacemacs configuration. It's more flexible than counsel-projectile-find-file, but dyes the wrong areas as following:

image

Some keywords defined by org-mode cause this problem, like ** header, :tag:, - list and so on.

搜索结果中奇怪的高亮

我这里搜索出来的结果中会有奇怪的高亮, 环境是 doom-emacs. 我研究了一下安装的包,对应去 disable, 但是没找到问题. 表现是会随机出现不规则的色块,如下图所示(在 color-rg.el 中搜索 color-rg), 我 describe-char 看了一下,与正常显示的区别是有一个奇怪的 overlay, 目前还没有其他头绪.
屏幕快照 2019-05-13 19 13 56

How to ignore or exclude some files by regex

after using color rg for searching

I want to ignore the testing file like _test.go

rg can do this like --glob=!*_test.go

but

  1. m for color-rg looks like not working
  2. there is no other to change the rg args

Can u document about this?


BTW, Thanks for the great package.

我提个建议啊

应该加上些hook

比如说

在rg搜索完并insert到color-rg-buffer之后

还有就是color-rg-open-file之后

[问题] 使用 color-rg 搜索,并且使用 TAB 依次打开结果查看,如果找到了感兴趣的文件,此时希望编辑这个并退出 color-rg

color-rg 最近用的很好,不过有个问题还是挺困扰我。

下面是 reproduce:

例如,当前,我在 A 页面,

  1. 然后打开 color-rg 搜索 "Mobile_GroupMembersPage", 然后找到了期望的结果。
  2. 我用 TAB 切换到那个搜索结果,让 buffer 内容显示出来
  3. 然后我按下回车,光标切换到这个页面,假设叫做 B 页面

然后这个时候,我的目的其实是: “退出 color-rg window, 并且在新的搜索到 B 页面继续编辑“,
我最开始的做法是,执行命令 ”color-rg-quit", 这个肯定是不行的,因为又回到了 A 页面。

所以我通常的做法是: C-x 1, 让当前 buffer 直接最大化,但是这个似乎并不是正确的解决办法,
因为 color-rg 并未退出,我真正的目的是,color-rg-open-file-and-stay-then-quit-color-rg

当然,原来的 RET 的 color-rg-open-file-and-stay 还是很有用的,我可以随时通过 color-rg-back 返回搜索页面,继续查找。
我只是希望有另一个 defun, 例如,绑定到 C-j,可以打开搜索结果页面,并且完全退出 color-rg.(关闭 color-rg window)

Wrong type argument: hash-table-p, ni

cd ~
emacs -q -l ~/.emacs.d/elpaca/repos/color-rg/color-rg.el
color-rg-search-input 输入test(搜索出来的结果很多)
image
是不是搜索到一些二进制文件了

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.