Giter Site home page Giter Site logo

Comments (6)

BlueDrink9 avatar BlueDrink9 commented on July 17, 2024

@goerz do you have any thoughts here?

from jupytext.vim.

mwouts avatar mwouts commented on July 17, 2024

Hello @goerz , @BlueDrink9. I am not an advanced VIM user, but maybe I can contribute my own experience with this.

I use paired notebooks (py/ipynb), and open them simultaneously in Jupyter (ipynb) and in my text editor (py file, in PyCharm Pro). Conflicts do occur, either because of the autosave, or because I have changed the notebook in both Jupyter and my text editor. In this situation, Jupyter and the editor both tell me that the file has changed on disk, and give me the option to reload or overwrite. Most of the time I am happy with overriding the notebook with one of the two versions. But sometimes I prefer to merge the two edits, and here I find PyCharm very convenient, as it lets me compare the two different version of the .py file (in memory vs on disk), and merge them.

Would that work in VIM as well? Do you need something else than paired notebooks (i.e. jupytext --set-formats ipynb,py notebook.ipynb)?

from jupytext.vim.

BlueDrink9 avatar BlueDrink9 commented on July 17, 2024

The problem is not that they become out of sync. This plugin opens a buffer called [].ipynb, but fills it with the translated content. The write command that this plugin uses to then translate it back to the ipynb format in the file doesn't always replace the default vim write command, meaning the ipynb file sometimes ends up as a plaintext file, rather than a valid json.

from jupytext.vim.

goerz avatar goerz commented on July 17, 2024

Are you able to reproduce a situation where the plain text ends up being written to the ipynb file? I think I’ve had that happen once or twice, but wasn’t able to determine the cause.

from jupytext.vim.

goerz avatar goerz commented on July 17, 2024

@mwouts To be clear: I think if you actually have linked notebooks in a directory, it’s best not to use the jupytext.vim plugin and to just open the actual py or md file in vim. I don’t have much experience with this, though, as I haven’t really used linked notebooks so far.

from jupytext.vim.

BlueDrink9 avatar BlueDrink9 commented on July 17, 2024

I think this is one of the things causing it.

function! Autosave()
    " Don't autosave if there is no buffer name.
    if bufname('%') != '' && &ro != 1 && &modifiable == 1
        " Automatically save before commands like :next and :make
        set autowrite
        " If no changes, don't touch modified timestamp.
        silent! update
    endif
endfunction
au! FocusLost,InsertLeave,BufLeave * call Autosave()

from jupytext.vim.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.