Git Product home page Git Product logo

igrep's Issues

Support interactively changing context size

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%.

A few suggestions

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.

  1. Support ripgrep's -w option which only show matches surrounded by word boundaries
  2. Support ripgrep's --sort=SORTBY option which sorts the result according to SORTBY like path
  3. Support ripgrep's --no-ignore option which ignores files such as .gitignore
  4. Support bindings of fold/unflod for matches of current file or fold/unfold all the other files
  5. Support filter by regex/path, which show only the typed regex paths in the tui window, or jump to the specific file based on typed regex
  6. Support horizontal/vertical context viewer options which can be turned on by default after tui window is loaded

Support open files in VSCode

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).

[feature request] edit the pattern in the intermediate window

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

Support for emacs / spacemacs ?

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!

ERROR Failed to open editor 'code'. Is it installed?

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.

Use $EDITOR by default if set

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.

Custom editor command?

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.

Terminal becomes unusable after opening the editor fails

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 panicing

Support any text editor

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.

Crash when opening editor

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

--custom-command and IGREP_CUSTOM_EDITOR not working

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.
out_3.

Let me know if there is any more information I can provide.

Follow symlinks?

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.

Mouse wheel scrolling

It would be nice to support scrolling using the mouse wheel in the main view, similar to less's --mouse flag.

Failed on m1 mac

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?

Support multiple PATH arguments

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.

Editor micro not supported

Error: "micro" read from $EDITOR, possible variants: [vim, neovim, nvim, nano, code, vscode, codeinsiders, emacs, emacsclient, hx, helix]

Caused by:
Invalid variant: micro

Preserve ANSI escape sequences

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.

Failed to download for macOS

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

Error: `Initial console modes not set` on Windows

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:

cursor2

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?

Release binary for Windows

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.

Theme for white background environments

Hi, the tools looks super useful!

I was hoping I could use it with my current white background setup. This is how it looks at the moment:
image

Basically, just print the main text as black instead of white.

Maybe by reading the light background flag on neovim?

Add help popup on hitting F1 or ?

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.

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.