/vimpyter

Edit your Jupyter notebooks in Vim/Neovim

Primary LanguageVim ScriptMIT LicenseMIT

THIS PROJECT IS NO LONGER MAINTAINED!

Please use one of the alternative approaches, for example [dccsilag/magma](dccsillag / magma-nvim).

Might also want to check out this article which highlights more up-to-date approaches with latest neovim features!

vimpyter

  • Input/output cells are displayed using custom syntax file and folding.
  • See your edits by starting Jupyter Notebook/Nteract application with single command/mapping (just remember to save your modifications). You may have to reload browser page/app to see the effects.
  • To see other features click here

Demo

gif

Jupyter preview & more

Installation

Vim8 or Neovim is required (asynchronous features)

Install required external dependency:

Install plugin using plugin manager like vim-plug or Vundle:

Plug 'szymonmaszke/vimpyter' "vim-plug
Plugin 'szymonmaszke/vimpyter' "Vundle

If you want to use different plugin manager/direct instalation please do refer to their respective repositories/documentation.

Configuration

Plugin provides some convenience commands:

  • VimpyterStartJupyter: asynchronously starts jupyter notebook instance from Vim/Neovim
  • VimpyterStartNteract: asynchronously starts nteract instance from Vim/Neovim
  • VimpyterInsertPythonBlock: inserts block of python code (see Demo)

Example mappings (put this in your .vimrc/init.vim):

autocmd Filetype ipynb nmap <silent><Leader>b :VimpyterInsertPythonBlock<CR>
autocmd Filetype ipynb nmap <silent><Leader>j :VimpyterStartJupyter<CR>
autocmd Filetype ipynb nmap <silent><Leader>n :VimpyterStartNteract<CR>

To see all available flags/commands refer to vim's documentation

Options

Following options are provided:

  • g:vimpyter_color: display command line output in colour (0 or 1)
  • g:vimpyter_jupyter_notebook_flags: string describing flags passed to Jupyter notebook
  • g:vimpyter_nteract_flags: string describing flags passed to nteract app
  • g:vimpyter_view_directory: directory where proxy files are created (default: $TMP)

For detailed description type in your editor :help vimpyter-options

Integrations with other plugins

Currently supported plugins:

You can request additional integrations or create them on your own (pull requests are welcomed).

Contributors wanted!

Things you could do to improve this software:

Integrations with other plugins:

  • davidhalter/jedi-vim: Things like go to definition and documentation, maybe autocompletion (available as choice instead of deoplete-jedi).
  • w0rp/ale: Linting/fixing of .ipynb file. Using linters like flake8 from python or maybe custom made linter/fixer specifically for .ipynb file.

Other improvements:

  • Automatically update notebook on save: See this issue for more informations
  • Completion from ipython console: It may be faster to use this one. Check jonathanslenders/ptpython for possibilities.

Known bugs

If you find other bugs please post an issue. If you want to improve this software do not hesitate to cooperate!