If you're like me and you find yourself ssh'ing into a prod console on a daily basis to do some debugging or run once-off scripts, you probably hate your life.
And if the high latency of ssh connections means that you never, EVER, manage to type
Organisationalunit right the first time, you probably also hate yourself.
If you're not lazy you might push to get mosh installed on your workplace's servers but if you're like me: you are lazy.
CodeSlap lets you push commands to your terminal session from the comfort of a text editor, as if you were directly typing into the terminal itself. The editor is powered by CodeMirror meaning familiar keybindings, multi-cursors, and easy navigation.
shift+tab to toggle between CodeSlap and the application you want to push commands to. Type a command and press
enter and it will be pushed to your terminal (or whichever application was last focused).
You can grab the zip file from the releases page. After unzipping, drag the application into your applications folder.
You will need to allow CodeSlap to 'control your computer' (so that it can switch focus and push your commands to the terminal) like so:
If CodeSlap does not appear in the list, you can add it manually via the
Strip whitespace before period when pasting
Disabled by default.
When this option is enabled, a command like the following:
Author .find_by(id: 123) .name
will be converted to
Author.find_by(id: 123).name when pushing to the terminal. This is useful in a language like Ruby where you would otherwise need to wrap your command in a
Single line mode
Enabled by default.
When this option is enabled, the up and down arrow keys will go back and forwards through your command history, and pressing
enter will push the command.
Whent the option is disabled, the up and down arrow keys will move your cursor and instead you can use
cmd+k to traverse the command history. Pressing
enter will create a newline, and
shift+enter will push the command.
Colours your syntax.
Glob for hints and autocomplete
If you enter a glob into this input and press
sync, all files matching that glob will be scanned for frequent words and those words will be extracted for use in hinting.
Really Unimpressed Netizen (RUN) Q&A:
RUN: I'm unimpressed. If the point of this app is to circumvent latency issues when ssh'ing into a remote console, doesn't this just move the latency from a per-character delay to a larger delay when you try to push the command?
CodeSlap: The main idea behind my existence is to reduce typos caused by latency. Nobody has ever made a typo due to intermittent latency that occurs after the command is typed. And I think you'll find the latency upon pushing the command is unnoticeable, unless your connection is really bad. And if youre connection is really bad, typing commands directly will be even more of a pain.
RUN: But Mosh already solves this problem with optimistic rendering of keystrokes.
CodeSlap: Mosh indeed solves the latency problem, but it requires setup both client-side and server-side. It also lacks many of my cool features like multiline editing, multi-cursors and hints.
RUN: Well many of those things could arrive soon enough inside terminals, for example the Ruby REPL will soon have multiline support
CodeSlap: My creator is too impatient to wait for things like that.
RUN: I'll get you one day CodeSlap. You haven't seen the last of me.