Vim record history

vim

Solution

To check whether Vim supports the `'viminfo'` file (which stores the history), `:echo has('viminfo')`. The corresponding setting must not be empty: `:set viminfo?`, and `:set history?` should be greater than one.

If there's a problem writing the viminfo file (though Vim should complain in that case), you could try passing a different location via `vim -i /tmp/viminfo`

Problem

Vim stores the list of commands that we applied using : for the current execution. But when I close vim and start it again, the vim command history is lost. I tried `set history = 1000` in the .vimrc file but that did not help. Where does Vim maintain the local command history? What is the command to retain command history?

Original source