Skip to main content
19 votes
Accepted

What are the .viminfo and .netrwhist files?

You can see that here: :h viminfo If you exit Vim and later start it again, you would normally lose a lot of information. The viminfo file can be used to remember that information, which enables ...
nobe4's user avatar
  • 16.1k
7 votes
Accepted

How to remove entries from v:oldfiles list in neovim

Fix entries in ShaDa File (neovim-specific) Neovim does not use anymore the plaintext file viminfo (used by vim) to store this but uses a msgpack formatted file called ShaDa (short for shared data, :...
Hotschke's user avatar
  • 4,790
5 votes
Accepted

Can't move `viminfo` file - &viminfo reverts upon loading vim

TL;DR This seems to be a bug in vim where set nocompatible is not idempotent and doesn't follow the principle of least astonishment. As a workaround, either: Ensure that you set nocompatible (or ...
Tom Hale's user avatar
  • 2,711
4 votes
Accepted

Moving .viminfo file to .vim dir

viminfo is an option, @Tommy A forgot the keyword set in his command: set viminfo+=n~/.vim/viminfo should work properly. If you read :h 'viminfo' you can see an example: :set viminfo='50,<1000,...
statox's user avatar
  • 50.1k
4 votes

How to get pathname of viminfo file after vim started

See the viminfofile option (:help viminfofile), which is set when using the -i command line flag.
Mass's user avatar
  • 14.2k
4 votes

Exclude file pattern from keeping it in viminfo history?

I guess I found a good solution for my use case. -i option allows to specify alternative locoation of viminfo file. So I can specifey vim -i /tmp/blackhole for cases where I do not care of file ...
Tag Wint's user avatar
  • 213
4 votes

Viminfo truncates named registers. Setting to increase limit?

:help viminfo contains general information on the feature but not settings. :help 'viminfo' (note the apostrophes) is the documentation on the actual option settings. The key bit is < which sets ...
Simon George's user avatar
3 votes
Accepted

Limit the amount of oldfiles in Vim and Neovim

For Vim or gVim users to make sure :browse oldfiles list maximum 20 files make sure that viminfostarts with '20. You can achieve that by have the following line in your .vimrc file: set viminfo='20,&...
Vivian De Smedt's user avatar
3 votes

In Vim how to keep markers per session?

Marks are stored in viminfo not in a session and the viminfo file is only written when exiting vim. So if you are closing vim to switch projects then vim will only have marks for the previous project ...
janders223's user avatar
3 votes

Ignore word spelling on a per-file/buffer basis

There's nothing built-in; I guess the reasoning is that spelling (at least for a certain language) is inherently global. Any differences should be reflected in the language / dialect chosen. You can ...
Ingo Karkat's user avatar
  • 17.9k
2 votes
Accepted

Viminfo truncates named registers. Setting to increase limit?

it can be configured with the " character of the viminfo option From :help 'viminfo: " Maximum number of lines saved for each register. Old name of the '<' item, with the disadvantage that ...
Naumann's user avatar
  • 2,759
2 votes
Accepted

How to encrypt the .viminfo file and still get Vim to read it?

Do you mean swap files? .viminfo is stored in your home directory, even when you're editing files on external disks. Swap files default to being stored in the same directory as the file you're ...
JasonWoof's user avatar
  • 293
2 votes

Can capitalized marks be saved in session INSTEAD of viminfo?

Is there an easy setting to make this switch? Nope I know I could write some vimscript to save my session marks somewhere and reload them to overwrite whatever viminfo is doing, but I don't want ...
Peter Rincker's user avatar
2 votes

Limit the amount of oldfiles in Vim and Neovim

A more comprehensive Neovim / Lua version of the above accepted answer: You can check the current value of the shada option with: :lua print(vim.opt.shada._value) Set shada opt in init.lua / lua ...
Skylar Brown's user avatar
2 votes
Accepted

$VIMINIT conflicts for neovim and vim

Both Vim and Neovim will use the same VIMINIT environment variable to set the configuration directory, so setting a global one will apply to both. You have two options: Set it only for vim commands, ...
Martin Tournoij's user avatar
2 votes
Accepted

Where are buffer level variables stored in Vim? And how to get their RAM / storage usage?

In Vim, if you look at the source code for buflist_new() which adds a filename to the buffer list you'll find the part where the b: dictionary is initialized // init b: variables buf->b_vars = ...
statox's user avatar
  • 50.1k
1 vote
Accepted

Ignore some files when using viminfo+=%

:help viminfo-% gives you some hints on how to achieve this: Quickfix ('buftype'), unlisted ('buflisted'), unnamed and buffers on removable media (|viminfo-r|) are not saved. I would simply make ...
Ingo Karkat's user avatar
  • 17.9k
1 vote

Exclude file pattern from keeping it in viminfo history?

You can also use the r option. See :h viminfo-r: r Removable media. The argument is a string (up to the next ','). This parameter can be given several times. Each specifies the start of a ...
Michael Ma's user avatar
1 vote

Why am I getting vim error E576? (Vim 8.1, Windows 10)

As Herb Wolfe wrote in his comment this is a problem with the viminfo file. On Windows this is $HOME\_viminfo (~/.viminfo on Unix). The viminfo files is written when Vim exits and stores information ...
Ralf's user avatar
  • 9,277
1 vote

E138: Can't write viminfo file $HOME/.viminfo! root $HOME not set in vim

Logging in and out of the shell solved it for me after all else failed. Defining let $HOME="/root" in .vimrc does not help as it can not find $HOME directory to read the .vimrc if :!echo $...
Radagast's user avatar
1 vote

How to remove entries from v:oldfiles list in neovim

I have written an article on dev.to about accessing v:oldfiles entries, here is the function to access oldfiles outside of vim: function old(){ [[ -f /tmp/oldfiles.txt ]] && \rm /tmp/...
SergioAraujo's user avatar
  • 1,175
1 vote
Accepted

Where are my recent commands stored in Vim?

You have a couple of options here. I thing Vim inside Git Bash can access the windows clipboard, so you can try the following: q: to enter to history 'edit' mode, then k many times as needed or search ...
rbernabe's user avatar
  • 801
1 vote

Moving .viminfo file to .vim dir

I know its quite a while now, but I am just mentioning this for future readers. I was facing the same issue while trying to change the location for viminfo file in vimrc. At last setting the value of ...
tanish's user avatar
  • 11
1 vote
Accepted

Vim does not save any usage history (E886: Can't rename viminfo file)

Writing to C:\Program Files (x86) usually requires admin privileges, so Vim won't be able to write there, unless it's run as Administrator. But running Vim as Administrator is a security risk, so you ...
8bittree's user avatar
  • 1,546

Only top scored, non community-wiki answers of a minimum length are eligible