vimpyterEdit your Jupyter notebooks in Vim/Neovim

联合创作 · 2023-09-30 13:06

Work on the next version began, post your feature ideas here

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

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!

浏览 8
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报