1

This question already has an answer here:

Can anyone tell me, How to plain text can be enctypted like password (********) in vi editor or using vi editor or any other method ?

marked as duplicate by Jan, Eric Carvalho, Luís de Sousa, v2r, David Foerster May 7 '15 at 20:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • just encrypt some text in file not the whole file – Ajit Mhatre May 6 '15 at 11:27
  • No method I know of, except of course using copy & paste & gpg manually... – Jan May 6 '15 at 11:31
1

It's not entirely clear to me what you really want to achieve

  • If you want to encrypt the whole file with vim, you can simply run vim -x myfile.txt and vim will ask you for a passphrase to encrypt your file. On next opening of the file, you don't even need to use -x as vim will find out that it is encrypted and will ask you for the passphrase.

  • If you want to encrypt only a string in a file with vim, you can run an external command, or you use this help from the Vim Wikia.

  • If you want to replace all characters of a word with *, you can use vegr* with the cursor on the first character of a word.

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