4

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.

Frederick Zhang
  • 160
  • 1
  • 8

2 Answers2

5
  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.

Ribtoks
  • 6,634
  • 1
  • 25
  • 37
gayashanbc
  • 937
  • 1
  • 15
  • 30
  • not too sure about the meaning of `let $PATH = "C:\Program\ Files\Git\usr\bin;" . $PATH` but it doesn't work. Also tried `let $PATH = "C:\Program Files\Git\usr\bin;" . $PATH`. Confirmed that the git is installed in C:\program files\git folder. – Frederick Zhang Jun 10 '21 at 13:18
  • 2
    okay it is working now after changing the path to ` let $PATH = "C:\\Program Files\\Git\\usr\\bin;" . $PATH`. thanks! – Frederick Zhang Jun 10 '21 at 13:22
2

i solved it adding "C:\Program Files\Git\usr\bin" to the PATH environment variable in Windows 10