4

Problem

I use neovim and I have tried to encrypt my files with :X but then this Error Message comes up:

E492: Not an editor command: X


Questions

  1. Is there any way to do it in neovim like you do it in vim?
  2. Do you know the reason why it only works in vim and not in neovim?


Last Word

In case you don't know the :X vim command:

:X is a vim command, that lets you encrypt the current file with a password


Thanks for your help :)

2 Answers 2

6

In neovim, encryption is intentionally removed. This is the justification: https://github.com/neovim/neovim/commit/85338fe1d5a56f82546e16c305c2048c081771e0, https://github.com/neovim/neovim/issues/694, and https://github.com/neovim/neovim/issues/701.

Since that time, vim has chosen to instead greatly improve the encryption with blowfish2 https://github.com/vim/vim/blob/master/runtime/doc/editing.txt#L1538 and xchacha20 with libsodium https://github.com/vim/vim/blob/master/runtime/doc/options.txt#L2527 rather than remove the feature.

Simply put, :X is not part of the feature set of neovim. vim and neovim are different projects which have different feature sets. It is not possible to have everything.

3
  • 1
    not only blowfish2, but also encryption using libsodium and xchacha20 Commented Nov 8, 2022 at 20:56
  • thanks, xchacha20 is not mentioned in editing.txt for some reason. Also vim docs refer to xchacha20 as "medium to strong encryption," I suppose if you require strong strong encryption there is not a good alternative to gpg.
    – Mass
    Commented Nov 8, 2022 at 21:39
  • 1
    I was conservative with medium to strong encryption, according to libsodium docs, it should offer a real good encryption value Commented Nov 8, 2022 at 21:48
0

Q: Is there a way to do it in neovim?

A: No, there is not. The :X got removed. But there are some alternatives like the GPG-Plugin.


Q: Why does it only work in Vim and not Neovim?

A: Because the old algorithms were insecure and the community voted against the cryptography for neovim and then they got removed in this commit.



Hope this helped someone who had the same problem like me :)

Your Answer

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

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