Coder Social home page Coder Social logo

jesseduffield / codeslap Goto Github PK

View Code? Open in Web Editor NEW
9.0 3.0 0.0 2.15 MB

Push commands to your terminal console from the comfort of a text editor

License: MIT License

JavaScript 48.75% Python 5.57% CSS 39.49% HTML 6.18%
terminal console lazy ssh

codeslap's Introduction

CodeSlap

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.

Usage

Press 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).

demo

Installation

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 + button.

Settings

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 begin/end block.

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+j and cmd+k to traverse the command history. Pressing enter will create a newline, and shift+enter will push the command.

Syntax colouring

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.

codeslap's People

Contributors

jesseduffield avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

codeslap's Issues

Easier dragging of window

Given that the codeslap window is frameless, the main way to drag it is to drag horizontally while clicking down on the top edge of the window, but that's not very intuitive. We should have some way of easily dragging the window around

Better iterm2 integration

I want to be able to anchor the codeslap window to my current terminal panel so that if I resize it or switch to a new panel, the codeslap window comes along. As far as I know this would require a proper integration with iterm2, using its api.

Add setting to only push to a certain application

Given this app is made for pushing commands to the terminal, we should be able to say 'always push to Iterm2'. That way, if we coincidentally had another application focused last, we won't accidentally push to that application.

I'm not sure how to go about this. osascript seemed pretty sluggish when I used it to check the name of the last focused application (hence why that feature isn't here).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.