5

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.

3 Answers 3

7

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
    
0

in case your are using both of vim and neovim, put the following line into your .vimrc file.

" change default viminfo file locatoin
if !has('nvim') | set viminfo+=n~/.config/vim/viminfo | endif
1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Aug 15, 2022 at 3:54
0

I'm not sure I got this error for the same reason, but I found a simple solution; remove this file: ~/.local/share/nvim/shada/main.shada

Your Answer

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

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