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