goerz / jupytext.vim

Vim plugin for editing Jupyter ipynb files via jupytext

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incompatible with :saveas

laci37 opened this issue · comments

Describe the bug

When trying to make a new copy of the notebook I'm working on with :saveas, the buffer name changes, the message "two.ipynb saved via jupytext" appears, but no new file is created, while the previous one is overwritten. Steps to reproduce:

  1. :ed one.ipynb
  2. Make edits, :w
  3. More edits
  4. :saveas two.ipynb

Diagnostics

  • vim --version:
centi@centi-Latitude-3540:~$ nvim --version
NVIM v0.10.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Run "nvim -V1 -v" for more info
  • Operating system information (e.g. uname -a):
centi@centi-Latitude-3540:~$ uname -a
Linux centi-Latitude-3540 6.5.0-18-generic #18~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb  7 11:40:03 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
  • python --VV:
centi@centi-Latitude-3540:~$ python -VV
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
  • Are you using Anaconda? No
  • Put let g:jupytext_print_debug_msgs = 1 in your ~/.vimrc. What is the output of :messages when reproducing the problem?
// :ed one.ipynb
DBG: filename: /home/centi/one.ipynb
DBG: filename exists: 0
DBG: jupytext_file: /home/centi/one.py
DBG: jupytext_file exists: 0
DBG: autocmd jupytext_ipynb BufUnload <buffer> call s:cleanup("/home/centi/one.py", 1)
DBG: autocmd jupytext_ipynb BufWriteCmd,FileWriteCmd <buffer> call s:write_to_ipynb()
DBG: filetype: python
// :w
DBG: overwriting /home/centi/one.py
DBG: Updating notebook from /home/centi/one.py
DBG: cmd: jupytext --from=py --to=ipynb --update '/home/centi/one.py'
DBG: [jupytext] Reading /home/centi/one.py in format py^@[jupytext] Writing /home/centi/one.ipynb
// :saveas two.ipynb
DBG: overwriting /home/centi/one.py
DBG: Updating notebook from /home/centi/one.py
DBG: cmd: jupytext --from=py --to=ipynb --update '/home/centi/one.py'
DBG: [jupytext] Reading /home/centi/one.py in format py^@[jupytext] Writing /home/centi/one.ipynb (destination file updated)
  • Does converting the notebook to/from ipynb with jupytext on the command line work? Not tested, conversion works correctly in vim.

  • Does it work when you set g:jupytext_command in ~/.vimrc to be the exact some jupytext that you used manually, with the exact same version of Python? Not tested, conversion works correctly in vim.