2

I'm switching from vim to neovim, but when starting neovim, I get the following error on startup:

E576: Failed to parse ShaDa file: extra bytes in msgpack string at position 3

What does this mean, and how do I stop neovim complaining about it?

Note: I want to be able to use both vim and neovim with the same vimrc.

4

TL;DR: skip to the Resolution section.

Background

The issue is that neovim can't read/write vim's viminfo file format.

Instead of using vim'sviminfo format for storing editing session information, neovim uses a shada-file for "SHAred DAta".

The default shada file name is $XDG_DATA_HOME/nvim/shada/main.shada, and $XDG_DATA_HOME is ~/.local/share by XDG default, giving a default shada file named:

~/.local/share/nvim/shada/main.shada

Cause

In neovim, &viminfo is a deprecated alias to the 'shada' option, which configures the shada-file's location and usage. This means that neovim will look at the viminfo variable for information about shada data.

This is generally fine - it's good for backward compatibility to store/recover the same information that vim would... except in the case where a file name is specified - a file which will probably contain viminfo data, not shada data.

The culprit is your viminfo variable (or possibly your shada variable), where you've explicitly set a filename to be used for the viminfo (or shada) file.

This file that you are referencing is in viminfo format, not shada format.

For example:

:set viminfo?
viminfo=!,'100,<50,s10,h,n~/vim/viminfo

In your vimrc, you probably have a line like:

set viminfo+=n~/vim/viminfo

Where n<name> sets the file to be <name>.

The issue is that the file named <name> contains data in viminfo format.

Resolution

You can either:

  1. Remove the line which explicitly sets the viminfo file name, in which case:

    • vim will use ~/.viminfo
    • neovim will use $XDG_DATA_HOME/nvim/shada/main.shada

    or

  2. Keep the existing file name when running vim, and use another when using neovim:

    if !has('nvim')
      set viminfo+=n~/vim/viminfo
    else
      " Do nothing here to use the neovim default
      " or do soemething like:
      " set viminfo+=n~/.shada
    endif
    
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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