Search code examples
vimneovimfzf

preview not working on neovim 0.5 on windows 10 with fzf


i'm running neovim 0.5 with fzf-vim on windows 10 and can't seem to make preview to work.

my init.vim per below:

call plug#begin('~/AppData/Local/nvim/plugged')

    Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
    Plug 'junegunn/fzf.vim'
call plug#end()

let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.9 } }
let $FZF_DEFAULT_OPTS="--ansi --preview-window 'right:60%' --layout reverse --margin=1,4"

Error msg i got when previewing files using :Files or :Rg command: /mnt/c/Users/XXXXX/AppData/Local/nvim/plugged/fzf.vim/bin/preview.sh: line 2: $'\r': command not found
/mnt/c/Users/XXXXX/AppData/Local/nvim/plugged/fzf.vim/bin/preview.sh: line 5: $'\r': command not found
/mnt/c/Users/XXXXX/AppData/Local/nvim/plugged/fzf.vim/bin/preview.sh: line 40: syntax error near unexpected token /mnt/c/Users/XXXXX/AppData/Local/nvim/plugged/fzf.vim/bin/preview.sh: line 40: ` elif [ -n "$MSWINHOME" ]; then

have confirmed that bash.exe from c:\Program Files\Git\bin\ is in PATH.


Solution

    1. Install Git for Windows if you haven't already installed it.

    2. Add the following line to your init.vim file.

      let $PATH = "C:\\Program Files\\Git\\usr\\bin;" . $PATH

    3. Save and Reload NeoVim.