manateelazycat / color-rg Goto Github PK
View Code? Open in Web Editor NEWSearch and refactoring tool based on ripgrep.
Search and refactoring tool based on ripgrep.
Before begin to search, mark the files which:
then search those marked files only.
Thank you very much!
在windows10上emacs内搜索,显示无搜索结果,linux上可以正确显示搜索结果。
color-rg
窗口中生成的命令,在命令行执行可以正确显示搜索结果。encoding
部分的代码,情况没有变化。setq color-rg-search-ignore-rules nil
,情况没有变化。原生的Emacs环境下,在搜索完成后的结果中,使用r全局替换无效;
OS:ArchLinux
Version: 28.0.50
color-rg: 1ad93ce
是我的操作中少了什么步骤吗?
或者还需要其它的什么信息?
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 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".
Some framework like Doom doens't use exec-shell-from-path
. Could you please add an option for mac users to disable install exec-shell-from-path
?
Thanks!
我目前用 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.
你好,今天更新使用新版本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)
Line676: (or (nth 3 (or state (insert-translated-name-current-parse-state)))
Symbol's function definition is void: insert-translated-name-current-parse-tree!!
It seems (cdr project)
in function color-rg-project-root-dir
is no more a string, which causes the function expand-file-name
failed.
A workaround can be
(expand-file-name (if (fboundp 'project-root)
(project-root project)
(cdr project)))
如题,看着和正则有关!
-*- 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
平台: 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 中上述操作表现正常。
windows 不识别单引号,需要改成双引号才能识别,虽然可以自定义这个变量, 但还是希望默认能够工作
(color-rg-search-ignore-rules "-g \"!node_modules\" -g \"!dist\"")
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.
如图
我希望搜索文件中的 hugo 关键词,但是当这个关键词出现在 org 的代码块里面时,搜索就会出现这样的结果。奇怪的是,搜索代码块有些其他内容时不会出错。
测试文件在:https://drive.google.com/file/d/1G8oRxwqWMLS5lgzS2SC8T7BCMJdlNsKq/view?usp=sharing
使用 color-rg-search-input-in-current-file
搜索关键词 hugo 就会出现这个问题
下面是出错信息:
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)
重现:
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 相关
直接 给 color-rg-search-input-in-project 绑定按键,是不行的。请问这个怎么使用?
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
.
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. 💟
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.
你好,我使用过程中发现,我的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比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
I got an error when use color-rg-search-input , it says "Symbol’s function definition is void: s-trim"
I found "s-trim" is a function in s.el (https://github.com/magnars/s.el), but you not require it
maybe should change "s-trim" to "string-trim"?
我尝试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能够正常在当前目录搜索。
我的问题是
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)
Somehow this func color-rg-rerun-parent-dir is not working on my side. If it is run, it goes to many levels up instead of just parent folder. Please take a look. Thanks.
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: ;
;;
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?
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
m
for color-rg looks like not workingCan u document about this?
BTW, Thanks for the great package.
应该加上些hook
比如说
在rg搜索完并insert到color-rg-buffer之后
还有就是color-rg-open-file之后
color-rg 最近用的很好,不过有个问题还是挺困扰我。
下面是 reproduce:
例如,当前,我在 A 页面,
然后这个时候,我的目的其实是: “退出 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)
Message:
compilation-buffer-name: Symbol’s function definition is void: compilation--default-buffer-name
Environment:
win10 + msys2 +emacs26
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.