1

Is there an option I can switch on the init.vim config file to let me keep command history between vim sessions?

2 Answers 2

4

If I get you right, it should be persisted by default.

Use :<C-f> or q: to open command line with command history

enter image description here

Vim command history is kept in viminfo file (:h viminfo). Neovim uses different thing (:h shada).

1
  • You are correct, my mistake was to alternate between Vim and Neovim.
    – warsong
    Jul 4, 2020 at 17:21
0

You can override the default location of shada-file (history) to fix the location of this file by:

set shada+='1000,n/opt/my.shada

You can choose any location for the shada-file. Don't forget to give the user permission to this file:

sudo chown username:username /opt/my.shada

If you want more history, change 1000.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.