Fasd: viminfo with neovim

Created on 10 May 2016  ·  6Comments  ·  Source: clvv/fasd

I was trying to get fasd working with neovim's equivalent of viminfo, which is shada.

_FASD_VIMINFO="$XDG_DATA_HOME/nvim/shada/main.shada"

Has anyone had any luck with this? I'm guessing the shada file is not in the same format as viminfo, and thus the solution is that I need to create a new backend. Just wanted to ask here in case someone else has already hit this.

Most helpful comment

All 6 comments

I made something similar with neovim's python interface.

You can check it out
https://github.com/haifengkao/nfasd

brilliant!!
nfasd has gone beyond the original goal. It now has folder completion, and better file ordering.
actually I am using it to replace fasd gradually.
besides, it's written in Python (~_^)

EDIT: Nevermind, @nhooyr's solution works perfectly.


I believe this discussion got side-tracked. What I need (and @rosshadden too I believe) is for fasd to index—and include as an option in its results—files that I've opened only from inside NeoVim.

How to reproduce:

  1. Open NeoVim.
  2. Open a file (e.g. :e file.sh).
  3. Exit NeoVim.
  4. Try to refer to file.sh using $ neovim f,file.sh<TAB>.
  5. Fail miserably as fasd doesn't know I've ever opened file.sh.

I also thought that it would be a good idea to write a back-end for neovim. Having said that, I think the vim-script solution above works well enough for me so I'm just going to stick with that for now. Wouldn't this work well on the readme or somewhere in the wiki or something ?

here's a rough fasd backend for neovim's shada file. I have this in my ~/.fasdrc:

shada() {
    ~/code/neovim/scripts/shadacat.py ~/.local/share/nvim/shada/main.shada 'entry.type.value == 10' | \
        sed -n "s/^.*'f': '\([^']*\)'.*$/\1/p" | \
        awk -v t="$(date +%s)" '{
            if (!seen[$0]) {
                t -= 60
                print $0 "|1|" t
            }
            seen[$0] = 1
        }'
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

sypl picture sypl  ·  12Comments

ixil picture ixil  ·  5Comments

simendsjo picture simendsjo  ·  6Comments

rendybjunior picture rendybjunior  ·  14Comments

ghost picture ghost  ·  12Comments