Code Monkey home page Code Monkey logo

sendrepl_'s Introduction

SendREPL for Sublime Text

Send Text to Terminal, ITerm, ConEmu, Cmder, Tmux; R (RStudio), Julia, IPython REPL. This is a rewrite of SendTextPlus which aims for higher extensibility and higher self-containedness.

Note: IPython console is assumed for Python syntax.

Following Programs are supported

  • Mac: Terminal, iTerm (>=2.9), Tmux, Screen, RStudio Desktop, R GUI, RStudio and Jupyter running on Chrome and Safari
  • Windows: Cmder, ConEmu, R GUI, RStudio Desktop
  • Linux: Tmux, Screen, RStudio Desktop
  • Others: SublimeREPL

Installation

You could install SendREPL via Package Control. If you are using Linux (Windows), the corresponding platform dependency xdotool (pywin32) will also be installed automatically.

If you have the following error on Windows, please remove the folder python-pywin32 under Sublime Text 3/Pacakges and run the command Package Control: Satisfy Dependencies.

import win32clipboard
ImportError: DLL load failed: The specified module could not be found.

Usage

Select a program using the command SendREPL: Choose REPL Program in command palette. The default program is Terminal for Mac, Cmder for Windows and tmux for Linux.

  • cmd+enter (Mac) or ctrl+enter (Windows/Linux)

    If text is selected, it sends the text to the program selected. If no text is selected, then it sends the current block (if found). Finally, it moves the cursor to the next line.

  • cmd+\ (Mac) or ctrl+\ (Windows/Linux): change working directory (R, Julia and Python (IPython) only)

  • cmd+b (Mac) or ctrl+b (Windows/Linux): source current file (R, Julia and Python (IPython) only)

    SendREPL uses Sublime build system to source files, you might have to choose the Source File option in a pop up window.

Custom Keybind

It is fairly easy to create your own keybinds for commands which you frequently use. For example, the following keybind run the R command source("<the current file>") in the active program.

{
    "keys": ["super+shift+e"], "command": "send_repl",
    "args": {"cmd": "source(\"$file\")"},
    "context": [
        { "key": "selector", "operator": "equal", "operand": "source.r" }
    ]
}

SendREPL understands the following variables in the cmd field:

  • $file, the full path to the file
  • $file_path, the directory contains the file
  • $file_name, the file name
  • $file_basename, the file name without extension
  • $file_extension, the file extension
  • $project_path, the active folder, if not found, use the directory of current file
  • $selection, the text selected, or the word under cursor

Some details about block detection

SendREPL uses the following logic to expand cursor when sending text.

  • R blocks are detected by {,} pairs.
  • Julia blocks are detected by begin, end pairs and indentations.
  • Python blocks are detected by indentations or by # %%/# In[] decorators.
  • Markdown fenced code of Markdown Extended and R Markdown is also supported.

sendrepl_'s People

Contributors

randy3k avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.