michal-h21 / vim-zettel

VimWiki addon for managing notes according to Zettelkasten method
MIT License
557 stars 73 forks source link

ZettelOpen and ZettelSearch fail because of an "Error running fzf..." #58

Open sbicknel opened 4 years ago

sbicknel commented 4 years ago

I tried starting with a fresh Vim configuration, reinstalling Vundle, fzf, fzf.vim, Vimwiki, and Vim-Zettel and rebuilding my configuration from scratch. I also tried configuring the g:zettel_fzf_command variable with "rg --column --line-number --ignore-case --no-heading --color=always " as I have both fzf and rg on my system and set the g:nv_search_paths variable to the location of my zettelkasten. Nothing seems to make a difference.

michal-h21 commented 4 years ago

Do commands provided by fzf.vim work? What is the full error you get?

sbicknel commented 4 years ago

Fzf.vim works on its own.

Error running fzf --ansi --prompt Rg>... f.vim/bin/preview.sh\ {} --no-height >tmp/.../0

That's as much of the error message as is visible.

On Mon, Aug 17, 2020, 12:03 PM Michal Hoftich notifications@github.com wrote:

Do commands provided by fzf.vim work? What is the full error you get?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/michal-h21/vim-zettel/issues/58#issuecomment-675057311, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMUZXXCVGZMENXJZT6W3CTSBF5H7ANCNFSM4QB6PPKA .

sbicknel commented 4 years ago

Error running 'fzf' '--ansi' '--prompt' 'Ag> ' '--multi' '--bind' 'alt-a:select-all,alt-d:deselect-all' '--delimiter' ':' '--preview-window' '+{2}-5' '--color' 'hl:4,hl+ :12' '--exact' '--tiebreak=end' '--preview' ''\''/home/scott/.vim/bundle/fzf.vim/bin/preview.sh'\'' {}' --no-height > /tmp/veQ0wKo/0

On Mon, Aug 17, 2020 at 2:40 PM Scott Bicknell sbicknel@gmail.com wrote:

Fzf.vim works on its own.

Error running fzf --ansi --prompt Rg>... f.vim/bin/preview.sh\ {} --no-height >tmp/.../0

That's as much of the error message as is visible.

On Mon, Aug 17, 2020, 12:03 PM Michal Hoftich notifications@github.com wrote:

Do commands provided by fzf.vim work? What is the full error you get?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/michal-h21/vim-zettel/issues/58#issuecomment-675057311, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMUZXXCVGZMENXJZT6W3CTSBF5H7ANCNFSM4QB6PPKA .

-- Scott Bicknell :wq

michal-h21 commented 4 years ago

Maybe there is some error message in /tmp/veQ0wKo/0 file? I've found only similar issue here: https://github.com/junegunn/fzf/issues/1486. It is possible that it is caused by the preview window. Does fzf --preview 'echo {}' command work?

sbicknel commented 4 years ago

The /tmp/veQ0wKo/0 file is empty and running fzf --preview 'echo {} from the shell works fine.

On Mon, Aug 17, 2020 at 3:19 PM Michal Hoftich notifications@github.com wrote:

Maybe there is some error message in /tmp/veQ0wKo/0 file? I've found only similar issue here: junegunn/fzf#1486 https://github.com/junegunn/fzf/issues/1486. It is possible that it is caused by the preview window. Does fzf --preview 'echo {}' command work?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/michal-h21/vim-zettel/issues/58#issuecomment-675143458, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMUZXQVC3CVR2QVIIKCL6DSBGUHVANCNFSM4QB6PPKA .

-- Scott Bicknell :wq

michal-h21 commented 4 years ago

I honestly don't know what the issue can be. Can you please share your .vimrc?

sbicknel commented 4 years ago
" --------------------
" Vundle Configuration

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
set rtp+=/usr/bin/fzf
set rtp+=/usr/bin/ag
set rtp+=/usr/bin/rg
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'vimwiki/vimwiki'
Plugin 'michal-h21/vim-zettel'
Plugin 'junegunn/fzf'
Plugin 'junegunn/fzf.vim'
Plugin 'jnurmine/Zenburn'
Plugin 'arcticicestudio/nord-vim'
Plugin 'jschmold/sweet-dark.vim'
Plugin 'tpope/vim-vinegar'
" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just

:PluginUpdate " :PluginSearch foo - searches for foo; append ! to refresh local cache " :PluginClean - confirms removal of unused plugins; append ! to auto-approve removal " " see :h vundle for more details or wiki for FAQ " Put your non-Plugin stuff after this line

" --------------
" Global options

set modeline
set showcmd
set showmatch
set ignorecase
set smartcase
set autowriteall
set hidden
set mouse=a
set lazyredraw
set shell=bash "helps Vundle avoid errors when running under a

different shell set nopaste set path=.,,** set wrap linebreak nolist set spelllang=en_us set completeopt=longest,menuone set cursorline set scrolloff=1 set termguicolors set tabstop=4 set expandtab set shiftwidth=4 set softtabstop=4 set shiftround set dictionary+=/usr/share/dict/words set complete+=k set guioptions+=a set guioptions+=c set guioptions+=d set guioptions-=m set guioptions-=t set guioptions-=T set guioptions-=r set guioptions-=R set guioptions-=l set guioptions-=L set guioptions-=b set guicursor+=a:blinkon0 set wildmode=longest:full,list:full set wildmenu set hlsearch set incsearch set termguicolors set title set showmode set splitright splitbelow

" ---------------
" Map leaders
let mapleader = ' '
let localleader = '\\'

" ---------------
" Global mappings
nnoremap gB :ls<cr>:buffer<space>
nnoremap gc :display<cr>:put<space>
nnoremap <Space> <Nop>
vmap > >gv
vmap < <gv
nnoremap Y y$
nnoremap j gj
vnoremap j gj
onoremap j gj
nnoremap k gk
vnoremap k gk
onoremap k gk
nnoremap 0 g0
nnoremap $ g$
nnoremap <c-l> :nohl<cr><c-l>
nnoremap <leader>gB :browse oldfiles<cr>
nnoremap <F11> :e $MYVIMRC<cr>
inoremap <F11> <c-o>:e $MYVIMRC<cr><esc>
nnoremap <leader>tpl :e ~/.vim/plugin/templates.vim<cr><cr>

colorscheme nord

augroup coding
  au!
  autocmd QuickFixCmdPost [^l]* nested cwindow
  autocmd QuickFixCmdPost    l* nested lwindow
augroup END

" Netrw options
let g:netrw_liststyle = 0
let g:netrw_banner = 0
let g:netrw_list_hide = '^\..*'        " or anything you like
let g:netrw_hide = 1                   " hide by default

" Vimwiki settings
let g:vimwiki_list = [{'path':'~/Documents/notes','auto_tags': 1,

'auto_toc': 1},{'path':'~/Documents/fleeting','auto_tags': 1,'auto_toc': 1,'syntax': 'markdown', 'ext': '.md'}] let g:vimwiki_use_mouse = 1 let g:vimwiki_folding = 'expr' let g:vimwiki_auto_chdir = 1

nnoremap <leader>vt :VimwikiSearchTags<space>
nnoremap <leader>vs :VimwikiSearch<space>
nnoremap <leader>gt

:VimwikiRebuildTags!:VimwikiGenerateTags nnoremap bl :VimwikiBacklinks

" Vim-Zettel settings
let g:zettel_options = [{"front_matter" : {"tags" : ""}, "template" :

"~/Templates/zettel.tpl"},{}] let g:zettel_format = "%Y%m%d%H%M%S" let g:nv_search_paths = ['~/Documents/notes']

nnoremap <leader>zl :ZettelSearch<cr>
nnoremap <leader>zn :ZettelNew<cr>G:.-1read

~/Templates/zettel.tplggA nnoremap zi :ZettelInbox nnoremap zb :ZettelBackLinks nnoremap zo :ZettelOpen

On Tue, Aug 18, 2020 at 4:18 AM Michal Hoftich notifications@github.com wrote:

I honestly don't know what the issue can be. Can you please share your .vimrc?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/michal-h21/vim-zettel/issues/58#issuecomment-675418962, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMUZXVKWUFD3I7YXXVX253SBJPQHANCNFSM4QB6PPKA .

-- Scott Bicknell :wq

sbicknel commented 4 years ago

The only other thing in can add is something I just noticed while trying to run those commands again. The window splits horizontally (to be expected for the fzf output) and a message appears for about half a second that starts out with "Invalid preview window" but then disappears before I can finish reading it. That message does not appear on subsequent attempts to run ZettelOpen or ZettelSearch and it not present in the output of :messages.

michal-h21 commented 4 years ago

It really seems to be an issue caused by the preview window. Your .vimrc works fine on my system (Fedora 31), except that it doesn't conceal links. But :ZettelOpen works, as well as your custom mappings using <leader>zo.

You may try if the preview window works in Vim at all on your system (we know that it works on the command line already). Try to define the following command:

command! -bang -nargs=? -complete=dir Files call fzf#vim#files(<q-args>, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline']}), <bang>0)

And execute it using :Files then. If it doesn't work, then the issue is probably in FZF. If it works, then I honestly don't know what the issue is and how to locate it :/

sbicknel commented 4 years ago

That command DOES work.

On Tue, Aug 18, 2020 at 9:26 AM Michal Hoftich notifications@github.com wrote:

It really seems to be an issue caused by the preview window. Your .vimrc works fine on my system (Fedora 31), except that it doesn't conceal links. But :ZettelOpen works, as well as your custom mappings using zo.

You may try if the preview window works in Vim at all on your system (we know that it works on the command line already). Try to define the following command:

command! -bang -nargs=? -complete=dir Files call fzf#vim#files(, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline']}), 0)

And execute it using :Files then. If it doesn't work, then the issue is probably in FZF. If it works, then I honestly don't know what the issue is and how to locate it :/

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/michal-h21/vim-zettel/issues/58#issuecomment-675580836, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMUZXXQN7T2QV3FYQYFU73SBKTTFANCNFSM4QB6PPKA .

-- Scott Bicknell :wq

khanmurad commented 4 years ago

I am having the same issue. FZF search initiated by [[ was working before I updated my vim-zettel plugin. I must note that I have updated all my plugins installed via vundle at once. Here is the error message:

Error running 'fzf'  '--ansi' '--prompt' 'Ag> ' '--multi' '--bind' 'alt-a:select-all,alt-d:deselect-all' '--delimiter' ':' '--preview-window' '+{2}-5' '--
color' 'hl:4,hl+:12' '--exact' '--tiebreak=end' '--preview' ''\''/Users/tasdemir/.vim/bundle/fzf.vim/bin/preview.sh'\'' {}' '--preview' ''\''/Users/tasdem
ir/.vim/bundle/fzf.vim/bin/preview.sh'\'' {}' '--preview' ''\''/Users/tasdemir/.vim/bundle/fzf.vim/bin/preview.sh'\'' {}' '--preview' ''\''/Users/tasdemir
/.vim/bundle/fzf.vim/bin/preview.sh'\'' {}' '--preview' ''\''/Users/tasdemir/.vim/bundle/fzf.vim/bin/preview.sh'\'' {}' '--preview' ''\''/Users/tasdemir/.
vim/bundle/fzf.vim/bin/preview.sh'\'' {}' '--preview' ''\''/Users/tasdemir/.vim/bundle/fzf.vim/bin/preview.sh'\'' {}' --no-height > /var/folders/g5/p2zgvr
5j54s5w2l0j_mxvdy00000gn/T/vQwcKC5/7
michal-h21 commented 4 years ago

I've tried another machine and I can confirm this issue now. The good thing is that I will be able to debug it now :)

michal-h21 commented 4 years ago

I've found the issue is a recent change in fzf.vim. It is basically the same issue as this. I was able to fix that by update of the FZF binary. FZF.vim readme states that it needs FZF v22. My Linux distro contains only FZF v21, so I had to update it manually from Github.

ismatim commented 4 years ago

I've found the issue is a recent change in fzf.vim. It is basically the same issue as this. I was able to fix that by update of the FZF binary. FZF.vim readme states that it needs FZF v22. My Linux distro contains only FZF v21, so I had to update it manually from Github.

I updated to 0.22 but same issue with fzf.vim.

michal-h21 commented 4 years ago

The following code from fzf.vim documentation failed for me with FZF 21, but it works for me with FZF 22:

function! RipgrepFzf(query, fullscreen)
  let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case -- %s || true'
  let initial_command = printf(command_fmt, shellescape(a:query))
  let reload_command = printf(command_fmt, '{q}')
  let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]}
  call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen)
endfunction

command! -nargs=* -bang RG call RipgrepFzf(<q-args>, <bang>0)

It uses the same functions as we use in Vim-zettel (fzf#vim#grep and fzf#vim#with_preview).

ismatim commented 4 years ago

@michal-h21 yes, true. It works 🎉 Thank you

ismatim commented 4 years ago

@michal-h21 apologize, I thought it was working but, it was not at my end. I updated to 0.22. 🤦‍♂️

michal-h21 commented 4 years ago

@ismatim and the :RG command from my previous comment doesn't work as well?

ismatim commented 4 years ago

@ismatim and the :RG command from my previous comment doesn't work as well?

@michal-h21:

Not really, I got E471: Argument required.

This is the previous one: \'command! -bang -nargs=* Rg call fzf#vim#grep("rg --column --line-number --no-heading --color=always --smart-case -- ".shellescape(<q-args>), 1, s:p(<bang>0), <bang>0)',

And, the error output in osx with fzf 0.22: Error running '/Users/me/.vim/bundle/fzf/bin/fzf' --history '/Users/me/.local/share/fzf-history/rg' '--color=bg+:238,bg:235,border:0,spinner:228,hl:245,fg:231,header:245,info:197,poi nter:197,marker:197,fg+:231,prompt:197,hl+:197' '--ansi' '--prompt' 'Rg> ' '--multi' '--bind' 'alt-a:select-all,alt-d:deselect-all' '--delimiter' ':' '--preview-window' '+{2}-5' '--color' 'hl:4,hl+:12' '--preview -window' 'right' '--preview' ''\''/Users/me/.vim/bundle/fzf.vim/bin/preview.sh'\'' {}' --expect=ctrl-v,ctrl-x,ctrl-t --no-height > /var/folders/g4/47bp_8s521b2d5s764qhgg480000gn/T/nvimQizRbL/1

michal-h21 commented 4 years ago

I believe that the issue is caused by this argument to FZF, which seems to not work in it's earlier versions: '--preview-window' '+{2}-5' . It was introduced in this FZF.vim commit, on line 747.

dgdosen commented 4 years ago

Adding a bit of info - I get this error while working in macos 11 (Big Sur) beta, but not on another machine running macos 10.15.x.

Other than that, these machine are identical. Same brewed binaries, same vim config...

michal-h21 commented 4 years ago

I've added comment to the FZF.vim issue tracker, so I hope they will fix it for all FZF versions.

ismatim commented 4 years ago

@michal-h21 I upgraded my freebsd machine to latest port with fzf 0.22 and it works, it wasn't working before. In osx I had to downgraded the HEAD~1 in fzf.vim repo. But, there is a breaking change certainly in last commit. Thank you.

zhukovgreen commented 4 years ago

The same issue on Ubuntu

michal-h21 commented 4 years ago

I've updated the README with the known issues section. The FZF update is probably only advice I can give now :/

khanmurad commented 4 years ago

Yes, updating solves the problem (mac OS).

donniep commented 3 years ago

I ran into this issue yesterday with fresh installs on both Mac and Ubuntu using author's suggested vimrc with vim. On a whim, today, I installed neovim. The errors completely go away using neovim.

rober-m commented 3 years ago

Ran with the same issue while having the latest fzf. Solve it by reinstalling both FZF and the vim-zettel plugins.