Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim record history

Tags:

vim

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?

like image 275
prathmesh.kallurkar Avatar asked May 25 '12 10:05

prathmesh.kallurkar


People also ask

How do I view vim 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.

Does vim save history?

saving history seems to be the default. you may need to check $HOME/. viminfo file. it keeps command history in it.

Where is Vim history stored?

It's in the file . viminfo (or _viminfo if you are on Windows). It should be in whatever passes for your home directory.

What is recording @Q in Vim?

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.


1 Answers

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.

like image 128
Balint Avatar answered Oct 12 '22 13:10

Balint