{"id":15014748,"url":"https://github.com/randy3k/sendcode","last_synced_at":"2025-10-09T14:41:36.645Z","repository":{"id":44651995,"uuid":"63021867","full_name":"randy3k/SendCode","owner":"randy3k","description":"Send code and text to macOS and Linux Terminals, iTerm, ConEmu, Cmder, Tmux, Terminus; R (RStudio), Julia, IPython.","archived":false,"fork":false,"pushed_at":"2022-11-04T23:13:05.000Z","size":1170,"stargazers_count":201,"open_issues_count":59,"forks_count":32,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-05-15T08:24:16.909Z","etag":null,"topics":["cmder","conemu","gnome-terminal","ipython","iterm2","julia","pantheon-terminal","python","r","rstudio","sendcode","sublime-text","terminal","tmux"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/randy3k.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-10T22:54:06.000Z","updated_at":"2025-03-22T11:08:00.000Z","dependencies_parsed_at":"2022-09-16T07:23:31.209Z","dependency_job_id":null,"html_url":"https://github.com/randy3k/SendCode","commit_stats":null,"previous_names":[],"tags_count":66,"template":false,"template_full_name":null,"purl":"pkg:github/randy3k/SendCode","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randy3k%2FSendCode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randy3k%2FSendCode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randy3k%2FSendCode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randy3k%2FSendCode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/randy3k","download_url":"https://codeload.github.com/randy3k/SendCode/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randy3k%2FSendCode/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001507,"owners_count":26083118,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cmder","conemu","gnome-terminal","ipython","iterm2","julia","pantheon-terminal","python","r","rstudio","sendcode","sublime-text","terminal","tmux"],"created_at":"2024-09-24T19:46:02.475Z","updated_at":"2025-10-09T14:41:36.608Z","avatar_url":"https://github.com/randy3k.png","language":"Python","readme":"# SendCode for Sublime Text\n\n\u003ca href=\"https://packagecontrol.io/packages/SendCode\"\u003e\u003cimg src=\"https://packagecontrol.herokuapp.com/downloads/SendCode.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.paypal.me/randy3k/5usd\" title=\"Donate to this project using Paypal\"\u003e\u003cimg src=\"https://img.shields.io/badge/paypal-donate-blue.svg\" /\u003e\u003c/a\u003e\n\nSend code and text to macOS and Linux Terminals, iTerm, ConEmu, Cmder, Tmux, Terminus; R (RStudio), Julia, IPython.\n\n![](https://user-images.githubusercontent.com/1690993/28198891-4ebe5eaa-682f-11e7-8173-10b64faef9b4.png)\n\n\nFollowing Programs are supported\n\n- Mac: Terminal, iTerm (\u003e=2.9), R GUI, RStudio Desktop, RStudio and Jupyter running on Chrome and Safari\n- Windows: Cmder, ConEmu, R GUI, RStudio Desktop\n- Linux: Tmux, Screen, Gnome-Terminal, Pantheon-Terminal, Mate-Terminal, Konsole, RStudio Desktop\n- Sublime Plugin: [Terminus](https://github.com/randy3k/Terminus)\n\n### Installation\n\nYou could install SendCode via Package Control.\n\n- If you don't have Package Control installed, follow the [installation instructions on the Package Control website](https://packagecontrol.io/installation).\n- In Sublime Text, type \u003ckbd\u003ecmd\u003c/kbd\u003e+\u003ckbd\u003eshift\u003c/kbd\u003e+\u003ckbd\u003ep\u003c/kbd\u003e (Mac) or \u003ckbd\u003ectrl\u003c/kbd\u003e+\u003ckbd\u003eshift\u003c/kbd\u003e+\u003ckbd\u003ep\u003c/kbd\u003e (Windows/Linux)  to bring up the command palette.\n- Into the command palette start typing `Package Control: Install Package` and select the option when in pops up.\n- In the Install Package window start typing `SendCode` and select the option when it pops up.\n- SendCode should then be installed.\n\nIf you are using Linux, we might need to install\n[xdotool](http://www.semicomplete.com/projects/xdotool/) to use some features. Ubuntu users can use\n```\nsudo apt-get install xdotool\n```\nIf it cannot be found, you will be prompted\nto download a [binary distribution](https://github.com/randy3k/sublime-xdotool).\n\n### Usage\n\nSelect a program using the command `SendCode: Choose Program` in command palette. The default program on macOS, windows and linux are Terminal, Cmder and tmux respectively. Each syntax binds to its own program. For instance, you could bind `R` to r files and `tmux` to python files.\n\nThere are two main keybindings:\n\n- \u003ckbd\u003ecmd\u003c/kbd\u003e+\u003ckbd\u003eenter\u003c/kbd\u003e (Mac) or \u003ckbd\u003ectrl\u003c/kbd\u003e+\u003ckbd\u003eenter\u003c/kbd\u003e (Windows/Linux)\n\n    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.\n\n\n- \u003ckbd\u003ecmd\u003c/kbd\u003e+\u003ckbd\u003eb\u003c/kbd\u003e (Mac) or \u003ckbd\u003ectrl\u003c/kbd\u003e+\u003ckbd\u003eb\u003c/kbd\u003e (Windows/Linux): source current file (R, Julia and Python (IPython) only)\n\n    SendCode uses Sublime build system to source files, you might have to choose the `Source File` option in a pop up window.\n\n\n### Troubleshooting\n\n\n1. Python console\n\n   [IPython](https://ipython.org) (5.0 or above, or any repls which support bracketed paste mode) are assumed to be used.\n\n1. [radian](https://github.com/randy3k/radian) console\n\n   You might want to turn on `bracketed_paste_mode` if [radian](https://github.com/randy3k/radian) is used.\n\n1. RStudio on Windows\n    \n   Make sure [RStudio v1.1.383](https://www.rstudio.com/products/rstudio/download/) or above is used.\n\n1. R Gui on Windows\n\n   Make sure the corresponding R program is opened when you are sending the text.\n\n1. Cmder/ Conemu on Windows\n\n   You might need to set the path to `ConEmuC.exe` in SendCode settings. For Cmder, the file is located at\n   `\u003cpath to cmder folder\u003e\\\\vendor\\\\conemu-maximus5\\\\ConEmu\\\\ConEmuC.exe`.\n\n1. Safari-Jupyter on macOS\n\n   Most likely you haven't enabled JavaScript for AppleScript. Check the option \"Allow JavaScript from Apple Events\" in the `Develop` menu (the `Develope` menu needs to be enabled in the preferences).\n\n\n### Custom Keybindings\n\nIt is fairly easy to create your own keybinds for commands which you frequently use. For example, the following keybinds execute changing working directory commands for R, Python and Julia.\n\n```json\n[\n    {\n        \"keys\": [\"ctrl+shift+h\"], \"command\": \"send_code\",\n        \"args\": {\"cmd\": \"setwd(\\\"$file_path\\\")\"},\n        \"context\": [\n            { \"key\": \"selector\", \"operator\": \"equal\", \"operand\": \"source.r\" }\n        ]\n    },\n    {\n        \"keys\": [\"ctrl+shift+h\"], \"command\": \"send_code\",\n        \"args\": {\"cmd\": \"%cd \\\"$file_path\\\"\"},\n        \"context\": [\n            { \"key\": \"selector\", \"operator\": \"equal\", \"operand\": \"source.python\" }\n        ]\n    },\n    {\n        \"keys\": [\"ctrl+shift+h\"], \"command\": \"send_code\",\n        \"args\": {\"cmd\": \"cd(\\\"$file_path\\\")\"},\n        \"context\": [\n            { \"key\": \"selector\", \"operator\": \"equal\", \"operand\": \"source.julia\" }\n        ]\n    }\n]\n```\n\nSendCode expands following variables in the `cmd` field:\n\n- `$file`, the full path to the file\n- `$file_path`, the directory contains the file\n- `$file_name`, the file name\n- `$file_base_name`, the file name without extension\n- `$file_extension`, the file extension\n- `$folder`, the first folder of current window\n- `$project_path`, the directory where sublime-project is stored\n- `$current_folder`, the folder of the window which contains the current view\n- `$selection`, the text selected, or the word under cursor\n- `$line`, the current line number\n\nIt also supports placeholders for variables, details can be found in the [unofficial documentation](http://docs.sublimetext.info/en/latest/reference/build_systems/configuration.html#placeholders-for-variables).\n\n```\n${file_path:$folder}\n```\nThis will emit the directory of current file if there is one, otherwise the first folder of the current window.\n\nYou also don't have to worry about escaping quotes and backslashes between quotes, SendCode will\nhandle them for you.\n\nThe `prog` argument determines which program to use\n\n```json\n[\n    {\n        \"keys\": [\"ctrl+shift+enter\"], \"command\": \"send_code\",\n        \"args\": {\"cmd\": \"\\n\", \"prog\": \"tmux\"}\n    }\n]\n```\n\n### User settings\n\nA couple of settings can be found `Preferences: SendCode Settings`.\nProject-wise settings could also be specified in `sublime-project` as\n\n```js\n{\n    \"settings\": {\n        \"SendCode\": {\n            \"prog\": \"terminus\",\n            \"r\" : {\n                \"bracketed_paste_mode\": true\n            }\n        }\n    }\n}\n```\n\n\n### Block expansion\n\nSendCode uses the following logics to expand cursor when sending code.\n\n- Expand current line to match `()`, `[]` and `{}`.\n- R: \n  - backward expand if the previous line ends with a pipe opeartor `%\u003e%`\n  - `# %%` decorators\n  - `#+` spin decorators\n  - `#'` roxygen decorators\n- Julia\n  - `begin`, `end` indented pairs.\n  - `# %%` decorators\n- Python: \n  - indentations\n  - `# %%` decorators.\n- (See the settings `block_start_pattern` and `block_end_pattern`)\n- Markdown fenced code blocks \n  - put the cursor at the line of \u003ckbd\u003e\\`\\`\\`\u003c/kbd\u003e to send the whole block.\n","funding_links":["https://www.paypal.me/randy3k/5usd"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandy3k%2Fsendcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frandy3k%2Fsendcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandy3k%2Fsendcode/lists"}