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?
To search the specific previous command in the command line prompt, use : and your search key. For example; type :p and then press the upper arrow key. It will search the command that starts with p and display those commands for you. You can scroll through the history by using up and down arrow keys.
saving history seems to be the default. you may need to check $HOME/. viminfo file. it keeps command history in it.
It's in the file . viminfo (or _viminfo if you are on Windows). It should be in whatever passes for your home directory.
It means you're in "record macro" mode. This mode is entered by typing q followed by a register name, and can be exited by typing q again.
Just an issue that caught me out the other day, which may or may not be your problem:
On some Linux systems (e.g. Ubuntu), if the very first time you run VIM, you run it as a super-user, then the $HOME/.viminfo file gets created with root owner and your local user does not have permissions to write to it. This explained why my VIM was not storing command history when it was all configured up correctly.
Bottom line: on a *nix system, locate your .viminfo file, and make sure you have read/write permissions on it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With