ipynb_notedown.vim


Ⅰ. 插件描述

vim plugin for editing jupyter notebook (ipynb) files through notedown

Ⅱ. 基本信息

创建日期:  2016-12-26
使用用户:  3
Github星:  27
插件作者:  Michael Goerz

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'goerz/ipynb-notedown-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'goerz/ipynb-notedown-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'goerz/ipynb-notedown-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/goerz/ipynb_notedown.vim

Ⅳ. 文档说明

# ipynb_notedown.vim

Vim/Neovim plugin for editing Jupyter notebook (ipynb) files
through notedown.

http://www.vim.org/scripts/script.php?script_id=5506

This plugin is obsolete: use jupytext.vim instead

Installation

  1. Copy the ipynb_notedown.vim script to your vim plugin directory (e.g.
    $HOME/.vim/plugin). Refer to :help add-plugin,

:help add-global-plugin and :help runtimepath for more details about
Vim plugins.

  1. Restart Vim.

Usage

When you open a Jupyter Notebook (*.ipynb) file, it is automatically
converted from json to markdown through the notedown utility. Upon saving
the file, the content is converted back to the json notebook format.

The purpose of this plugin is to allow editing notebooks directly in vim.
The conversion json → markdown → json is relatively lossless, although
some of the restrictions of the notedown utility apply. In particular,
notebook and cell metadata are lost, and consecutive markdown cells are
merged into one cell.

Configuration

The following settings in your ~/.vimrc may be used to configure the
plugin:

  • g:notedown_enable=1

You may disable the automatic conversion between the notebook json
format and markdown (i.e., deactivate this plugin) by setting this to 0.

  • g:notedown_code_match='all'

Value for the --match command line option of notedown.
There are known problems with using the value 'strict', but 'fenced'
may be a good alternative if you need code blocks in markdown.

jupytext.vim

The jupytext utility is an alternative to notedown that has considerably less shortcomings. In particular, it guarantees the roundtrip conversion ipynb → markdown → ipynb to be lossless (metadata is preserved, consecutive markdown cells are possible). This is achieved by the markdown file containing only the notebook inputs, and the conversion back to the notebook format using the data from the original notebook file for the outputs. The jupytext.vim plugin provides similar capabilities to ipynb_notedown.vim, but using jupytext instead of notedown by default. If you still want to use notedown over jupytext, e.g. because you need cell outputs to be contained in the markdown representation, you can still use the new jupytext.vim plugin, with the following custom configuration in your ~/.vimrc:

let g:jupytext_command = 'notedown'
let g:jupytext_fmt = 'markdown'
let g:jupytext_to_ipynb_opts = '--to=notebook'

Thus, jupytext.vim supersedes the ipynb_notedown.vim entirely, and should be used instead of it.

添加新评论