Skip to content

Opening a path in an $EDITOR #529

Answered by wez
sqbell asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, but it's a little bit involved because you probably also want file:// URIs to open as well, and you probably don't want to try to edit eg: jpeg images.

Here's a config file that:

  • Invents a $EDITOR: URI scheme
  • Defines a hyperlink rule that categories things that might be file paths (which is really every whitespace delimited sequence) as $EDITOR:filename
  • Overrides the open-uri event handler to snoop for $EDITOR: and file:// URIs, decide if it should be opened in the editor, and then spawns a window with that command (you can also spawn in a pane or a tab)
local wezterm = require 'wezterm';

-- Use some simple heuristics to determine if we should open it
-- with a text editor in the …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sqbell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants