ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

External REPL

by fbehrens ST3

Sublime 3 Plugin to send lines of code to any REPL running in exteral Console (ConEmu or tmux)

Labels coding

Details

Installs

  • Total 5K
  • Win 3K
  • Mac 887
  • Linux 694
Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6 Mar 5 Mar 4 Mar 3 Mar 2 Mar 1 Feb 28 Feb 27 Feb 26 Feb 25 Feb 24 Feb 23 Feb 22 Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16 Feb 15
Windows 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 1
Mac 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
01234Apr 1Mar 29Mar 26Mar 23Mar 20Mar 17Mar 14Mar 11Mar 8Mar 5Mar 2Feb 27Feb 24Feb 21Feb 18Feb 15Apr 1 Linux: 0 Mac: 0 Windows: 0Mar 31 Linux: 0 Mac: 0 Windows: 0Mar 30 Linux: 0 Mac: 0 Windows: 0Mar 29 Linux: 0 Mac: 0 Windows: 0Mar 28 Linux: 0 Mac: 0 Windows: 0Mar 27 Linux: 0 Mac: 0 Windows: 0Mar 26 Linux: 0 Mac: 0 Windows: 1Mar 25 Linux: 0 Mac: 0 Windows: 1Mar 24 Linux: 0 Mac: 0 Windows: 0Mar 23 Linux: 0 Mac: 0 Windows: 0Mar 22 Linux: 0 Mac: 0 Windows: 0Mar 21 Linux: 0 Mac: 0 Windows: 0Mar 20 Linux: 0 Mac: 0 Windows: 0Mar 19 Linux: 0 Mac: 0 Windows: 0Mar 18 Linux: 0 Mac: 1 Windows: 0Mar 17 Linux: 0 Mac: 0 Windows: 0Mar 16 Linux: 0 Mac: 0 Windows: 0Mar 15 Linux: 0 Mac: 0 Windows: 0Mar 14 Linux: 0 Mac: 0 Windows: 0Mar 13 Linux: 0 Mac: 0 Windows: 0Mar 12 Linux: 0 Mac: 0 Windows: 0Mar 11 Linux: 0 Mac: 0 Windows: 0Mar 10 Linux: 0 Mac: 0 Windows: 0Mar 9 Linux: 0 Mac: 0 Windows: 0Mar 8 Linux: 0 Mac: 0 Windows: 0Mar 7 Linux: 0 Mac: 0 Windows: 0Mar 6 Linux: 0 Mac: 0 Windows: 0Mar 5 Linux: 0 Mac: 0 Windows: 1Mar 4 Linux: 0 Mac: 0 Windows: 0Mar 3 Linux: 0 Mac: 0 Windows: 0Mar 2 Linux: 0 Mac: 0 Windows: 0Mar 1 Linux: 0 Mac: 0 Windows: 0Feb 28 Linux: 0 Mac: 0 Windows: 0Feb 27 Linux: 0 Mac: 0 Windows: 0Feb 26 Linux: 0 Mac: 0 Windows: 0Feb 25 Linux: 0 Mac: 0 Windows: 0Feb 24 Linux: 0 Mac: 0 Windows: 0Feb 23 Linux: 0 Mac: 0 Windows: 1Feb 22 Linux: 0 Mac: 0 Windows: 1Feb 21 Linux: 0 Mac: 0 Windows: 1Feb 20 Linux: 0 Mac: 0 Windows: 0Feb 19 Linux: 0 Mac: 0 Windows: 0Feb 18 Linux: 0 Mac: 0 Windows: 0Feb 17 Linux: 0 Mac: 0 Windows: 0Feb 16 Linux: 0 Mac: 0 Windows: 0Feb 15 Linux: 0 Mac: 0 Windows: 1Apr 1 Linux: 0 Mac: 0 Windows: 0Mar 31 Linux: 0 Mac: 0 Windows: 0Mar 30 Linux: 0 Mac: 0 Windows: 0Mar 29 Linux: 0 Mac: 0 Windows: 0Mar 28 Linux: 0 Mac: 0 Windows: 0Mar 27 Linux: 0 Mac: 0 Windows: 0Mar 26 Linux: 0 Mac: 0 Windows: 1Mar 25 Linux: 0 Mac: 0 Windows: 1Mar 24 Linux: 0 Mac: 0 Windows: 0Mar 23 Linux: 0 Mac: 0 Windows: 0Mar 22 Linux: 0 Mac: 0 Windows: 0Mar 21 Linux: 0 Mac: 0 Windows: 0Mar 20 Linux: 0 Mac: 0 Windows: 0Mar 19 Linux: 0 Mac: 0 Windows: 0Mar 18 Linux: 0 Mac: 1 Windows: 0Mar 17 Linux: 0 Mac: 0 Windows: 0Mar 16 Linux: 0 Mac: 0 Windows: 0Mar 15 Linux: 0 Mac: 0 Windows: 0Mar 14 Linux: 0 Mac: 0 Windows: 0Mar 13 Linux: 0 Mac: 0 Windows: 0Mar 12 Linux: 0 Mac: 0 Windows: 0Mar 11 Linux: 0 Mac: 0 Windows: 0Mar 10 Linux: 0 Mac: 0 Windows: 0Mar 9 Linux: 0 Mac: 0 Windows: 0Mar 8 Linux: 0 Mac: 0 Windows: 0Mar 7 Linux: 0 Mac: 0 Windows: 0Mar 6 Linux: 0 Mac: 0 Windows: 0Mar 5 Linux: 0 Mac: 0 Windows: 1Mar 4 Linux: 0 Mac: 0 Windows: 0Mar 3 Linux: 0 Mac: 0 Windows: 0Mar 2 Linux: 0 Mac: 0 Windows: 0Mar 1 Linux: 0 Mac: 0 Windows: 0Feb 28 Linux: 0 Mac: 0 Windows: 0Feb 27 Linux: 0 Mac: 0 Windows: 0Feb 26 Linux: 0 Mac: 0 Windows: 0Feb 25 Linux: 0 Mac: 0 Windows: 0Feb 24 Linux: 0 Mac: 0 Windows: 0Feb 23 Linux: 0 Mac: 0 Windows: 1Feb 22 Linux: 0 Mac: 0 Windows: 1Feb 21 Linux: 0 Mac: 0 Windows: 1Feb 20 Linux: 0 Mac: 0 Windows: 0Feb 19 Linux: 0 Mac: 0 Windows: 0Feb 18 Linux: 0 Mac: 0 Windows: 0Feb 17 Linux: 0 Mac: 0 Windows: 0Feb 16 Linux: 0 Mac: 0 Windows: 0Feb 15 Linux: 0 Mac: 0 Windows: 1Apr 1 Linux: 0 Mac: 0 Windows: 0Mar 31 Linux: 0 Mac: 0 Windows: 0Mar 30 Linux: 0 Mac: 0 Windows: 0Mar 29 Linux: 0 Mac: 0 Windows: 0Mar 28 Linux: 0 Mac: 0 Windows: 0Mar 27 Linux: 0 Mac: 0 Windows: 0Mar 26 Linux: 0 Mac: 0 Windows: 1Mar 25 Linux: 0 Mac: 0 Windows: 1Mar 24 Linux: 0 Mac: 0 Windows: 0Mar 23 Linux: 0 Mac: 0 Windows: 0Mar 22 Linux: 0 Mac: 0 Windows: 0Mar 21 Linux: 0 Mac: 0 Windows: 0Mar 20 Linux: 0 Mac: 0 Windows: 0Mar 19 Linux: 0 Mac: 0 Windows: 0Mar 18 Linux: 0 Mac: 1 Windows: 0Mar 17 Linux: 0 Mac: 0 Windows: 0Mar 16 Linux: 0 Mac: 0 Windows: 0Mar 15 Linux: 0 Mac: 0 Windows: 0Mar 14 Linux: 0 Mac: 0 Windows: 0Mar 13 Linux: 0 Mac: 0 Windows: 0Mar 12 Linux: 0 Mac: 0 Windows: 0Mar 11 Linux: 0 Mac: 0 Windows: 0Mar 10 Linux: 0 Mac: 0 Windows: 0Mar 9 Linux: 0 Mac: 0 Windows: 0Mar 8 Linux: 0 Mac: 0 Windows: 0Mar 7 Linux: 0 Mac: 0 Windows: 0Mar 6 Linux: 0 Mac: 0 Windows: 0Mar 5 Linux: 0 Mac: 0 Windows: 1Mar 4 Linux: 0 Mac: 0 Windows: 0Mar 3 Linux: 0 Mac: 0 Windows: 0Mar 2 Linux: 0 Mac: 0 Windows: 0Mar 1 Linux: 0 Mac: 0 Windows: 0Feb 28 Linux: 0 Mac: 0 Windows: 0Feb 27 Linux: 0 Mac: 0 Windows: 0Feb 26 Linux: 0 Mac: 0 Windows: 0Feb 25 Linux: 0 Mac: 0 Windows: 0Feb 24 Linux: 0 Mac: 0 Windows: 0Feb 23 Linux: 0 Mac: 0 Windows: 1Feb 22 Linux: 0 Mac: 0 Windows: 1Feb 21 Linux: 0 Mac: 0 Windows: 1Feb 20 Linux: 0 Mac: 0 Windows: 0Feb 19 Linux: 0 Mac: 0 Windows: 0Feb 18 Linux: 0 Mac: 0 Windows: 0Feb 17 Linux: 0 Mac: 0 Windows: 0Feb 16 Linux: 0 Mac: 0 Windows: 0Feb 15 Linux: 0 Mac: 0 Windows: 1

Readme

Source
raw.​githubusercontent.​com

What it is and how it works

This plugin is designed to optimize an interactive programmin workflow, in which you are working in the editor and a console window. There you are editing some programm in the editor, and then run it from the console. Or you are developing in a TDD fashion, so you run some tests from the console. Or you try out some

Installation

of this plugin

  • Install Sublime Text 3
  • Install Package Control
  • Install this Plugin from Sublime with CTrl-Shift-P / Package Control: Install Package / ExternalREPL

install console

On Windows install ConEmu On Linux or OSX install Tmux

  • Add Sublime Directory to Path. This adds the subl command.

  • Adjust ConEmu Settings

    • deactivate Keys & Macro/Paste/Confirm <Enter> keypress ConEmu Settings Plugin send command to Konsole with 'ConEmuC -GuiMacro:0 Paste(0,“command\n”)'

Linux

  • Installation Install Tmux for Mac / Linux

Tested Configuration

Sublime: 3 build 3083

Osx: 10.10.4 Yosemite Linux: Ubuntu 12.04, 14.04 Tmux: 2.0

Windows: 7, 8.1 ConEmu: 150513

Usage

Start session with tmux new -s repl. Start sublime from your console using the subl command. Command()-Shift P and typing External shows the commands. Hotkeys are shown via F1

repl Commands

cs-ENTER Sending selected text (or current line) and to the repl c-up Sending up arrow and Enter to the repl. This hopefully executes your last command. last repl command (doesn't work in pry on windows)

Editor Commands

Those Commands runs or loads the current file or executes test in the language of its syntax. It is possible to execute only the selected test. There is a convention for naming of testfiles. This makes it possible to switch between implementation and tests. The commands are run from the root of the sublime folder, so your project directory needs to be in the sublime side bar.

Language comment run load test framework test test_one testfile
powershell # . psspec psspec psspec -example .tests.ps1
ruby # ruby load minitest
gemfile bundle install
fsharp //
clojure ;
dot dot
markdown pandoc -> doc

cs-. load file
F5 run file
cs-t run testfile
cs-o excecute selected test
cs-' switch code<->test
cs-s Execute last editor Command sc-h Execute from history cs-c change directory/ns

Miscellaneous Commands

This is a grabbag for some stuff that i found useful at a time. cs-1 open explorer cs-2 dublicate file (This is quite useful) cs-3 open file on selected editor line (http:// in chrome or with sublime ) f1 show shortkeys cs-4 restructure mdTOC

Troubleshooting

Silent Failure

Check if console is in your path

Open the sublime console c-

import os
os.environ['PATH'] = "/usr/local/bin:" + os.environ['PATH']

Check if tmux or ConEmuC is on your path. If not consider starting sublime from the console using the subl command.

Check if you can send Keys to your console

Do this from another console and

# Tmux properly working
tmux send-keys -t repl 'ls'  C-m         

# ConEmu on Windows 
ConEmuC -GuiMacro:0 Paste(0,"dir\\n")

Tmux 101

  • From Tmux you can detach with Prefix(C-b) d.
  • and reattach to your tmux session with tmux a -t repl
  • Making the clipboard work between iTerm2, tmux, vim and OS X.

    tmux ls # list sessions tmux kill-session -t name # kill session tmux new -s repl # create new session with name repl tmux attach -t repl # attach to repl

using tmux with iTerm (on OSX)

iTerm has Tmux integration in the way that it can run enter tmux mode, where all windows / split panes are tmux windows / panes. Why is it so slow ?

tmux -CC new -s repl

License

MIT-License (see license.txt)