konradsz / igrep Goto Github PK
View Code? Open in Web Editor NEWInteractive Grep
License: MIT License
Interactive Grep
License: MIT License
I love the context view feature. It would be nice to support keybindings, like + and -, that would adjust the split between the results and context views from the default 50%.
Alternatively the filename and/or line number could be printed to the stdout and then the user would pipe the output to is clipboard utility
Thank you for the project, just discovered it from other's link.
I'm considering replacing ripgrep with igrep (only install igrep), don't know if it is possible so far. But I have a few suggestions for igrep to make it better.
-w
option which only show matches surrounded by word boundaries--sort=SORTBY
option which sorts the result according to SORTBY
like path--no-ignore
option which ignores files such as .gitignoreUnless I missed a flag, ig
doesn't seem to search hidden directories or files right now. I think something like ripgrep's -.
would be nice.
ripgrep supports a configuration file:
https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md#configuration-file
It would be nice if igrep respected ripgrep's config file so that I can use the same config for both.
Not sure whether you interested in adding vscode, it support open files from command line via code -g <file_name>:<line_number>
, I can also send a PR in the weekend (or keep it in my own forked branch if it not fit your roadmap).
Since the pattern is the second argument in the invocation of igrep, editing the pattern from the command line can become frustrating if you have a long path:
ig pattern /etc/some/long/path/to/a/file/somewhere/else
it would be nice if you could change the pattern inside of igrep's window with results.
Another solution I could imagine is if it was possible to pass the pattern as a named argument rather than positional so that it could be appended:
ig /etc/some/long/path/to/a/file/somewhere/else --pattern mypattern
I would definitely use this if I could pass emacsclient -nw
to the editor to be able to load the results in emacs.. Probably requires so extra options so that it opens the stuff in the right place but I'm sure it's a pretty easy addition. I'd recommend an emacs
and emacsclient
option but probably both should use the -nw (terminal only) option but that's debatable..
Thanks!
I installed igrep from scoop.sh
If I execute the command "ig --editor "code" test", igrep opens normally, but when I try to open a file from one of the lines with the "enter" key, the following error is returned:
ERROR Failed to open editor 'code'. Is it installed?
I have vscode installed.
On Unix-like operating systems like Linux or macOS an environment variable named $EDITOR
can be set, which defines the default editor to be used.
This variable gets used by tools like git if it isn't overwritten by the config.
Something similar could be done for igrep.
The advantage is that users can change their editor in one place and it would be used by many tools.
Here is a code-snippet that shows how to open a file:
https://github.com/mre/envy/blob/43464b8f351a00f4030a5e1b84e846b1c3ac54ab/src/main.rs#L52-L56
If $EDITOR is not set, a fallback could still be used and the setting should still be overwriteable from the commandline of course.
I would like to use igrep to search my WeeChat logs interactively, and I would like to be able to view said logs using a pager rather than an editor. This is so that I don't edit them accidentally, and also so that ANSI escape sequences are displayed correctly.
You could add a less
editor option following the vim
one, but it would make more sense to make the editor command fully configurable so that we don't have to hardcode every editor and pager in the universe.
If you launch ig
with any editor that is not installed on the system
and then try to open any file from the search results
you will be greeted with a panic
message and unusable terminal
In my case everything typed into the terminal became invisible
(while it is actually still being typed and you even can execute commands)
OS : Ubuntu 22.04.1 LTS x86_64
wm : i3
shell : sh
I think it would be better to display some kind of error message
insted of panic
ing
Currently their is a hard coded list of text editors. That does not work very well for people like me who use an editor not in the list.
When opening the editor the application crashes for me with
panicked at 'Error: Failed to run editor.: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /home/petsoi/.cargo/registry/src/github.com-1ecc6299db9ec823/igrep-0.1.2/src/ig/mod.rs:49:22 stack backtrace:
0: rust_begin_unwind at /rustc/d3ad51b48f83329fac0cd8a9f1253f3146613c1c/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt at /rustc/d3ad51b48f83329fac0cd8a9f1253f3146613c1c/library/core/src/panicking.rs:143:14
2: core::result::unwrap_failed at /rustc/d3ad51b48f83329fac0cd8a9f1253f3146613c1c/library/core/src/result.rs:1749:5
3: ig::ig::Ig::open_file_if_requested 4: ig::main note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Fedora 35
I am on Arch Linux, I tried using both --custom-command
and IGREP_CUSTOM_EDITOR
but neither seem to be working. I use fish as my shell and wezterm as my terminal.
When I try the environment variable, ig
ignores it completely. When I try --custom-command
, I just get the following error.
.
Let me know if there is any more information I can provide.
Just recently discovered igrep and it scratches one of my itches that was very hard to get rid of for me. Thanks for making this.
I was wondering if you'd be willing to add -L/--follow
option that allows to follow symlinks; currently the dir symlinks aren't searchable if pointing outside of the searched directory subtree.
It would be nice to support scrolling using the mouse wheel in the main view, similar to less
's --mouse
flag.
Error message of cat file | ig "xx"
:
SEARCHING
Error: Failed to initialize input reader
ig "xx" file
works well, is this a bug or not supported?
Hi, very cool project. Are there any plans to support multiple PATH arguments in the future? I.e., the following command line fails:
$ ig query . /tmp
error: Found argument '/tmp' which wasn't expected, or isn't valid in this context
where passing the same arguments to rg
searches for instances of "query" in both the current directory and /tmp
. POSIX grep also does this, as long as you pass it the -r
flag.
VSCode-insiders may be the same as VSCode,Its command is "code-insiders ". Could you please support for it? Thanks.
Something similar to tig
.
Error: "micro" read from $EDITOR, possible variants: [vim, neovim, nvim, nano, code, vscode, codeinsiders, emacs, emacsclient, hx, helix]
Caused by:
Invalid variant: micro
It would be nice to have an option to preserve ANSI escape sequences in the main view, similar to less
's -r
or -R
flags. Currently it seems like the ESC characters are stripped, leaving only things like [94m[33m
.
It seems the download link is broken.
$ brew tap konradsz/igrep https://github.com/konradsz/igrep.git
$ brew install igrep
Running `brew update --auto-update`...
==> Downloading https://github.com/konradsz/igrep/releases/download/v0.5.1/igrep-v0.5.1-x86_64-apple-darwin.tar.gz
==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/240747715/522d8b04-1b53-4801-a18c-12333b2d
curl: (22) The requested URL returned error: 401 # # ##
Error: igrep: Failed to download resource "igrep"
Download failed: https://github.com/konradsz/igrep/releases/download/v0.5.1/igrep-v0.5.1-x86_64-apple-darwin.tar.gz
Hey!
I saw the reddit post and found the project really cool! I ran the cargo install igrep
command on Windows 10, and compilation was successful. However, running any command results in an error:
Scouring through the crossterm source, I found this line https://github.com/crossterm-rs/crossterm/blob/e920d0cfd7819752b050ace40471af6f6529904c/src/event/sys/windows.rs#L36 to be the culprit. Maybe we need to call an initialization function before drawing the UI?
A binary GitHub release asset for Windows would make usage of igrep very easy. The target triple is x86_64-pc-windows-msvc
This will also allow us to install igrep through Scoop package manager, by creating a manifest (similar to Brew tap). I can make a PR for this.
For new users of igrep (like me!) it would be very useful to have a popup activated by the ? or F1 keys that would show all keybindings. It took returning to the GitHub repo and looking at the README for me to figure out the new context feature.
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.