{"id":13478293,"url":"https://github.com/jupyter-vim/jupyter-vim","last_synced_at":"2025-03-27T07:30:58.190Z","repository":{"id":35339041,"uuid":"194096026","full_name":"jupyter-vim/jupyter-vim","owner":"jupyter-vim","description":"Make Vim talk to Jupyter kernels","archived":false,"fork":false,"pushed_at":"2024-06-27T12:26:53.000Z","size":883,"stargazers_count":523,"open_issues_count":25,"forks_count":38,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-10-30T11:42:04.439Z","etag":null,"topics":["hacktoberfest","jupyter","python","vim-plugin"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jupyter-vim.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2019-06-27T13:00:19.000Z","updated_at":"2024-10-22T17:47:52.000Z","dependencies_parsed_at":"2024-10-30T11:41:35.117Z","dependency_job_id":null,"html_url":"https://github.com/jupyter-vim/jupyter-vim","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/jupyter-vim%2Fjupyter-vim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jupyter-vim%2Fjupyter-vim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jupyter-vim%2Fjupyter-vim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jupyter-vim%2Fjupyter-vim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jupyter-vim","download_url":"https://codeload.github.com/jupyter-vim/jupyter-vim/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245802314,"owners_count":20674633,"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":["hacktoberfest","jupyter","python","vim-plugin"],"created_at":"2024-07-31T16:01:55.131Z","updated_at":"2025-03-27T07:30:57.609Z","avatar_url":"https://github.com/jupyter-vim.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Jupyter-Vim\n\nA two-way integration between Vim and Jupyter. Develop code on a Jupyter notebook without leaving the terminal. Send lines from Vim to a jupyter qtconsole. Have a MATLAB-like \"cell-mode\".\n\nCurrently supports the following kernels: Bash, C++, C, Java, Javascript, Julia, Perl, Raku, Python, Raku, Ruby, Rust, and R. Find more information [here](https://github.com/jupyter-vim/jupyter-vim/wiki/Supported-kernel-languages)\n\n[![Video demo](demo.png)](https://www.youtube.com/watch?v=h59cbg4HqpY)\n\n## Installation of the plugin\n\nTo install this plugin, you should use one of the following methods.\n\nOn __Windows__, replace in the next sections the Unix directories with the following:\n\n* On __Vim__:\n    * `~/.vim` -\u003e `%USERPROFILE%\\vimfiles`\n    * `~/.vimrc` -\u003e `%USERPROFILE%\\_vimrc`\n\n* On __Nvim__:\n    * `~/.local/share/nvim/site` -\u003e `%USERPROFILE%\\AppData\\Local\\nvim`\n\nOr other directories if you have configured/installed Vim/Nvim differently.\n\n### Vim 8 package manager\n\n```bash\nmkdir -p ~/.vim/pack/git-plugins/start\ngit clone --depth 1 https://github.com/jupyter-vim/jupyter-vim.git ~/.vim/pack/git-plugins/start/jupyter-vim\n```\n\n### NeoVim\n\n```bash\nmkdir -p ~/.local/share/nvim/site/pack/git-plugins/start\ngit clone --depth 1 https://github.com/jupyter-vim/jupyter-vim.git ~/.local/share/nvim/site/pack/git-plugins/start/jupyter-vim\n```\n\n### Pathogen\n\n```bash\ncd ~/.vim/bundle\ngit clone https://github.com/jupyter-vim/jupyter-vim.git\n```\n\n### Vundle\n\n```vim\nPlugin 'jupyter-vim/jupyter-vim'\n```\n\n### Vim-Plug\n\n```vim\nPlug 'jupyter-vim/jupyter-vim'\n```\n\n## Vim+Python configuration\n\nIn order for this plugin to work, **you must have Jupyter installed** in the\nPython environment that vim's `pythonx` command uses. There are several possible strategies here.\n\n### Install jupyter into system python\nWhen Vim is using your system python (the default on linux), you can just install Jupyter using a package manager. For example, on Ubuntu 18.04 and later:\n```bash\n$ sudo apt install jupyter jupyter-core\n```\nAlternatively, you can use `pip`:\n```bash\n$ sudo pip install jupyter\n```\n\n### Dynamic mode\nWhen Vim is compiled with Python in dynamic mode (`+python3/dyn`), you can point to the Python interpreter you wish to use in your `.vimrc`:\n```vim\nif has('nvim')\n    let g:python3_host_prog = '/path/to/python/bin/python3'\nelse\n    set pyxversion=3\n\n    \" OSX\n    set pythonthreedll=/Library/Frameworks/Python.framework/Versions/3.6/Python\n\n    \" Windows\n    set pythonthreedll=python37.dll\n    set pythonthreehome=C:\\Python37\nendif\n```\nMake sure to point it to a Python installation that has Jupyter installed.\n\n### Virtual environments\n\nIf either:\n\n* you use a Python environment manager such as `virtualenv`, and thus need\n  Jupyter to be present no matter which environment is loaded from the shell\n  you open vim from, or\n* you only use one Python environment but you don't want to install Jupyter\n  system-wide for whatever reason,\n\nthen the easiest way to meet the Jupyter requirement is to configure vim to\nload a designated virtualenv at startup. This is just to allow vim to call the\nJupyter client; you can run your Jupyter server in whatever Python environment\nyou want. From Vim, run:\n```vim\n:pythonx import sys; print(sys.version)\n```\n\nThis will tell you whether `pythonx` is using Python 2 or Python 3.  (Or, see\n`:help python_x` if you'd like to tweak your `pythonx` settings.)  Create a\nvirtualenv with that python version, for example\n```bash\n$ virtualenv -p /usr/bin/python2.7 /path/to/my/new/vim_virtualenv\n```\n\nor\n```bash\n$ virtualenv -p /usr/bin/python3 /path/to/my/new/vim_virtualenv\n```\n\nand then install Jupyter in that environment:\n```bash\n$ source /path/to/my/new/vim_virtualenv/bin/activate\n$ pip install jupyter\n```\n\nFinally, tell vim to load this virtualenv at startup by adding these lines to\nyour vimrc:\n```vim\n\" Always use the same virtualenv for vim, regardless of what Python\n\" environment is loaded in the shell from which vim is launched\nlet g:vim_virtualenv_path = '/path/to/my/new/vim_virtualenv'\nif exists('g:vim_virtualenv_path')\n    pythonx import os; import vim\n    pythonx activate_this = os.path.join(vim.eval('g:vim_virtualenv_path'), 'bin/activate_this.py')\n    pythonx with open(activate_this) as f: exec(f.read(), {'__file__': activate_this})\nendif\n```\n\n## Jupyter configuration\nFirst, we need to configure the jupyter console and qtconsole clients to\ndisplay output from other clients.\n\nThe config files can be found in in `~/.jupyter`, if they don't exist yet you\ncan generate them with:\n```bash\n$ jupyter console --generate-config\n$ jupyter qtconsole --generate-config\n```\n\nNow you need to uncomment and change the following config options to `True`.\n\n- qtconsole \n\nEdit this following file: `~/.jupyter/jupyter_qtconsole_config.py`\n```python\nc.ConsoleWidget.include_other_output = True\n```\n\n- console\n\nEdit the following file: `~/.jupyter/jupyter_console_config.py`\n```python\nc.ZMQTerminalInteractiveShell.include_other_output = True\n```\n\n## Usage\n\nTo begin a session:\n```bash\n$ jupyter qtconsole \u0026  # open a jupyter console window\n$ vim \u003cyour_script\u003e.py\n```\n\nIn vim: `:JupyterConnect`\n\nThen, use `:JupyterRunFile`, or `:[range]JupyterSendRange` to execute lines of\ncode!\n\nCode will be sent and executed as expected in the graphical `jupyter qtconsole`.\nHowever, in the console version `jupyter console`, the result will only show after you press the `Enter` key.\n\nBy default, the following keybindings are defined:\n```vim\n\" Run current file\nnnoremap \u003cbuffer\u003e \u003csilent\u003e \u003clocalleader\u003eR :JupyterRunFile\u003cCR\u003e\nnnoremap \u003cbuffer\u003e \u003csilent\u003e \u003clocalleader\u003eI :PythonImportThisFile\u003cCR\u003e\n\n\" Change to directory of current file\nnnoremap \u003cbuffer\u003e \u003csilent\u003e \u003clocalleader\u003ed :JupyterCd %:p:h\u003cCR\u003e\n\n\" Send a selection of lines\nnnoremap \u003cbuffer\u003e \u003csilent\u003e \u003clocalleader\u003eX :JupyterSendCell\u003cCR\u003e\nnnoremap \u003cbuffer\u003e \u003csilent\u003e \u003clocalleader\u003eE :JupyterSendRange\u003cCR\u003e\nnmap     \u003cbuffer\u003e \u003csilent\u003e \u003clocalleader\u003ee \u003cPlug\u003eJupyterRunTextObj\nvmap     \u003cbuffer\u003e \u003csilent\u003e \u003clocalleader\u003ee \u003cPlug\u003eJupyterRunVisual\n\n\" Debugging maps\nnnoremap \u003cbuffer\u003e \u003csilent\u003e \u003clocalleader\u003eb :PythonSetBreak\u003cCR\u003e\n```\n\nSet `let g:jupyter_mapkeys = 0` in your `.vimrc` to prevent the default keybindings from being made.\n\n## Related plugin\n\n* [vim-repl](https://github.com/sillybun/vim-repl): Instead of connecting to, embed the REPL in vim\n* [vimpyter](https://github.com/szymonmaszke/vimpyter): Integration with jupyter, even the notebook\n* [vim-ipython-cell](https://github.com/hanschen/vim-ipython-cell): send cell to jupyter via slime, requires terminal multiplexing instead of zeromq to communicate (higer level)\n* [jupytext.vim](https://github.com/goerz/jupytext.vim): Convert notebook files to vim buffers\n\n\n## Info\n\nOnce we fell in love with Vim, we couldn't bear having to jump back and forth\nbetween the ipython/jupyter console and editor anymore. We modeled this simple\ninterface off of the ideas in\n[vim-ipython](https://github.com/ivanov/vim-ipython), but have pared down many\nof the features, like the replication of the Jupyter console in a vim buffer,\nto make the plugin much more 'lightweight'.\n\nStill a work in progress!\n\n## Troubleshooting\n\n* Make sure that you are running Vim 8 or higher with Python 3 support.\n* When on windows, you are probably running 64-bit Python. Make sure you also run a 64-bit version of Vim (the default install is 32-bit!).\n\n### Contributing\n\nPlease feel free to raise issues and pull requests on\n[the github repository](https://github.com/jupyter-vim/jupyter-vim).\n\n### Credits\n\nWe owe significant thanks to the original developer of this plugin:\n[Paul Ivanov](https://github.com/ivanov).\nIt is far easier to update something that already works well than to forge\na new path from scratch.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjupyter-vim%2Fjupyter-vim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjupyter-vim%2Fjupyter-vim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjupyter-vim%2Fjupyter-vim/lists"}