{"id":13412659,"url":"https://github.com/bfredl/nvim-ipy","last_synced_at":"2025-04-05T20:09:01.672Z","repository":{"id":18402845,"uuid":"21584401","full_name":"bfredl/nvim-ipy","owner":"bfredl","description":"IPython/Jupyter plugin for Neovim","archived":false,"fork":false,"pushed_at":"2022-10-30T16:06:39.000Z","size":110,"stargazers_count":425,"open_issues_count":33,"forks_count":29,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-04T14:04:09.341Z","etag":null,"topics":[],"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/bfredl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-07T19:50:22.000Z","updated_at":"2025-02-16T06:02:52.000Z","dependencies_parsed_at":"2023-01-11T19:51:21.421Z","dependency_job_id":null,"html_url":"https://github.com/bfredl/nvim-ipy","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/bfredl%2Fnvim-ipy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfredl%2Fnvim-ipy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfredl%2Fnvim-ipy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfredl%2Fnvim-ipy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bfredl","download_url":"https://codeload.github.com/bfredl/nvim-ipy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393572,"owners_count":20931813,"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":[],"created_at":"2024-07-30T20:01:27.430Z","updated_at":"2025-04-05T20:09:01.656Z","avatar_url":"https://github.com/bfredl.png","language":"Python","funding_links":[],"categories":["Code Runner","Python"],"sub_categories":["Quickfix"],"readme":"# nvim-ipy\nThis is a Jupyter front-end for Neovim, partially based on [ivanov/vim-ipython](https://github.com/ivanov/vim-ipython), but refactored for nvim's plugin architechture and improved async event handling. Jupyter 4.x or later is required. It uses python3 per default; see below for notes on using python2. It has full support for non-python kernels.\n\nIt doesn't have all features of `vim-ipython`, but it has better support for long-running commands that continously produce output, for instance this silly example:\n\n    from time import sleep\n    for i in range(10):\n        sleep(0.5)\n        print(i)\n\n## Connecting/starting kernel\n`:IPython \u003cargs\u003e` is interpreted just like the command line `jupyter console \u003cargs\u003e`, for instance:\n\nAction                  | command\n----------------------- | -------\nStart new python kernel |  `:IPython` \u003cbr\u003e `:IPython2` (for python2 kernel)\nConnect to existing kernel | `:IPython --existing`\nStart kernel in different language | `:IPython --kernel julia-0.6`\n\nThis plugin runs in the python3 host by default, but the kernel process don't need to be the same version of python as the plugin runs in. Kernelspec can be used to launch a python2 kernel, the same way as from the Jupyter console and notebook. Use `:IPython --kernel python2` or the `:IPython2` shortcut. You might need to execute\n\n    ipython2 kernelspec install-self --user\n\non beforehand for this to work.  I have tested that this plugin also supports IJulia and IHaskell, but ideally it should work with any Jupyter kernel.\n\nIf you only have the python2 host installed, you could do\n`cd rplugin; ln -s python3 python`\nto run this plugin in the python2 host instead.\n\n`:IPython` can be invoked multiple times in the same nvim session. The old kernel connection is then closed and forgotten.\n\n**New:** `--no-window` can be passed an argument to `:IPython` to hide the output window.\n\n## Keybindings\n\nWhen kernel is running, following bindings can be used:\n\nGeneric                   | default     | Action\n------------------------- | ----------  | ------\n`\u003cPlug\u003e(IPy-Run)`         | `\u003cF5\u003e`      | Excecute current line or visual selection\n`\u003cPlug\u003e(IPy-RunCell)`     |             | Excecute current cell (see below)\n`\u003cPlug\u003e(IPy-RunAll)`      |             | Excecute all lines in buffer\n`\u003cPlug\u003e(IPy-RunOp)`       |             | Operator: execute over a movement or text object\n`\u003cPlug\u003e(IPy-Complete)`    | `\u003cC-F\u003e`     | (insert mode) Kernel code completion\n`\u003cPlug\u003e(IPy-WordObjInfo)` | `\u003cleader\u003e?` | Inspect variable under the cursor\n`\u003cPlug\u003e(IPy-Interrupt)`   | `\u003cF8\u003e`      | Send interrupt to kernel\n`\u003cPlug\u003e(IPy-Terminate)`   |             | Terminate kernel\n\n### But... The default bindings suck!\nYes, they exist mainly to quickly test this plugin. Add\n\n    let g:nvim_ipy_perform_mappings = 0\n\nTo your nvimrc and map to the generic bindings. For instance:\n\n    map \u003csilent\u003e \u003cc-s\u003e \u003cPlug\u003e(IPy-Run)\n\n## Cells\nAs a convenience, the plugin includes a definition of code cells (running only for now, later I might make them text objects).\nThe cell is defined by setting `g:ipy_celldef` a list of two of rexexes that should match the beginning and end of a cell respecively. If a string is supplied, it will be used for both, and in addition the beginning and the end of the buffer will implicitly work as cells. The default is equivalent to:\n\n    let g:ipy_celldef = '^##'\n\nTo enable to define cells in a filetype, `b:ipy_celldef` will override the global value. As an example, add this to vimrc to support R notebooks (.rmd):\n\n    au FileType rmd let b:ipy_celldef = ['^```{r}$', '^```$']\n\nYou also need to map some key to `IPy-RunCell`:\n\n    map \u003csilent\u003e \u003cleader\u003ec \u003cPlug\u003e(IPy-RunCell)\n\n## Options\nNB: the option system will soon be rewritten to allow changing options while the plugin is running,\nbut for now you can set:\n\nOption                    | default     | Action\n------------------------- | ----------  | ------\n`g:ipy_set_ft`            | 0 (false)   | set filetype of output buffer to kernel language\n`g:ipy_highlight`         | 1 (true)    | add highlights for ANSI sequences in the output\n`g:ipy_truncate_input`    | 0           | when \u003e 0, don't echo inputs larger than this number of lines\n`g:ipy_shortprompt`       | 0 (false)   | use shorter prompts (TODO: let user set arbitrary format)\n`g:ipy_celldef`           | '^##'       | definition of a code cell, see above\n\nNote that the filetype syntax highlight could interact badly with the highlights sent from the kernel as ANSI sequences (in IPython tracebacks, for instance). Therefore both are not enabled by default. I might look into a better solution for this.\n\n## Exported vimscript functions\nMost useful is `IPyRun(\"string of code\"[, silent])` which can be called to programmatically execute any code. The optional `silent` will avoid printing code and result to the console if nonzero. This is useful to bind common commands to a key. This will close all figures in matplotlib:\n\n    nnoremap \u003cLeader\u003ec :call IPyRun('close(\"all\")',1)\u003ccr\u003e\n\n`IPyConnect(args...)` can likewise be used to connect with vimscript generated arguments.\n\n`IPyOmniFunc` can be used as `\u0026completefunc`/`\u0026omnifunc` for use with a completer framework. Note that unlike `\u003cPlug\u003e(IPy-Complete)` this is synchronous and waits for the kernel, so if the kernel hangs this will hang nvim! For use with async completion like Deoplete it would be better to create a dedicated source.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbfredl%2Fnvim-ipy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbfredl%2Fnvim-ipy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbfredl%2Fnvim-ipy/lists"}