New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL recognition #113

Open
spikebike opened this Issue Jan 6, 2017 · 14 comments

Comments

Projects
None yet
9 participants
@spikebike

spikebike commented Jan 6, 2017

Other popular linux terminals often have a feature when you mouse over a URL it highlights and you can right click to open them in a browser. I believe this is often referred to as "dingus click". I find it a very handy feature.

@lord-re

This comment has been minimized.

Show comment
Hide comment
@lord-re

lord-re Feb 23, 2017

a left click on an url to open it in a configured browser would be very nice.

lord-re commented Feb 23, 2017

a left click on an url to open it in a configured browser would be very nice.

@casey

This comment has been minimized.

Show comment
Hide comment
@casey

casey Apr 28, 2017

It would be interesting to implement this by allowing the user to supply a series of rules consisting of a pattern and an action.

For example:

rules:
  'https://[^\s]+': firefox {0}
  '([-_0-9a-zA-Z/]+):([0-9]+)': some-ide {1} --line {2}

The key for a rule is a regex to match under the cursor, and the value of the rule shows the command line to run when it matches, with {N} representing capture groups of the matched regex to substitute into the command.

This is roughly how the the Plan 9 plumber works, so no credit due to me for this idea:

https://en.wikipedia.org/wiki/Plumber_(program)
http://man.cat-v.org/plan_9/6/plumb
http://doc.cat-v.org/plan_9/4th_edition/papers/plumb

It seems like there are probably many useful features of the form "When I click on text that looks like this, do something specific." of which clickable URLs are a special case, so solving this in a general way may be advantageous.

casey commented Apr 28, 2017

It would be interesting to implement this by allowing the user to supply a series of rules consisting of a pattern and an action.

For example:

rules:
  'https://[^\s]+': firefox {0}
  '([-_0-9a-zA-Z/]+):([0-9]+)': some-ide {1} --line {2}

The key for a rule is a regex to match under the cursor, and the value of the rule shows the command line to run when it matches, with {N} representing capture groups of the matched regex to substitute into the command.

This is roughly how the the Plan 9 plumber works, so no credit due to me for this idea:

https://en.wikipedia.org/wiki/Plumber_(program)
http://man.cat-v.org/plan_9/6/plumb
http://doc.cat-v.org/plan_9/4th_edition/papers/plumb

It seems like there are probably many useful features of the form "When I click on text that looks like this, do something specific." of which clickable URLs are a special case, so solving this in a general way may be advantageous.

@casey

This comment has been minimized.

Show comment
Hide comment
@casey

casey Apr 28, 2017

Some other ideas:

  • Go to github issue or pull request when clicking on something of the form '#[0-9]+'
  • Open a commit in a gitk / some other repo viewer when clicking a commit hash '[a-f0-9]{40}'

casey commented Apr 28, 2017

Some other ideas:

  • Go to github issue or pull request when clicking on something of the form '#[0-9]+'
  • Open a commit in a gitk / some other repo viewer when clicking a commit hash '[a-f0-9]{40}'
@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost May 3, 2017

could also be dealt with external pipe?
see this st patch http://st.suckless.org/patches/externalpipe

ghost commented May 3, 2017

could also be dealt with external pipe?
see this st patch http://st.suckless.org/patches/externalpipe

@shawncplus

This comment has been minimized.

Show comment
Hide comment
@shawncplus

shawncplus May 8, 2017

As someone who uses irssi inside tmux as a chat client this a pretty big missing feature. Every time I want to click on a link I have to detach my tmux session, open gnome terminal, reattach, click the link then detatch gnome terminal, reattach in alacritty.

shawncplus commented May 8, 2017

As someone who uses irssi inside tmux as a chat client this a pretty big missing feature. Every time I want to click on a link I have to detach my tmux session, open gnome terminal, reattach, click the link then detatch gnome terminal, reattach in alacritty.

@Flat

This comment has been minimized.

Show comment
Hide comment
@Flat

Flat May 8, 2017

Is there a reason you can't just copy the link in irssi and paste it into your browser for the time being? That work flow seems a little convoluted.

Flat commented May 8, 2017

Is there a reason you can't just copy the link in irssi and paste it into your browser for the time being? That work flow seems a little convoluted.

@jwilm

This comment has been minimized.

Show comment
Hide comment
@jwilm

jwilm May 8, 2017

Owner

@Flat that's my strategy for the time being :)

Owner

jwilm commented May 8, 2017

@Flat that's my strategy for the time being :)

@shawncplus

This comment has been minimized.

Show comment
Hide comment
@shawncplus

shawncplus May 10, 2017

@Flat When using tmux the mouse controls are taken over so selecting text selects it for tmux selection mode, not to the system clipboard. If I'm using gnome terminal I can just hold shift and bypass tmux and select text or hold ctrl and click the link.

shawncplus commented May 10, 2017

@Flat When using tmux the mouse controls are taken over so selecting text selects it for tmux selection mode, not to the system clipboard. If I'm using gnome terminal I can just hold shift and bypass tmux and select text or hold ctrl and click the link.

@Flat

This comment has been minimized.

Show comment
Hide comment
@Flat

Flat May 10, 2017

@shawncplus you can set tmux to copy to the system clipboard for example bind-key -n -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe 'xclip -i -sel p -f | xclip -i -sel c' in your .tmux.conf I'm pretty sure holding shift also works for alacritty.

Flat commented May 10, 2017

@shawncplus you can set tmux to copy to the system clipboard for example bind-key -n -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe 'xclip -i -sel p -f | xclip -i -sel c' in your .tmux.conf I'm pretty sure holding shift also works for alacritty.

@casey

This comment has been minimized.

Show comment
Hide comment
@casey

casey May 17, 2017

Here's an interesting crate for finding URLs in text:

https://github.com/robinst/linkify

casey commented May 17, 2017

Here's an interesting crate for finding URLs in text:

https://github.com/robinst/linkify

@P4Cu

This comment has been minimized.

Show comment
Hide comment
@P4Cu

P4Cu Jun 12, 2017

I guess that should have a label : "T - enhancement"

P4Cu commented Jun 12, 2017

I guess that should have a label : "T - enhancement"

@jwilm jwilm changed the title from URL recognition? [enhancement request] to URL recognition Jul 2, 2017

@guiniol

This comment has been minimized.

Show comment
Hide comment
@guiniol

guiniol Sep 12, 2017

If I may, I would really like that feature to be accessible through a keyboard shortcut rather than the mouse.
There are two workflows which work for this:

  • one urxvt extension does this by: you press a key combination, it highlights the latest url, you can press up/down (or j/k) to select other urls, and enter to open it (or y to copy it)
  • termite does that by: you press a key combination, termite creates annotates each url with a number and there is a prompt, you type the number into the prompt and enter to open (there's another key combination to start the copy mode instead).

guiniol commented Sep 12, 2017

If I may, I would really like that feature to be accessible through a keyboard shortcut rather than the mouse.
There are two workflows which work for this:

  • one urxvt extension does this by: you press a key combination, it highlights the latest url, you can press up/down (or j/k) to select other urls, and enter to open it (or y to copy it)
  • termite does that by: you press a key combination, termite creates annotates each url with a number and there is a prompt, you type the number into the prompt and enter to open (there's another key combination to start the copy mode instead).
@maximbaz

This comment has been minimized.

Show comment
Hide comment
@maximbaz

maximbaz Sep 12, 2017

Contributor

To add to your list, there is also a tmux plugin for this: https://github.com/tmux-plugins/tmux-copycat

Although, unfortunately it broke with the release of tmux 2.4+ and still hasn't been fixed, so it is not a viable solution at this moment 😞

Contributor

maximbaz commented Sep 12, 2017

To add to your list, there is also a tmux plugin for this: https://github.com/tmux-plugins/tmux-copycat

Although, unfortunately it broke with the release of tmux 2.4+ and still hasn't been fixed, so it is not a viable solution at this moment 😞

@guiniol

This comment has been minimized.

Show comment
Hide comment
@guiniol

guiniol Sep 13, 2017

I didn't know about this plugin (I was using an older one), but I don't use tmux on my local box usually, so I'd rather have it in the terminal.

guiniol commented Sep 13, 2017

I didn't know about this plugin (I was using an older one), but I don't use tmux on my local box usually, so I'd rather have it in the terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment