{"id":13898708,"url":"https://github.com/williamjameshandley/vimteractive","last_synced_at":"2025-07-30T11:34:24.500Z","repository":{"id":55443321,"uuid":"134892779","full_name":"williamjameshandley/vimteractive","owner":"williamjameshandley","description":"Send commands from text to interactive programs","archived":false,"fork":false,"pushed_at":"2025-03-03T13:54:58.000Z","size":381,"stargazers_count":49,"open_issues_count":1,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-08T08:21:21.373Z","etag":null,"topics":["bash","clojure","ide","ipython","maple","plugin","python","terminal","vim","zsh"],"latest_commit_sha":null,"homepage":null,"language":"Vim Script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/williamjameshandley.png","metadata":{"files":{"readme":"README.rst","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-25T18:44:44.000Z","updated_at":"2025-01-19T22:34:53.000Z","dependencies_parsed_at":"2024-08-03T19:28:21.792Z","dependency_job_id":"9627c75d-c7e5-4edf-ad0a-79c01b958554","html_url":"https://github.com/williamjameshandley/vimteractive","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/williamjameshandley/vimteractive","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamjameshandley%2Fvimteractive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamjameshandley%2Fvimteractive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamjameshandley%2Fvimteractive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamjameshandley%2Fvimteractive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/williamjameshandley","download_url":"https://codeload.github.com/williamjameshandley/vimteractive/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/williamjameshandley%2Fvimteractive/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267858704,"owners_count":24155941,"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-07-30T02:00:09.044Z","response_time":70,"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":["bash","clojure","ide","ipython","maple","plugin","python","terminal","vim","zsh"],"created_at":"2024-08-06T18:04:24.929Z","updated_at":"2025-07-30T11:34:24.451Z","avatar_url":"https://github.com/williamjameshandley.png","language":"Vim Script","readme":"============\nVimteractive\n============\n:vimteractive: send commands from text files to interactive programs via vim\n:Author: Will Handley\n:Version: 2.7.1\n:Homepage: https://github.com/williamjameshandley/vimteractive\n:Documentation: ``:help vimteractive``\n\nVimteractive was inspired by the workflow of the\n`vim-ipython \u003chttps://github.com/ivanov/vim-ipython\u003e`__ plugin.\n\nThis plugin is designed to extend a subset of the functionality of vim-ipython\nto other `REPLs \u003chttps://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop\u003e`__ (including ipython). It is based around the unix\nphilosophy of `\"do one thing and do it well\" \u003chttps://en.wikipedia.org/wiki/Unix_philosophy#Do_One_Thing_and_Do_It_Well\u003e`__.\nVimteractive aims to provide a robust and simple link between text files and\nlanguage shells. Vimteractive will never aim to do things like\nautocompletion, leaving that to other, more developed tools such as\n`YouCompleteMe \u003chttps://github.com/Valloric/YouCompleteMe\u003e`__ or\n`Copilot \u003chttps://github.com/features/copilot\u003e`__.\n\nThe activating commands are:\n\n- `ipython \u003chttps://ipython.readthedocs.io\u003e`__ ``:Iipython``\n- `julia \u003chttps://julialang.org/\u003e`__ ``:Ijulia``\n- `maple \u003chttps://maplesoft.com/\u003e`__ ``:Imaple``\n- `mathematica \u003chttps://www.wolfram.com/mathematica/\u003e`__ ``:Imathematica``\n- `bash \u003chttps://en.wikipedia.org/wiki/Bash_(Unix_shell)\u003e`__ ``:Ibash``\n- `zsh \u003chttps://www.zsh.org/\u003e`__ ``:Izsh``\n- `python \u003chttps://www.python.org/\u003e`__ ``:Ipython``\n- `clojure \u003chttps://clojure.org/\u003e`__ ``:Iclojure``\n- `apl \u003chttps://en.wikipedia.org/wiki/APL_(programming_language)\u003e`__ ``:Iapl``\n- `R \u003chttps://www.r-project.org/\u003e`__ ``:IR``\n- `sgpt \u003chttps://github.com/TheR1D/shell_gpt\u003e`__ ``:Isgpt``\n- `gpt-command-line \u003chttps://github.com/kharvd/gpt-cli\u003e`__ ``:Igpt``\n- autodetect based on filetype ``:Iterm``\n\nCommands may be sent from a text file to the chosen REPL using ``CTRL-S``.\nIf there is no REPL, ``CTRL-S`` will automatically open one for you using\n``:Iterm``.\n\nFor some terminals, the output of the last command may be retrieved with\n``CTRL-Y``.\n\nNote: it's highly recommended to use IPython as your default Python\ninterpreter. You can set it like this:\n\n.. code:: vim\n\n\tlet g:vimteractive_default_shells = { 'python': 'ipython' }\n\nInstallation\n------------\n\nSince this package leverages the native vim interactive terminal, vimteractive\nis only compatible with vim 8 or greater.\n\nInstallation should be relatively painless via\n`the usual routes \u003chttps://vimawesome.com/plugin/vimteractive\u003e`_ such as\n`Vundle \u003chttps://github.com/VundleVim/Vundle.vim\u003e`__,\n`Pathogen \u003chttps://github.com/tpope/vim-pathogen\u003e`__ or the vim 8 native\npackage manager (``:help packages``).\nIf you're masochistic enough to use\n`Arch \u003chttps://wiki.archlinux.org/index.php/Arch_Linux\u003e`__/`Manjaro \u003chttps://manjaro.org/\u003e`__,\nyou can install vimteractive via the\n`aur \u003chttps://aur.archlinux.org/packages/vim-vimteractive\u003e`__.\nFor old-school users, there is also a package on the `vim\nrepo \u003chttps://www.vim.org/scripts/script.php?script_id=5687\u003e`__.\nDepending on your package manager, you may need to run ``:helptags \u003cpath/to/repo/docs\u003e`` to install the help documentation.\n\nMotivation\n----------\n\n`IPython and Jupyter \u003chttps://ipython.org/\u003e`__ are excellent tools for\nexploratory analyses in python. They leverage the interactivity of the python\nkernel to allow you to keep results of calculations in memory whilst developing\nfurther code to process them.\n\nHowever, I can't stand typing into anything other than vim. Anywhere else, my\nscreen fills with hjklEB, or worse, I close the window with a careless\n``\u003cC-w\u003e``. I want a technique that allows me to operate on plain text files,\nbut still be able to work interactively with the interpreter with minimal\neffort.\n\n`Many Projects \u003c#similar-projects\u003e`__ achieve this with a varying level of\nfunctionality. Vimteractive aims to create the simplest tool for sending things\nfrom text to interpreter, and making it easy to add additional interpreters. In\nparticular, my main aim in starting this was to get a vim-ipython like\ninterface to the command line `maple \u003chttps://www.maplesoft.com/\u003e`__.\n\nUsage\n-----\n\nTo use the key-bindings, you should first disable the ``CTRL-S``\ndefault, which is a terminal command to freeze the output. You can\ndisable this by putting\n\n.. code:: bash\n\n   stty -ixon\n\ninto your ``.bashrc`` (or equivalent shell profile file).\n\n\nExample usage:\n~~~~~~~~~~~~~~\n\n|example_usage|\n\nCreate a python file ``test.py`` with the following content:\n\n.. code:: python\n\n   import matplotlib.pyplot as plt\n   import numpy\n\n   fig, ax = plt.subplots()\n   x = numpy.linspace(-2,2,1000)\n   y = x**3-x\n   ax.plot(x, y)\n   ax.set_xlabel('$x$')\n   ax.set_ylabel('$y$')\n\nNow start an ipython interpreter in vim with ``:Iipython``. You should see a\npreview window open above with your ipython prompt. Position your cursor over\nthe first line of ``test.py``, and press ``CTRL-S``. You should see this line\nnow appear in the first prompt of the preview window. Do the same with the\nsecond and fourth lines. At the fourth line, you should see a figure appear\nonce it's constructed with ``plt.subplots()``. Continue by sending lines to the\ninterpreter. You can send multiple lines by doing a visual selection and\npressing ``CTRL-S``.\n\nIf you switch windows with ``CTRL-W+k``, you will see the terminal buffer\nswitch to a more usual looking normal-mode buffer, from which you can perform\ntraditional normal mode commands. However, if you try to insert, you will enter\nthe REPL, and be able to enter commands interactively into the prompt as if\nyou had run it in the command line.  You can save this buffer if you wish to a\nnew file if it contains valuable output\n\nYou may want to send lines to one REPL from two buffers. To achieve that,\nrun ``:Iconn \u003cbuffer_name\u003e`` where ``\u003cbuffer_name\u003e`` is a name of buffer\ncontaining REPL. If there is only one REPL, you can use just\n``:Iconn``.\n\nSupported REPLs\n~~~~~~~~~~~~~~~\n\n-  ``:Iipython`` Activate an ipython REPL\n-  ``:Ijulia`` Activate a julia REPL\n-  ``:Imaple`` Activate a maple REPL\n-  ``:Imathematica`` Activate a mathematica REPL\n-  ``:Ibash`` Activate a bash REPL\n-  ``:Izsh`` Activate a zsh REPL\n-  ``:Ipython`` Activate a python REPL\n-  ``:Iclojure`` Activate a clojure REPL\n-  ``:Iapl`` Activate an apl REPL\n-  ``:IR`` Activate an R REPL\n-  ``:Isgpt`` Activate an sgpt REPL\n-  ``:Igpt`` Activate an gpt-command-line REPL\n-  ``:Iterm`` Activate default REPL for this filetype\n\nSending commands\n~~~~~~~~~~~~~~~~\n\n``CTRL-S`` sends lines of text to the interpreter in a mode-dependent manner:\n\nIn Normal mode, ``CTRL-S`` sends the line currently occupied by the cursor to the\nREPL.\n\nIn Insert mode, ``CTRL-S`` sends the line currently being edited, and then\nreturns to insert mode at the same location.\n\nIn Visual mode, ``CTRL-S`` sends the current selection to the REPL.\n\n``ALT-S`` sends all lines from the start to the current line.\n\nRetrieving command outputs\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nCTRL-Y retrieves the output of the last command sent to the REPL. This only\nimplemented in a subset of terminas (``:Iipython``, ``:Isgpt`` and ``:Igpt``)\n\nIn ``Normal-mode``, CTRL-Y retrieves the output of the last command sent to the\nREPL and places it in the current buffer.\n\nIn ``Insert-mode``, CTRL-Y retrieves the output of the last command sent to the\nREPL and places it in the current buffer, and then returns to insert mode\nafter the output.\n\nConnecting to an existing REPL\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n``:Iconn [{buffer]`` connects current buffer to REPL in ``{buffer}``. You can\nconnect any number of buffers to one REPL. ``{buffer}`` can be omitted if there\nis only one REPL.\n\n``]v`` and ``[v`` can be used to cycle between connected buffers in the style of \n`unimpaired \u003chttps://github.com/tpope/vim-unimpaired\u003e`__.\n\nCommon issues\n-------------\n\nBracketed paste\n~~~~~~~~~~~~~~~\n\nIf you see strange symbols like ``^[[200~`` when sending lines to your new\ninterpreter, you may be on an older system which does not have bracketed paste\nenabled, or have other shell misbehaviour issues. You can change the default\nsetting with\n\n.. code:: vim\n\n\tlet g:vimteractive_bracketed_paste_default = 0\n\n\nOptions\n-------\nThese options can be put in your ``.vimrc``, or run manually as desired:\n\n.. code:: vim\n\n    let g:vimteractive_vertical = 1        \" Vertically split REPLs\n    let g:vimteractive_autostart = 0       \" Don't start REPLs by default\n\nExtending functionality\n-----------------------\n\nThis project is very much in an beta phase, so if you have any issues\nthat arise on your system, feel free to `leave an issue \u003chttps://github.com/williamjameshandley/vimteractive/issues/new\u003e`__ or create a `fork and pull\nrequest \u003chttps://gist.github.com/Chaser324/ce0505fbed06b947d962\u003e`__ with\nyour proposed changes\n\nYou can easily add your interpreter to Vimteractive, using the following code\nin your ``.vimrc``:\n\n.. code:: vim\n\n    \" Mapping from Vimterpreter command to shell command\n    \" This would give you :Iasyncpython command\n    let g:vimteractive_commands = {\n        \\ 'asyncpython': 'python3 -m asyncio'\n        \\ }\n\n    \" If you see strange symbols like ^[[200~ when sending lines\n    \" to your new interpreter, disable bracketed paste for it.\n    \" You can also try it when your shell is misbehaving some way.\n    \" It's needed for any standard Python REPL including\n    \" python3 -m asyncio\n    let g:vimteractive_bracketed_paste = {\n        \\ 'asyncpython': 0\n        \\ }\n\n    \" If you want to set interpreter as default (used by :Iterm),\n    \" map filetype to it. If not set, :Iterm will use interpreter\n    \" named same with filetype.\n    let g:vimteractive_default_shells = {\n        \\ 'python': 'asyncpython'\n        \\ }\n\n    \" If your interpreter startup time is big, you may want to\n    \" wait before sending commands. Set time in milliseconds in\n    \" this dict to do it. This is not needed for python3, but\n    \" can be useful for other REPLs like Clojure.\n    let g:vimteractive_slow_prompt = {\n        \\ 'asyncpython': 200\n        \\ }\n\n\nSimilar projects\n----------------\n\n-  `vim-ipython \u003chttps://github.com/ivanov/vim-ipython\u003e`__\n-  `vim-notebook \u003chttps://github.com/baruchel/vim-notebook\u003e`__\n-  `conque \u003chttps://code.google.com/archive/p/conque/\u003e`__\n-  `vim-slime \u003chttps://github.com/jpalardy/vim-slime\u003e`__\n-  `tslime_ipython \u003chttps://github.com/eldridgejm/tslime_ipython\u003e`__\n-  `vipy \u003chttps://github.com/johndgiese/vipy\u003e`__\n\n.. |example_usage| image:: https://raw.githubusercontent.com/williamjameshandley/vimteractive/master/images/example_usage.gif\n","funding_links":[],"categories":["Vim Script"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilliamjameshandley%2Fvimteractive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilliamjameshandley%2Fvimteractive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilliamjameshandley%2Fvimteractive/lists"}