6

I'm looking for a keyboard shortcut to quickly open links in a text file with a Web browser. Is there a trick or a plugin out there?

brandizzi
  • 26,083
  • 8
  • 103
  • 158
egon
  • 61
  • 1
  • 3
  • There probabliy isn't, but it's pretty easy to write your own plugin if you know python. You could for example start from the `select word` function of `line_tools.py` in [this toolbox](http://code.google.com/p/gedit-improving-plugins/). Just edit `if not re.match("\w", char)` so it selects a url and get your browser to open it. – Jens Nyman May 25 '12 at 18:49

3 Answers3

3

You can do this with the External Tools Plugin that ships with Gedit. Select Tools > Manage External Tools. Create a new tool by clicking the little + icon in the lower-left and name it "Open Link" (or whatever you want). Use the following code within the Edit box (assuming you're using Firefox):

#!/bin/sh
xargs -I '{}' firefox '{}'

Then specify your shortcut key and make sure the Input is set to Current word. You can now open a link if the cursor is anywhere in the word (the URL) by choosing Tools > External Tools > Open Link or using your keyboard shortcut.

Micah Carrick
  • 9,967
  • 3
  • 31
  • 43
3

I use Jean-Philippe's Open URI Context Menu plugin. It doesnt have a shortcut key but uses a simple right-click to open the link.

Just upgraded to Gedit 2.8 and version 2 of this plugin is way faster now.

ezraspectre
  • 3,148
  • 5
  • 23
  • 28
0

Modern versions of gedit have the appropriate plugin built-in. Simply go to ☰ → Preferences → Plugins and enable "Open Links".

You can then right-click any link and a new context menu entry "Open Link" will be at the very top.

screenshot highlighting the described plugin in the list

Jan Pokorný
  • 1,418
  • 15
  • 22