Skip to content

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

Open
@dean-ho

Description

@dean-ho

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

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions