Vim not retaining file and command history
This solved the problem.
https://unix.stackexchange.com/questions/43033/what-would-cause-vim-not-to-retain-command-history
Check presence and rights for ~/.viminfo. Usually that’s it which keeps command history, file editing positions, etc. One possible case is that this file belongs to root.