0

How vim saves files when typing :w in normal mode ? I have the feeling there is something different happening in comparison with other IDEs / Editors.

I ask this because I had issues when developing a frontend app using Storybook (nodejs) => this one freezes when saving a file in vim, and not in other IDEs / Editor.

This makes me think there must be something different with Vim when performing some operations like saving a file.

Thanks

2
  • 4
    Welcome to Vi and Vim! As it stands, your question looks like it's asking the very broad question "How is vim different"—underneath, however, it looks you're really asking the much more specific "How does vim save files, and why could that cause problems with Storybook/nodejs?" Please edit to clarify, and note that the former question is too broad in scope, while the latter is a good question. If anyone finds a previous question about how vim writes files (which it does oddly, to be fair), please link it here.
    – D. Ben Knoble
    Nov 4, 2020 at 16:46
  • :h backup-table set nowb etc.
    – Matt
    Nov 5, 2020 at 9:31

1 Answer 1

1

It seems that when saving,

Vim deletes the file and replaces it with a new one with the same attributes, meaning that the previous pointer is no longer valid.

Setting this in vim seems to fix the issue :

:set backupcopy=yes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.