GotoFile

Overview

GotoFile is a jEdit plugin that lets you open a file that is in your current buffer's line of text or selection, and will also jump to the line number if also found alongside the file name. This is similar to a feature found in most IDEs where you can click hyperlinked file names in compiler error logs or stack traces, however this plugin generalizes the idea to make it more customizable so you can use it with any text file, of any size with no pre-processing overhead. If the target file is already open in another editPane, then that pane will just move its caret to the proper line. If the target file isn't open yet, then it will open it in another pane and split panes if there was only one.


Features

You can configure GotoFile to do the following:

A properties file is used instead of an options dialog for now. The current properties are:

dir
Search this directory for filenames with relative paths, or just basename filenames. To expand the directory recursively, end it with **, such as /tmp/**. Multiple directories should have their own "dir=..." line.
clicks
How many mouse clicks to listen to trigger parsing for filenames in your current line of text. Disable with 0 or blank.
bufferdir
If true, then the buffer that is parsed for a filename will be used as a directory origin when searching.
pattern
A regex with 1 or 2 groups. Specify the filename group with a 1-based index on a subsequent line, like "file = 1". Specify the line group with "line = 2". See example below.


Property File Syntax

An example property file (comments supported) is below. You can add as may dirs and patterns as you want. You can import the file from the jEdit menubar: Plugins->GotoFile->Choose Property File.

	buffer = true
	clicks = 3
	dir = /tmp
	# Expand this dir tree recursively.
	dir = /home/bob/src/** 
	# If no patterns are given, some reasonable defaults are used.    
	pattern = (.*):(\d+)
	file = 1
	line = 2
	pattern = line (\d+) of file "(.*)"
	file = 2
	line = 1

The actual built-in default patterns support general purpose Python, Java and C++ file/line stacktrace conventions.
	# Java, C++
	pattern = [\W]?([\d*\w*\.*/*\-*/*~*@*#*]+):(\d+)[\W]?
	file = 1
	line = 2
	# Python
	pattern = "(.*)", line (\d+)
	file = 1
	line = 2


Download

Files at SourceForge

Installation

Copy GotFile.jar file into ~/.jedit/jars or into your {jedit_install_dir}/jars.


Changelog

20131025 rziemlin 1.0.1 Fixed bug where cached line numbers were used.

20131022 rziemlin 1.0.0 Initial release.

License

MIT Licensed -- This program and code are provided As-Is without warranty.
Copyright (C) Remik Ziemlinski 2013