Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
33 lines (28 sloc) 1.58 KB
Better_errors gem does well on Mac, but on linux it has one disadvantage: link to remote file doesn't open it in editor as it does on Mac.
That is because of type txmt:// protocol used in the link. Such protocol is unique and not recognized by the browser.
So, to make it working, first step is to register it in the browser or create a protocol mime-type handler in desktop.
For KDE try:
1.With Firefox follow this example:
2.With Chrome follow this example:
Firefox pop up dialog window to choose application, which handle new registered protocol.
For Chrome is necessary to point an application in protocol/mime handler script.
Second step is creation a protocol handler, that is thin application.
In directory "/user/local/bin" create a file "txmt_vim". Make it executable!.
That file does simply task, extracts "/path/to/file" and line number from url, then runs vim editor with extracted arguments.
That's it
#!/usr/bin/env ruby
txmt_param = ARGV[0]
txmt_path = txmt_param.match("%2F.*&").to_s
txmt_path = txmt_path [0...-1]
txmt_path_slashed = txmt_path.gsub("%2F","/")
txmt_line = txmt_param.match("&line=.*").to_s
txmt_line = txmt_line [6..txmt_line.length]
vim_params =
vim_params = "--remote-tab-silent"
vim_params << " +#{txmt_line}" if txmt_line
vim_params << " #{txmt_path_slashed}"
`gvim #{vim_params}`
Solution tested on PCLinuxOS with KDE, but should be good on every Linux distro. Use appropriate shebang #! to ruby.