Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

Populate *grep* buffer when selecting multiple candidates in fzf-sk-grep #44

Closed
alexherbo2 opened this issue Mar 19, 2019 · 6 comments · Fixed by #47
Closed

Populate *grep* buffer when selecting multiple candidates in fzf-sk-grep #44

alexherbo2 opened this issue Mar 19, 2019 · 6 comments · Fixed by #47
Labels
enhancement Enhancement of existing feature feature request Nonexistent feature request

Comments

@alexherbo2
Copy link

alexherbo2 commented Mar 19, 2019

How to grep file contents and get the file, line and column in results. And also the preview.

@andreyorst
Copy link
Owner

andreyorst commented Mar 19, 2019

Sorry, not sure what you mean by "grep file contents". There are currently two commands, one is sk-grep that is bound to g in fzf-mode and provides interactive grep over current directory recursive, and fzf-search, which is bound to s in fzf-mode and allows you to narrow through contents of current buffer but it is not grep, it is pure fzf filtering.

sk-grep is only available if skim is installed in your system.

@andreyorst
Copy link
Owner

andreyorst commented Mar 19, 2019

Ah, maybe I get it.

Well, I've designed sk-grep to be simple and work like fzf-search does. We can make it use preview feature, and display line numbers, but it will require tweaking the implementation. It's not configurable right now.

@alexherbo2
Copy link
Author

It’s more about skim than fzf.kak, but the grep command is evaluated after each key-press? How about the performance.

Finally, I thought it might be interesting for sk-grep to work with multiple selections, by populating the grep buffer, so search results are reusable with grep-next-match and grep-previous-match.

@andreyorst
Copy link
Owner

the grep command is evaluated after each key-press? How about the performance.

There is no other way to get new results, as all currently existing tools work this way. If there ever will be incremental grep program, it would be better in terms of performance, of course.

I thought it might be interesting for sk-grep to work with multiple selections, by populating the grep buffer, so search results are reusable with grep-next-match and grep-previous-match.

There are two points here:

  1. It meant to be used as incremental search tool, for basic grep usage Kakoune provides useful command already.
  2. I'm not sure if it will be possible to pass default text to fzf or skim without something like tmux send-keys, and fzf.kak supports X11 windows too, so I don't see a way to perform this.

@alexherbo2
Copy link
Author

I was referring to the composability of both when selecting multiple elements with Tab and Shift + Tab from fzf: jump to the first match and populate the grep buffer, so that grep-next-match and grep-previous-match can cycle through the results.

It’s the same idea than doing a search with /, then be able to jump to the next occurrence with n and previous with Alt + n.

@andreyorst
Copy link
Owner

Hm, that's interesting idea. I'll implement this

@andreyorst andreyorst changed the title How to grep file contents Populate *grep* buffer when selecting multiple candidates in fzf-sk-grep Mar 25, 2019
@andreyorst andreyorst added enhancement Enhancement of existing feature feature request Nonexistent feature request labels Mar 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Enhancement of existing feature feature request Nonexistent feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants