{"id":13448365,"url":"https://github.com/randy3k/Terminus","last_synced_at":"2025-03-22T09:31:18.474Z","repository":{"id":37664018,"uuid":"137313818","full_name":"randy3k/Terminus","owner":"randy3k","description":"Bring a real terminal to Sublime Text","archived":false,"fork":false,"pushed_at":"2024-08-20T17:23:26.000Z","size":925,"stargazers_count":1405,"open_issues_count":210,"forks_count":81,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-03-21T03:35:07.187Z","etag":null,"topics":["console","sublime-text","terminal"],"latest_commit_sha":null,"homepage":"https://packagecontrol.io/packages/Terminus","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":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-14T06:09:20.000Z","updated_at":"2025-03-17T13:28:47.000Z","dependencies_parsed_at":"2024-08-21T21:05:51.957Z","dependency_job_id":null,"html_url":"https://github.com/randy3k/Terminus","commit_stats":{"total_commits":554,"total_committers":26,"mean_commits":"21.307692307692307","dds":0.06137184115523464,"last_synced_commit":"38ac105024ba78efbc99653ede3eb68d00b1bfb4"},"previous_names":[],"tags_count":77,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randy3k%2FTerminus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randy3k%2FTerminus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randy3k%2FTerminus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randy3k%2FTerminus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/randy3k","download_url":"https://codeload.github.com/randy3k/Terminus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244937751,"owners_count":20535124,"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","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":["console","sublime-text","terminal"],"created_at":"2024-07-31T05:01:43.405Z","updated_at":"2025-03-22T09:31:17.534Z","avatar_url":"https://github.com/randy3k.png","language":"Python","readme":"# Bring a real terminal to Sublime Text\n\n[![Package Control Downloads](https://img.shields.io/packagecontrol/dm/Terminus)](https://packagecontrol.io/packages/Terminus)\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\n\nThe first cross platform terminal for Sublime Text.\n\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003cth\u003eUnix shell\u003c/th\u003e\n        \u003cth\u003eCmd.exe\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd width=\"50%\"\u003e\n            \u003ca href=\"https://user-images.githubusercontent.com/1690993/41784539-03534fdc-760e-11e8-845d-3d133a559df5.gif\"\u003e\n                \u003cimg src=\"https://user-images.githubusercontent.com/1690993/41784539-03534fdc-760e-11e8-845d-3d133a559df5.gif\" width=\"100%\"\u003e\n            \u003c/a\u003e\n        \u003c/td\u003e\n        \u003ctd width=\"50%\"\u003e\n            \u003ca href=\"https://user-images.githubusercontent.com/1690993/41786131-a625d870-7612-11e8-882d-f1574184faba.gif\"\u003e\n                \u003cimg src=\"https://user-images.githubusercontent.com/1690993/41786131-a625d870-7612-11e8-882d-f1574184faba.gif\" width=\"100%\"\u003e\n            \u003c/a\u003e\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003cth\u003eTerminal in panel\u003c/th\u003e\n        \u003cth\u003eSupport \u003ca href=\"https://www.iterm2.com/documentation-images.html\"\u003eshowing images\u003c/a\u003e\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd width=\"50%\"\u003e\n            \u003ca href=\"https://user-images.githubusercontent.com/1690993/41784748-a7ed9d90-760e-11e8-8979-dd341933f1bb.gif\"\u003e\n                \u003cimg src=\"https://user-images.githubusercontent.com/1690993/41784748-a7ed9d90-760e-11e8-8979-dd341933f1bb.gif\" width=\"100%\"\u003e\n            \u003c/a\u003e\n        \u003c/td\u003e\n        \u003ctd width=\"50%\"\u003e\n            \u003cimg src=\"https://user-images.githubusercontent.com/1690993/51725223-1dfa3780-202f-11e9-9600-6e24b78d562d.png\" width=\"100%\"\u003e\n        \u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\nThis package is heavily inspired by [TerminalView](https://github.com/Wramberg/TerminalView). Compare with TerminalView, this has\n\n- Windows support\n- continuous history\n- easily customizable themes (see Terminus Utilities)\n- unicode support\n- 256 colors support\n- better xterm support\n- terminal panel\n- [imgcat](https://www.iterm2.com/documentation-images.html) support (PS: it also works on Linux / WSL)\n\n## Installation\n\nPackage Control.\n\n### Getting started\n\n- run `Terminus: Open Default Shell in Tab`\n\n- [OdatNurd](https://github.com/OdatNurd) has made several videos on Terminus. See, for examples,\n    - https://www.youtube.com/watch?v=etIJMVIvVgg (most up to date)\n    - https://www.youtube.com/watch?v=mV0ghkMwTQc\n\n\n## Shell configurations\n\nTerminus comes with several shell configurations. The settings file should be quite self explanatory. \n\n\n## User Key Bindings\n\nYou may find these key bindings useful. To edit, run `Preferences: Terminus Key Bindings`.\nCheck the details for the arguments of `terminus_open` below.\n\n\n- toggle terminal panel\n```json\n[\n    { \n        \"keys\": [\"alt+`\"], \"command\": \"toggle_terminus_panel\"\n    }\n]\n```\n\n- open a terminal view at current file directory\n```json\n[\n    { \n        \"keys\": [\"ctrl+alt+t\"], \"command\": \"terminus_open\", \"args\": {\n            \"cwd\": \"${file_path:${folder}}\"\n        }\n    }\n]\n```\nor by passing a custom `cmd`, say `ipython`\n```json\n[\n    { \n        \"keys\": [\"ctrl+alt+t\"], \"command\": \"terminus_open\", \"args\": {\n            \"cmd\": \"ipython\",\n            \"cwd\": \"${file_path:${folder}}\"\n        }\n    }\n]\n```\n\n- open terminal in a split view by using [Origami](https://github.com/SublimeText/Origami)'s `carry_file_to_pane`\n```json\n[\n    {\n        \"keys\": [\"ctrl+alt+t\"],\n        \"command\": \"terminus_open\",\n        \"args\": {\n            \"post_window_hooks\": [\n                [\"carry_file_to_pane\", {\"direction\": \"down\"}]\n            ]\n        }\n    }\n]\n```\n\n- \u003ckbd\u003ectrl-w\u003c/kbd\u003e to close terminal\n\nFollowing keybinding can be considered if one wants to use `ctrl+w` to close terminals.\n\n```json\n{ \n    \"keys\": [\"ctrl+w\"], \"command\": \"terminus_close\", \"context\": [{ \"key\": \"terminus_view\"}]\n}\n```\n\n## User Commands in Palette\n\n- run `Preferences: Terminus Command Palette`. Check the details for the arguments of `terminus_open` below\n\n```json\n[\n    {\n        \"caption\": \"Terminus: Open Default Shell at Current Location\",\n        \"command\": \"terminus_open\",\n        \"args\"   : {\n            \"cwd\": \"${file_path:${folder}}\"\n        }\n    }\n]\n```\nor by passing custom `cmd`, say `ipython`\n\n```json\n[\n    {\n        \"caption\": \"Terminus: Open iPython\",\n        \"command\": \"terminus_open\",\n        \"args\"   : {\n            \"cmd\": \"ipython\",\n            \"cwd\": \"${file_path:${folder}}\",\n            \"title\": \"iPython\"\n        }\n    }\n]\n```\n\n- open terminal in a split tab by using [Origami](https://github.com/SublimeText/Origami)'s `carry_file_to_pane`\n\n```json\n[\n    {\n        \"caption\": \"Terminus: Open Default Shell in Split Tab\",\n        \"command\": \"terminus_open\",\n        \"args\": {\n            \"post_window_hooks\": [\n                [\"carry_file_to_pane\", {\"direction\": \"down\"}]\n            ]\n        }\n    }\n]\n```\n\n## Terminus Build System\n\nIt is possible to use `Terminus` as a build system. The target `terminus_exec` is a drop in replacement of the default target `exec`. It takes exact same arguments as `terminus_open` except that their default values are set differently.\n\n`terminus_cancel_build` is used to cancel the build when user runs `cancel_build` triggered by \u003ckbd\u003ectrl+c\u003c/kbd\u003e (macOS) or \u003ckbd\u003ectrl+break\u003c/kbd\u003e (Windows / Linux).\n\nThe following is an example of build system define in project settings that run a python script\n\n```json\n{\n    \"build_systems\":\n    [\n        {\n            \"name\": \"Hello World\",\n            \"target\": \"terminus_exec\",\n            \"cancel\": \"terminus_cancel_build\",\n            \"cmd\": [\n                \"python\", \"helloworld.py\"\n            ],\n            \"working_dir\": \"$folder\"\n        }\n    ]\n}\n```\n\nThe same Hello World example could be specified via a `.sublime-build` file.\n\n```json\n{\n    \"target\": \"terminus_exec\",\n    \"cancel\": \"terminus_cancel_build\",\n    \"cmd\": [\n        \"python\", \"helloworld.py\"\n    ],\n    \"working_dir\": \"$folder\"\n}\n```\n\nInstead of `cmd`, user could also specify `shell_cmd`. In macOS and linux, a bash shell will be invoked; and in Windows, cmd.exe will be invoked.\n\n```json\n{\n    \"target\": \"terminus_exec\",\n    \"cancel\": \"terminus_cancel_build\",\n    \"shell_cmd\": \"python helloworld.py\",\n    // to directly invoke bash command\n    // \"shell_cmd\": \"echo helloworld\",\n    \"working_dir\": \"$folder\"\n}\n```\n\n## Alt-Left/Right to move between words (Unix)\n\n- Bash: add the following in `.bash_profile` or `.bashrc`\n\n    ```sh\n    if [ \"$TERM_PROGRAM\" == \"Terminus-Sublime\" ]; then\n        bind '\"\\e[1;3C\": forward-word'\n        bind '\"\\e[1;3D\": backward-word'\n    fi\n    ```\n\n- Zsh: add the following in `.zshrc`\n\n    ```sh\n    if [ \"$TERM_PROGRAM\" = \"Terminus-Sublime\" ]; then\n        bindkey \"\\e[1;3C\" forward-word\n        bindkey \"\\e[1;3D\" backward-word\n    fi\n    ```\n\nSome programs, such as julia, do not recognize the standard keycodes for `alt+left` and `alt+right`. You could\nbind them to `alt+b` and `alt+f` respectively\n```json\n[\n    { \"keys\": [\"alt+left\"], \"command\": \"terminus_keypress\", \"args\": {\"key\": \"b\", \"alt\": true}, \"context\": [{\"key\": \"terminus_view\"}] },\n    { \"keys\": [\"alt+right\"], \"command\": \"terminus_keypress\", \"args\": {\"key\": \"f\", \"alt\": true}, \"context\": [{\"key\": \"terminus_view\"}] }\n]\n```\n\n## Terminus API\n\n- A terminal could be opened using the command `terminus_open` with\n\n```py\nwindow.run_command(\n    \"terminus_open\", {\n        \"config_name\": None,     # the shell config name, use `None` for the default config\n        \"cmd\": None,             # the cmd to execute\n        \"shell_cmd\": None,       # a script to execute in a shell\n                                 # bash on Unix and cmd.exe on Windows\n        \"cwd\": None,             # the working directory\n        \"working_dir\": None,     # alias of \"cwd\"\n        \"env\": {},               # extra environmental variables\n        \"title\": None,           # title of the view, let terminal configures it if leave empty\n        \"panel_name\": None,      # the name of the panel if terminal should be opened in panel\n        \"focus\": True,           # focus to the panel\n        \"tag\": None,             # a tag to identify the terminal\n        \"file_regex\": None,      # the `file_regex` pattern in sublime build system\n                                 # see https://www.sublimetext.com/docs/3/build_systems.html\n        \"line_regex\": None,      # the `file_regex` pattern in sublime build system\n        \"pre_window_hooks\": [],  # a list of window hooks before opening terminal\n        \"post_window_hooks\": [], # a list of window hooks after opening terminal\n        \"post_view_hooks\": [],   # a list of view hooks after opening terminal\n        \"view_settings\": {},     # extra view settings which are passed to the terminus_view\n        \"auto_close\": False,     # auto close terminal, possible values are \"always\" (True), \"on_success\", and False.\n        \"cancellable\": False,    # allow `cancel_build` command to terminate process, only relevent to panels\n        \"timeit\": False,         # display elapsed time when the process terminates\n    }\n)\n```\n\nThe fields `cmd` and `cwd` understand Sublime Text build system [variables](https://www.sublimetext.com/docs/3/build_systems.html#variables).\n\n\n- the setting `view.settings().get(\"terminus_view.tag\")` can be used to identify the terminal and \n\n- keybind can be binded with specific tagged terminal\n\n```json\n    {\n        \"keys\": [\"ctrl+alt+w\"], \"command\": \"terminus_close\", \"context\": [\n            { \"key\": \"terminus_view.tag\", \"operator\": \"equal\", \"operand\": \"YOUR_TAG\" }\n        ]\n    }\n```\n\n- text can be sent to the terminal with\n\n```py\nwindow.run_command(\n    \"terminus_send_string\", \n    {\n        \"string\": \"ls\\n\",\n        \"tag\": \"\u003cYOUR_TAG\u003e\",       # ignore this or set it to None to send text to the first terminal found\n        \"visible_only\": False,     # send to visible terminal only, default is `False`. Only relevent when `tag` is None\n    }\n)\n```\n\nIf `tag` is not provided or is `None`, the text will be sent to the first terminal found in the current window.\n\n\n## FAQ\n\n### Memory issue\n\nIt is known that Terminus sometimes consumes a lot of memory after extensive use. It is because Sublime Text keeps an infinite undo stack. There is virtually no fix unless upstream provides an API to work with the undo stack. Meanwhile, users could execute `Terminus: Reset` to release the memory.\n\nThis issue has been fixed in Sublime Text \u003e= 4114 and Terminus v0.3.20.\n\n### Color issue when maximizing and minimizing terminal\n\nIt is known that the color of the scrollback history will be lost when a terminal is maximized or minimized from or to the panel. There is no fix for this issue.\n\n\n### Terminal panel background issue\n\nIf you are using DA UI and your terminal panel has weird background color,\ntry playing with the setting `panel_background_color` or `panel_text_output_background_color` in `DA UI: Theme\nSettings`.\n\n\u003cimg src=\"https://user-images.githubusercontent.com/1690993/41728204-31a9a2a2-7544-11e8-9fb6-a37b59da852a.png\" width=\"50%\" /\u003e\n\n```json\n{\n    \"panel_background_color\": \"$background_color\"\n}\n```\nOr, to keep the Find and Replace panels unchanged:\n```json\n\"panel_text_output_background_color\": \"$background_color\"\n```\n\n\n### Cmd.exe rendering issue in panel\n\nDue to a upstream bug (may winpty or cmd.exe?), there may be arbitrary empty lines inserted between prompts if the panel is too short. It seems that cmder and powershell are not affected by this bug.\n\n\n### Acknowledgments\n\nThis package won't be possible without [pyte](https://github.com/selectel/pyte), [pywinpty](https://github.com/spyder-ide/pywinpty) and [ptyprocess](https://github.com/pexpect/ptyprocess).\n","funding_links":["https://www.paypal.me/randy3k/5usd"],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandy3k%2FTerminus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frandy3k%2FTerminus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandy3k%2FTerminus/lists"}