Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Remove --output argument #2

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ When you open a Jupyter Notebook (`*.ipynb`) file, it is automatically converted

In more detail, opening a file `notebook.ipynb` in vim will create a temporary file `notebook.md` or `notebook.py` (depending on `g:jupytext_fmt`). This file is the result of calling e.g.

jupytext --to=md --output notebook.md notebook.ipynb
jupytext --to=md notebook.ipynb

The contents of the file is loaded into the buffer instead of the original `notebook.ipynb`. When saving the buffer, its contents is written again to `notebook.md`, and the original `notebook.ipynb` is updated with a call to

jupytext --to=ipynb --from=md --update --output notebook.ipynb notebook.md
jupytext --to=ipynb --from=md --update notebook.md

The `--update` flag ensures the output for any cell whose corresponding input in `notebook.md` is unchanged will be preserved.

Expand Down
10 changes: 4 additions & 6 deletions plugin/jupytext.vim
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@
" temporary file notebook.md or notebook.py (depending on g:jupytext_fmt).
" This file is the result of calling e.g.
"
" jupytext --to=md --output notebook.md notebook.ipynb
" jupytext --to=md notebook.ipynb
"
" The contents of the file is loaded into the buffer instead of the
" original notebook.ipynb. When saving the buffer, its contents is written
" again to notebook.md, and the original notebook.ipynb is updated with
" a call to
"
" jupytext --to=ipynb --from=md --update --output notebook.ipynb notebook.md
" jupytext --to=ipynb --from=md --update notebook.md
"
" The --update flag ensures the output for any cell whose corresponding
" input in notebook.md is unchanged will be preserved.
Expand Down Expand Up @@ -248,8 +248,7 @@ function s:read_from_ipynb(bufread)
call s:debugmsg("jupytext_file exists: ".b:jupytext_file_exists)
if (l:filename_exists && !b:jupytext_file_exists)
call s:debugmsg("Generate file ".b:jupytext_file)
let l:cmd = "!".g:jupytext_command." --to=".g:jupytext_fmt
\ . " --output=".shellescape(b:jupytext_file) . " "
let l:cmd = "!".g:jupytext_command." --to=".g:jupytext_fmt . " "
\ . shellescape(l:filename)
call s:debugmsg("cmd: ".l:cmd)
silent execute l:cmd
Expand Down Expand Up @@ -334,8 +333,7 @@ function s:write_to_ipynb() abort
execute "write! ".fnameescape(b:jupytext_file)
call s:debugmsg("Updating notebook from ".b:jupytext_file)
let l:cmd = "!".g:jupytext_command." --from=" . g:jupytext_fmt
\ . " --to=ipynb --output=".fnameescape(filename)
\ . " --update " . shellescape(b:jupytext_file)
\ . " --to=ipynb --update " . shellescape(b:jupytext_file)
call s:debugmsg("cmd: ".l:cmd)
silent execute l:cmd
if v:shell_error
Expand Down