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

Load file to REPL

by laughedelic ALL

🔁A Sublime plugin that provides native commands to load current source file into SublimeREPL

Labels repl

Details

Installs

  • Total 9K
  • Win 5K
  • Mac 3K
  • Linux 1K
Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 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
Windows 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 1 0 0 0 1
Mac 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 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 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

LoadFileToRepl Sublime Text 2/3 plugin

Description

This is a companion plugin for SublimeREPL providing a command to load current source file into according REPL. It just uses a REPL command, like :load "foo.hs" for Haskell, or (load-file "foo.clj") for Clojure and etc.

At the moment it supports load command for REPLs of the following languages (in alphabetic order):

Language REPL Contributor PR
Clojure Leiningen @chrisalbright #6
Common Lisp @cfmeyers #12
Elixir/Erlang iex @yitzhakbg #23
F# fsi @garystanford #31
Groovy groovysh @rcavalcanti #15
Haskell GHCi
Idris
JavaScript Node @jkroso #9
Lua @mkottman #5
Matlab @rowanc1 #17
OCaml @himito #36
PowerShell @mvoidex #7
Prolog SICStus @pedrokost #21
Python
R
Racket XREPL @keyanzhang #30
Ruby
Scala
Scheme MIT Scheme @cyberzlex #19
Standard ML SML @ActiveObject #8

It's easy to extend this list. Pull-requests are welcome!

Content

Command SublimeREPL: Load current file

  1. reveals REPL view or opens a new one according to the type of current file;
  2. optionally places REPL in another layout group (to see results simultaneously with code);
  3. optionally clears REPL before loading file;
  4. saves current file;
  5. and finally loads it into REPL, using according command;
  6. optionally moves cursor to the REPL.

You can call it using

  • Command Palette: P ➤ SublimeREPL: Load current file
  • Menu: Tools ➤ SublimeREPL ➤ Load current file
  • Hotkeys: see below.

Settings:

Command load_file_to_repl has several options:

  • clear — if true, clears REPL before loading file (false by default);
  • save_focus — if true, saves focus on the source file, else moves cursor to REPL (true by default).
  • split — if it has "horizontally" or "vertically" (default) value, it determines how window is splitted to show REPL in a new layout group. If it doesn't have one of these two values, or if window was already splitted, this option doesn't take effect — REPL is placed in a new tab or in the next layout group.

Note: if you want another splitting behavior or more flexibility, take a look at the Origamy plugin.

You can find these options and their default values in the menu:

  • Sublime Text ➤ Preferences ➤ Package Settings ➤ LoadFileToRepl ➤ Open Settings

or in Command Palette: Preferences: LoadFileToRepl Settings

Key Bindings:

There are two hotkeys predefined:

  • altenter — runs load_file_to_repl command with default options:
{ "keys": ["super+enter"], "command": "load_file_to_repl" }
  • altshiftenter — same, but clears REPL before loading file and moves cursor to REPL:
{ "keys": ["super+shift+enter"],
  "command": "load_file_to_repl",
  "args": {
    "clear": true,
    "save_focus": false
  }
}

You can find these bindings at

  • Sublime Text ➤ Preferences ➤ Package Settings ➤ LoadFileToRepl ➤ Default Key Bindings

Note: if you don't like them and want to turn off or make your own just set the use_load_file_to_repl_keybindings setting to false and reload Sublime.

Installation

Using Sublime Package Control:

Note: you should install SublimeREPL plugin first

P ➤ Package Control: Install package ➤ LoadFileToRepl

Now restart Sublime Text to load the plugin settings. That's it!