spacehammer icon indicating copy to clipboard operation
spacehammer copied to clipboard

Tmux Replify

Open jaidetree opened this issue 4 years ago • 4 comments

Came up with a personal mod to get selected text, display a tmux session selector GUI, then send the text to the selected tmux session. In essence, you can have a repl-driven-workflow just about anywhere.

2021-08-29 12 56 48

jaidetree avatar Aug 29 '21 16:08 jaidetree

Would anyone be interested in such a feature?

jaidetree avatar Aug 29 '21 16:08 jaidetree

It just hit me this could be used to facilitate a fennel->spacehammer repl experience:

2021-08-29 14 36 58

  • my ~/.spacehammer/config.fnl is running @Grazfather's repl server script from #93
  • using nodemon to watch my ~/.spacehammer//* and ~/.hammerspoon//* for .fnl files and run ./fennel shevek 7888
  • Can press hyper-t to send selected text in emacs to tmux selection (prompts using the chooser GUI if none selected)
  • If I save a .fnl file nodemon will wait for spacehammer to reloads, then restarts the shevek nrepl client

Rough Edges

  • When spacehammer reloads, hyper-t will prompt to select tmux session again. Could either cache selection in a file or using a hs api if there's one for that. Or I could create a new shortcut that always targets a specfic spoon session name and window
  • It's kind of annoying to select text before sending to the REPL so a separate, more targeted command like hyper-c is created for this purpose, then it could send keys to select the nearest outer form like the eval defun forms

This is a somewhat crude setup spanning a few languages, but it's the most viable path I've found so far.

jaidetree avatar Aug 29 '21 18:08 jaidetree

I like this

When spacehammer reloads, hyper-t will prompt to select tmux session again. Could either cache selection in a file or using a hs api if there's one for that. Or I could create a new shortcut that always targets a specfic spoon session name and window.

You could leave this to the person who sets it up. Maybe they provide a selector function that, if it returns nil, falls back to the hs.chooser. Their selector might use some state file of their choosing, or maybe just hardcodes a window/pane that they always dedicate for this sort of thing.

Grazfather avatar Aug 29 '21 19:08 Grazfather

I like this

When spacehammer reloads, hyper-t will prompt to select tmux session again. Could either cache selection in a file or using a hs api if there's one for that. Or I could create a new shortcut that always targets a specfic spoon session name and window.

You could leave this to the person who sets it up. Maybe they provide a selector function that, if it returns nil, falls back to the hs.chooser. Their selector might use some state file of their choosing, or maybe just hardcodes a window/pane that they always dedicate for this sort of thing.

That sounds like another perfect use case for #107 😄

jaidetree avatar Aug 29 '21 19:08 jaidetree