junegunn / junegunn/fzf.vim

Preview show File not found when a file is not in project root folder on win10 with wsl and bat not work

Open
#1,068 1 comment 0 reactions 0 assignees View on GitHub
windows
Dominant language
Vim Script
Stars
10.3k
Forks
608
Avg merge
5d 8h
Merged PRs (30d)
2

Description

- [x] I have read through https://github.com/junegunn/fzf.vim/blob/master/README.md
- [x] I have read through https://github.com/junegunn/fzf/blob/master/README-VIM.md
- [ ] I have read through the manual page of fzf (`man fzf`)
- [x] I have searched through the existing issues

minimum mrc:
set nocompatible hidden laststatus=2

if !filereadable(expand("$HOME/.vim/plug/autoload/plug.vim"))
silent execute "!mkdir " . expand("$HOME/.vim/plug")
silent execute "!git clone https://github.com/junegunn/vim-plug --depth=1 " . expand("$HOME/.vim/plug/autoload")
endif
let &runtimepath .= ',' . expand("$HOME/.vim/plug")

call plug#begin('~/.vim/plugged')
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
call plug#end()

autocmd VimEnter * PlugClean! | PlugUpdate --sync

steps1 . Open gvim -u test.vim
steps2. :Files

symptom1:
![image](https://user-images.githubusercontent.com/56822680/87857377-c8b79180-c958-11ea-84a4-a25a56ecdf10.png)

workaround:
modify preview.sh (line25):
FILE="${FILE/#\~\//$HOME/}"
FILE="${FILE//$'\\'/'/'}" #add
if [ ! -r "$FILE" ]; then
echo "File not found ${FILE}"
exit 1
fi

symptom2:
Doesn't use bat.

In wsl, enter "sudo apt install bat". The bat is called batcat.

workaround:
modify preview.sh (line56):
if [ -z "$FZF_PREVIEW_COMMAND" ] && command -v batcat > /dev/null; then
batcat --style="${BAT_STYLE:-numbers}" --color=always --pager=never \
--line-range=$FIRST:$LAST --highlight-line=$CENTER "$FILE"
exit $?
fi

Any suggestions?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.