Skip to content
Terminator plugin to open files specified by a given regex in an editor
Python
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
README.md Update README.md Jun 30, 2018
editor_plugin.py FIX #17: Trying to decode Python3 unicode string Jul 30, 2019

README.md

Terminator Editor Plugin

Terminator plugin to open a file uri, including line number, in an editor. When the configured regex is matched, you can click the link and open the file in a previously configured editor. See the demo at https://github.com/mchelem/terminator-editor-plugin/wiki.

Installing the Plugin

  • Create the plugins folder if it doesn't exist. On linux: mkdir -p ~/.config/terminator/plugins
  • Copy the plugin file to the plugins folder.
  • In Terminator go to Preferences >> Plugins and enable EditorPlugin.
  • Restart Terminator.

Using the Plugin

  • Use the grep command (e.g. grep -rn import *.py)
  • Use <ctrl>+click to open the file.
  • Right click to copy the link.

Configuration

The configuration file is located at ~/.config/terminator/config. Update the command under the [[EditorPlugin]] section to suit your needs. A few examples are below:

command = gvim --remote-silent +{line} {filepath} 
command = "gvim --remote-silent +"call cursor({line}, {column})" {filepath}"

command = gedit +{line} {filepath} 

command = sublime {filepath}:{line}

command = emacsclient -n +{line} {filepath}

command = code --goto {filepath}:{line}:{column}

command = atom {filepath}:{line}

You can specify the regex to match filenames to your liking.

Regex examples

The inputs to the editor may be specified using the groups parameter. By default the first group matched is the filename and the second is the line number (groups = "file line").

File paths with a specified line number (ex: some/file/path.txt:12) (default):

match = ([^ \t\n\r\f\v:]+?):([0-9]+)

File paths followed by line number and, optionally, column:

match = "([^ \t\n\r\f\v:]+?):([0-9]+):?([0-9]+)?"
groups = "file line column"

Specific file types with or without a line number specified:

match = ([^ \t\n\r\f\v:]+?\.(html|py|css|js|txt|xml|json))[ \n:](([0-9]+)*)

File paths with or without line numbers and Python stack traces:

match = ([^ \t\n\r\f\v:"]+[\.\/][^ \t\n\r\f\v:"]+)?(". line |:)([0-9]+)*
groups = "file separator line"

Warning: Use quotes in your parameters if you want to include a comma.

You can’t perform that action at this time.