Gedit: make links clickable (with Ruby script)
Gedit is my favorite text editor in Ubuntu. It’s almost perfect for me.
I use it for fast files editing or simple scripts writing when I don’t want to open my IDE.
But I feel uncomfortable with Gedit when I cannot click links directly in text. We can fix it easily with External Tools plugin. All we need is to write a simple script (I prefer Ruby) and run it through External Tools.
Write Ruby script
- Create
click_link.rbin your home directory. Paste following text to
click_link.rb#!/usr/local/bin/ruby v1 = ARGV[0] require "uri" url = URI.extract(v1)[0] system("firefox #{url.to_s}")Do not forget to make
click_link.rbexecutablechmod +x click_link.rb
Create External Tool for Gedit
- Enable
External Toolsplugin in Preferences - Tools > Manage External Tools
- Add new tool
Paste following text
#!/bin/sh /<your_path_to_file>/click_link.rb $GEDIT_CURRENT_LINESet Input = Current line and set desired Shortcut key
Thats it.
Now just set your cursor on the line with a valid URL and press your shortcut key. Firefox should open your URL.
You can do a lot of interesting things with
External Tools. Anything you want!
For example, you cangrepselected word from another document or logs.
Comments
Post a Comment