Skip to content

Suggestion: extended regex mode for "hints" kitten #2124

Closed
@artemave

Description

@artemave

I am using "hints" kitten to open file links in terminal vim (in a different tmux pane) and it works really well. In fact, that's the sole reason I switched to kitty (though it's awesome in every other way too).

There are few bits though that I find "hints" is missing:

  • regex is never 100% accurate: there are either false positives, or not enough match
  • can't group multiple regexps under a single shortcut (I'd like to open file links and web links with the same shortcut)
  • can't hint on a text that doesn't look like a file path, but nonetheless maps onto one (e.g., in rails log, PostsController#create maps onto a particular line in app/controllers/posts_controller.rb

So I was thinking to have a go at extending "hints" kitten, such that it supports the following contrived config:

map kitty_mod+f kitten hints --type regex-plus \
  --regex1 "FILE_WITH_LINE_NUMBER_REGEX" --transform1 ~/return_input_if_file_exists.sh --program1 ~/bin/open_in_vim.sh
  --regex2 "RAILS_CONTROLLER_ACTION_REGEX" --transform2 ~/rails_controller_action_to_path.sh --program2 ~/bin/open_in_vim.sh
  --regex3 "WEB_URL_REGEX"

If the command specified in --transformX returns an empty string: no hint is shown for the --regexX. Otherwise, the hint is shown and --transformX output is passed into --programX command.

Any thoughts on the above? What are the chances of this getting merged?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions