{"id":15014795,"url":"https://github.com/mtikekar/nvim-send-to-term","last_synced_at":"2025-04-09T19:23:19.060Z","repository":{"id":51103410,"uuid":"119834489","full_name":"mtikekar/nvim-send-to-term","owner":"mtikekar","description":"Neovim plugin for REPL integration","archived":false,"fork":false,"pushed_at":"2024-04-16T08:36:15.000Z","size":28,"stargazers_count":53,"open_issues_count":5,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-23T21:22:17.394Z","etag":null,"topics":["ipython","jupyter","neovim-plugin","repl"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mtikekar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-02-01T12:44:00.000Z","updated_at":"2024-10-20T09:06:40.000Z","dependencies_parsed_at":"2024-09-28T18:50:30.826Z","dependency_job_id":null,"html_url":"https://github.com/mtikekar/nvim-send-to-term","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtikekar%2Fnvim-send-to-term","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtikekar%2Fnvim-send-to-term/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtikekar%2Fnvim-send-to-term/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtikekar%2Fnvim-send-to-term/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mtikekar","download_url":"https://codeload.github.com/mtikekar/nvim-send-to-term/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248095909,"owners_count":21046941,"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":["ipython","jupyter","neovim-plugin","repl"],"created_at":"2024-09-24T19:46:06.101Z","updated_at":"2025-04-09T19:23:19.040Z","avatar_url":"https://github.com/mtikekar.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Neovim plugin to send text from a buffer to a terminal\n\nThis plugin aims to be simpler in design and easier to use than other similar plugins like\n[neoterm](https://github.com/kassio/neoterm),\n[vimcmdline](https://github.com/jalvesaq/vimcmdline),\n[vim-slime](https://github.com/jpalardy/vim-slime),\n[repl.nvim](https://gitlab.com/HiPhish/repl.nvim) and\n[iron.nvim](https://github.com/BurningEther/iron.nvim). It does not care for filetype-to-REPL\nmappings and starting your REPL. Instead, you go to an existing terminal that is running your REPL\nand type `:SendHere`.\n\nAfter that you can use the `s` operator from any buffer to send text to the terminal. The\nbehaviour of the `s` operator closely matches vim's built-in `y` or `d` operators. It works\nline-wise (`ss`, `3ss`), with visual selection (`vjs`, `Vjjs`) and with motions/text-objects\n(`sj`, `sip`).\n\n## Multiline quirks\n\nFor multiline text, some REPLs (e.g. IPython) only receive the first line. For them, try\n`:SendHere ipy` in the terminal. You can add support for the REPLs' multiline quirks in your\ninit.vim with:\n\n```vim\nlet g:send_multiline = {\n\\    'repl1': {'begin':..., 'end':..., 'newline':...},\n\\    'repl2': {'begin':..., 'end':..., 'newline':...},\n\\    ...\n\\}\n```\n\nThen use them as: `:SendHere repl1`. If the REPL supports\n[bracketed paste](https://cirw.in/blog/bracketed-paste), usually, something like\n`{'begin':\"\\e[200~\", 'end':\"\\e[201~\\n\", 'newline':\"\\n\"}` should work.\n\n## Provided commands, functions, operators\n\n| Name                            | Description                                                  |\n| ------------------------------- | ------------------------------------------------------------ |\n| `:SendHere`                     | Set current terminal as send target with default multiline settings |\n| `:SendHere \u003crepl\u003e`              | Set current terminal as send target with multiline settings for `repl` |\n| `[count]ss`                     | Send `count` lines and move cursor to last line.             |\n| `\u003cvisual\u003es`                     | Send visual selection.                                       |\n| `s\u003cmotion\u003e`                     | Send motion or text object (like `y/d` for yank/delete).     |\n| `S`                             | Send from current column till end of line (like `D`)         |\n| `g:send_multiline`              | Add multiline settings for your favourite REPL here.         |\n| `g:send_disable_mapping`        | Disable `s`, `S`, `ss` mappings                              |\n| `\u003cPlug\u003eSend`, `\u003cPlug\u003eSendLine`  | Use these to define your own mappings as shown below         |\n\nThe default mappings are defined as follows. You can define your own mappings by following these.\n\n```viml\nnmap ss \u003cPlug\u003eSendLine\nnmap s \u003cPlug\u003eSend\nvmap s \u003cPlug\u003eSend\nnmap S s$\n```\n\n## Other plugins\n\nThis plugin works nicely with [vim-pythonsense](https://github.com/jeetsukumaran/vim-pythonsense).\nFor example, you can do `saf` and `sac` to send functions and classes from your code buffer to the\nPython REPL.\n\n## Extensions for other targets\n\nThis plugin is extensible: you can define other types of targets to send text to as follows:\n\n1. Define a vim function: `function SendToTarget(lines) ...`. `lines` is a list of strings that\n   hold the text to be sent.\n2. Save the function to the `send_target` variable: `let g:send_target = {'send': function('SendToTarget')}`\n3. Optional: add other fields to `g:send_target` that are relevant to your function.\n\n## Sending to Jupyter kernels\n\nUsing the extension feature described above, I have implemented a extension (included with the\nplugin) to send code directly to Jupyter kernels running in notebook, lab, qtconsole or console.\nYou have to install the Neovim [Python client](https://github.com/neovim/python-client) and\nJupyter client in Neovim's python host with:\n\n```bash\npip install pynvim jupyter_client\n# or, if you're using conda\nconda install -c conda-forge pynvim jupyter_client\n```\n\nThen, you start a kernel in any of the Jupyter applications and run `:SendTo \u003ckernel-pid.json\u003e`.\nThis is useful for sending code to QtConsole and using its rich display of images, inline plots,\netc. You need to enable QtConsole's display of remote commands in its config file (usually\n`~/.jupyter/jupyter_qtconsole_config.py`):\n\n```python\nc.ConsoleWidget.include_other_output = True\nc.ConsoleWidget.other_output_prefix = ''\n```\n\nFor Jupyter Console, add to `~/.jupyter/jupyter_console_config.py`:\n\n```python\nc.ZMQTerminalInteractiveShell.include_other_output = True\nc.ZMQTerminalInteractiveShell.other_output_prefix = ''\n```\n\nWithout these config settings, the kernels receive and execute the code, but do not display\nthe code or the results.\n\n### Autocomplete with Jupyter kernels\n\nWhen a connection to a Jupyter kernel is established, you can use the kernel's autocomplete\nfeature in the editor. At the bare minimum, you would do:\n\n```vim\n:SendTo \u003ckernel-pid.json\u003e\n:setlocal omnifunc=SendComplete\n```\n\nType Ctrl-x Ctrl-o to see the autocomplete suggestions. You can integrate it with other vim\nautocomplete plugins that work with user-defined completions or omnicompletion.\n\n### Provided commands, functions\n\n| Name        |  Documentation           |\n|-------------|--------------------------|\n| `:SendTo`, `:SendTo \u003ckernel-pid.json\u003e` | Send to existing Jupyter kernel. Run `%connect_info` in the Python session to get value of `kernel-pid.json`. By default, connect to latest started kernel. |\n| `SendComplete()`     | Completion function to be used as `omnifunc` or `completefunc` |\n| `SendCanComplete(line)`  | Completion is available for `line` |\n\n## To do\n\n1. Allow buffers/windows to have different target terminals.\n2. Add motions for IPython-style cell-blocks e.g. send all code between two comments.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtikekar%2Fnvim-send-to-term","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtikekar%2Fnvim-send-to-term","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtikekar%2Fnvim-send-to-term/lists"}