Setting password with vim editor is pretty simple .Open your terminal and type as
vim +X filename.txt
After it got opened it will ask for password, Enter same password two times and thats it. your file got protected by password. next you want to open it then you must now the password
I have gone through some wonderful command today named as script. You know what it do , it will simply record all your terminal sessions as text.
Usage : script <filename>
In the example you can see, after I typed as script terminal01 , its started storing all the text I am typing after it and its stopped doing that after I have typed exit.
I have seen the same what I have typed in the terminal with more terminal01 command. you can see it in the image.
Hope that helps.