Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ripgrep is nice

License

NotificationsYou must be signed in to change notification settings

cosmicexplorer/helm-rg

Repository files navigation

MELPA

helm-rg example usage

Search massive codebases extremely fast, usingripgrep andhelm. Inspired byhelm-ag andf3.

Also check outrg.el, which I haven't used much but seems pretty cool.

Usage

See theripgrep whirlwind tour for further information on invokingripgrep.

  • Invoke the interactive functionhelm-rg to start a search withripgrep in the current directory.
    • helm is used to browse the results and update the output as you type.
    • Each line has the file path, the line number, and the column number of the start of the match, and each part is highlighted differently.
    • UseTAB to invoke the helm persistent action, which previews the result and highlights the matched text in the preview.
    • UseRET to visit the file containing the result, move point to the start of the match, and recenter.
      • The result's buffer is displayed withhelm-rg-display-buffer-normal-method (which defaults toswitch-to-buffer).
      • Use a prefix argument (C-u RET) to open the buffer withhelm-rg-display-buffer-alternate-method (which defaults topop-to-buffer).
  • The text entered into the minibuffer is interpreted into aPCRE regexp to pass toripgrep.
    • helm-rg's pattern syntax is basically PCRE, but single spaces basically act as a more powerful conjunction operator.
      • For example, the patterna b in the minibuffer is transformed intoa.*b|b.*a.
        • The single space can be used to find lines with any permutation of the regexps on either side of the space.
        • Two spaces in a row will search for a literal single space.
      • ripgrep's--smart-case option is used so that case-sensitive search is only on if any of the characters in the pattern are capitalized.
        • For example,ab (conceptually) searches[Aa][bB], butAb in the minibuffer will only search for the patternAb withripgrep, because it has at least one uppercase letter.
  • UseM-d to select a new directory to search from.
  • UseM-g to input a glob pattern to filter files by, e.g.*.py.
    • The glob pattern defaults to the value ofhelm-rg-default-glob-string, which is an empty string (matches every file) unless you customize it.
    • PressingM-g again shows the same minibuffer prompt for the glob pattern, with the string that was previously input.
  • Use and to go up and down by files in the results.
    • and simply go up and down by match result, and there may be many matches for your pattern in a single file, even multiple on a single line (whichripgrep reports as multiple separate results).
    • The and keys will move up or down until it lands on a result from a different file than it started on.
      • When moving by file,helm-rg will cycle around the results list, but it will print a harmless error message instead of looping infinitely if all results are from the same file.
  • Use the interactive autoloaded functionhelm-rg-display-help to see the ripgrep command's usage info.

TODO

items checked completed here are ready to be added to the docs above

  • make a keybinding to drop into an "edit mode" and edit file content inline in results likehelm-ag
    • currently called "bounce mode" in the alpha stage
    • needs to dedup results from the same line
      • should also merge the colorations
      • this might be easier without using the--vimgrep flag (!!!)
    • can insert markers on either side of each line to find the text added or removed
    • can change the filename by editing the file line
      • needs to reset all the file data for each entry if the file name is being changed!!!
    • can expand the windows of text beyond single lines at a time
      • usinghelm-rg--expand-match-context and/orhelm-rg--spread-match-context
      • and pop into another buffer for a quick view if you want
        • can usehelm-rg--visit-current-file-for-bounce
      • can expand up and down from file header lines to add lines from the top or bottom of the file!
      • can use newlines in inserted text
        • not for file names -- newlines are still removed there
        • would need to use text properties to move by match results then, for everything that useshelm-rg--apply-matches-with-file-for-bounce basically
    • visiting the file should go to the appropriate line of the file!
      • should flash a highlight of the matched text when visiting the file!
  • color all results in the file in the async action!
    • don't recolor when switching to a different result in the same file!
    • don't color matches whenever file path matcheshelm-rg-shallow-highlight-files-regexp
  • useripgrep file types instead of flattening globbing out intohelm-rg-default-glob-string
    • user defines file types in adefcustom, and can interactively toggle the accepted file types
    • user can also set the default set of file types
      • as a dir-local variable!!
  • add testing
    • should be testing all of our interactive functions
      • in all configurations (for all permutations ofdefcustom values)
    • also everything that's called by helm
      • does helm have any frameworks to make integration testing easier?
  • publishupdate-commentary.el and the associated machinery
    • as an npm package, MELPA package, pandoc writer,???
  • make a keybinding for runninghelm-rg on dired marked files
    • then you could do anf3 search, bounce to dired, then immediatelyhelm-rg on just the file paths from thef3 search,which would be sick
  • does ripgrep have any options to traverse the fs in (any type of) sorted order?
    • if so we'll definitely want adefcustom on that asap

License

GPL 3.0+

About

ripgrep is nice

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors5


[8]ページ先頭

©2009-2025 Movatter.jp