Closed kdelchev closed 8 years ago
The default command run by fzf is :
`find . -path '*/\.*' -prune -o -type f -print -o -type l -print 2> /dev/null | sed s/^..//`
Maybe, this is slow because you have many files in your folder that you are not interested in (.git files, others).
One good alternative is :
export FZF_DEFAULT_COMMAND='ag -g ""'
(You have to put this in your .zshrc)
(See https://github.com/junegunn/fzf/tree/c39c039e155c50bcf8fecc5956c4bdd3b5c6bea1#environment-variables )
You have to install ag (the_silver_searcher)
I tried the default command like this
time (find . -path '*/\.*' -prune -o -type f -print -o -type l -print 2> /dev/null | sed s/^..//)
and it finishes quite fast 0.04s user 0.04s system 92% cpu 0.087 total
. The delay I have in vim is about 6.7 seconds according to the profiled result. A colleague of mine is having the same config and running the plugin with the preview is instant. The only difference is rbenv
(I am using rvm
).
How many files are appearing after 6.7 seconds in vim ?
What if you run your time command from with vim ?
Like this in vim
:!time (find . -path '*/\.*' -prune -o -type f -print -o -type l -print 2> /dev/null | sed s/^..//)
The files are 5057. They load below 1 second after running :Files
. The preview is taking a lot before shows the file preview. If I switch to another file the preview is delayed. There is also syntax in the preview. Could it be the syntax? How can I turn it off?
The above command in vim is running quite fast: 0.05s user 0.07s system 104% cpu 0.107 total
I see that in your dotfiles : https://github.com/kdelchev/.vim/blob/master/.vimrc#L59
You are doing :
let g:fzf_files_options =
\ '--preview "(coderay {} || cat {}) 2> /dev/null | head -'.&lines.'"'
Maybe this is too slow, try disabling it for now to be sure it comes from that
I do this as described here: https://github.com/junegunn/fzf.vim#command-local-options
Disabled now - no preview at all.
And is this faster ?
How do you run FZF ? Do you type :FZF
?
Its the same, but the issue is not that. I maybe was not clear. It is the preview which is slow.
I type :Files
. There is no preview with :FZF
.
Ok, I understand now. So probably the command coderay filename
is slow to run for some kinds of files ?
I think you should try to reproduce the issue with a simple file (eg show that time coderay filename
is slow for some kinds of files, and probably report this bug report to coderay)
You are right. Looks like its coderay issue:
time (coderay README.md)
1.61s user 0.11s system 99% cpu 1.735 total
I get the same result for all kind of files rb
, erb
etc.
Thanks a lot for the help.
I personnaly just use "head -n 30 {}" as my preview argument, it is extremely fast and does the job well (but they is no coloring of course)
Perfect! I do the same now. I dont care about colors.
Thanks again.
@edi9999 Thanks for looking into this.
@kdelchev It is probably an issue of your RVM installation. CodeRay for me is sufficiently fast.
wc -l README.md; time coderay README.md > /dev/null
413 README.md
real 0m0.053s
user 0m0.042s
sys 0m0.010s
I can confirm the issue was with my rvm installation. Moved to rbenv - no performance issues now. Thanks again for the help.
I possibly have an issue with fzf. See the question I opened here and related comments. Here is attached profile file created with debugging steps.
The issue is with the preview - it's loading too slow for me. Using the minimum configuration provided the preview is not working at all. I have installed fzf and vim-fzf with recommended steps and have vim-plug as plugin manager. Also I am using oh-my-zsh. Here is my config. And my .vimrc so far.