Open avegancafe opened 8 years ago
Any update on this? I had to uninstall vim-fish because of it
Ditto, still no updates from me. I just uninstalled it @pierrebeaucamp
Ubuntu 14.04, Fish 2.4.0, vim-fish 825853f (master) fast for me: The ftplugin/fish.vim lead is the longest of the loads but still 31ms.
048.776 001.217: loading plugins
048.917 000.141: loading packages
048.937 000.020: inits 3
049.570 000.633: reading viminfo
049.599 000.029: setting raw mode
049.608 000.009: start termcap
049.635 000.027: clearing screen
053.393 001.163 001.163: sourcing /usr/share/vim/vim74/scripts.vim
054.569 000.663 000.663: sourcing /home/elijah/.vim/bundle/vim-fish/syntax/fish.vim
086.425 031.327 031.327: sourcing /home/elijah/.vim/bundle/vim-fish/ftplugin/fish.vim
087.978 000.053 000.053: sourcing /home/elijah/.vim/bundle/vim-fish/indent/fish.vim
088.643 005.802: opening buffers
Can you checkout master
from source and try? That way we can compare.
Also, @pierrebeaucamp are you also using Homebrew and Neovim? Is it easy for you try with normal Vim, not in home brew?
I'm using Neovim. I checked out master, but it still takes multiple seconds to load. Longest file to load is ftplugin/fish.vim
as well, which takes nearly 2 seconds.
This seems to have fixed it for myself in both vim and neovim (sorry @pierrebeaucamp!), thanks for the update @ElijahLynn
@kyleholzinger So to confirm, you are using master
, Homebrew and Neovim or Vim and the speed is normal now and it appears that using master
resolved the issue?
@ElijahLynn Yes sir! I'm on master
, installed both Vim and NeoVim with homebrew, and startup is all back to normal (at most 100ms or so).
I'm running into the slowness issue as well.
I use:
Both installed via homebrew.
I ran:
$ nvim --startuptime vim.log .config/fish/config.fish
Click "Details" below to see the log. Note the following line:
2901.355 2805.314 2805.314: sourcing /Users/gmile/.config/nvim/bundle/vim-fish/ftplugin/fish.vim
Mind blowingly slow for me, wow. Any direction on how to improve the load time?
@babakness can you run vim with --startuptime
flag like this:
vim --startuptime vim.log some_file.txt
And post here the contents of vim.log
?
In my case I have solved the problem after I noticed incorrectly configured fish, specifically the usage of fish_user_paths
fish's function.
@gmile Sure, relevant bits here:
065.290 000.046: setting raw mode
065.294 000.004: start termcap
065.313 000.019: clearing screen
074.441 001.215 001.215: sourcing /usr/local/share/vim/vim80/scripts.vim
5024.670 4950.498 4950.498: sourcing /Users/me/.vim/bundle/vim-fish/ftplugin/fish.vim
5025.775 000.068 000.068: sourcing /Users/me/.vim/bundle/vim-fish/indent/fish.vim
5026.555 000.195 000.195: sourcing /Users/me/.vim/bundle/vim-fish/syntax/fish.vim
5027.115 010.826: opening buffers
5027.171 000.056: BufEnter autocommands
5027.176 000.005: editing files in windows
5027.498 000.322: VimEnter autocommands
5027.499 000.001: before starting main loop
5028.096 000.597: first screen update
5028.097 000.001: --- VIM STARTED ---
similar issue with nvim
. Both installed via brew on mac.
@babakness can you run this:
fish -p profile.txt -c 'echo "Hello, world!"'
And post the contents of profile.txt
?
I'm just starting out with fish and I had this problem too. My config.fish
only had the following line:
brew command command-not-found-init > /dev/null 2>&1; and . (brew command-not-found-init)
Removing it caused vim-fish to launch smoothly.
Talk about specific lol. That seems unrelated to this plugin, I wanna say...
I'm closing this, as I've had my issue solved. Thank you @ElijahLynn !
Reopening because others reported slowness as well, but didn't report it being solved.
I would guess the slowness comes either from executable()
having to search all of $PATH
, although that should still be pretty much instant, it happens any time you type an unknown command into the shell; or from calling out to fish with system()
to get $fish_function_path
, which will run all your fish config.
Those of you experiencing slowness: is fish itself similarly slow to start?
Just a 5 cents: it is very likely that people use fish_user_path
incorrectly. I've ran into this very problem and solved it by reading more about how to use fish_user_path
.
When in need to add something to path, instead of doing this (which I did and which was wrong):
set fish_user_paths $fish_user_paths /new/path
One must do this:
set fish_user_paths /new/path
set fish_user_paths /new/path /another/new/path /and/another/one
fishshell
listens for changes to $fish_user_paths
variable, and does what has to be done to update $PATH
.
I recognized this specifically by running benchmarks built into vim
and fish
, and inspecting the output. In my case there were tons and tons of fish_user_paths
calls. Here's how to benchmark:
vim --startuptime vim.log some_file.txt
fish -p profile.txt -c 'echo "Hello, world!"'
Hmm, fish_function_path
is not the same as fish_user_paths
.
@dag good point, I mistyped that! Updated the comment to have fish_function_path
removed. Thank you for spotting!
Ah you mean, this might be causing executable()
to be slow for people? I thought you were saying it was making the system()
call slow, but that you were confusing the issue.
Yes, I think it is executable()
that's slow for people. It was for me.
I found system("fish -c 'echo $fish_function_path'")
is slow, but still calling fish -c 'echo $fish_function_path
from shell is not slow.
@ypresto Have you tried the suggestion at the bottom of the readme?
Also, have you tried calling that fish -c
line from a shell other than fish?
I had uninstalled this plugin due to the same issue. However, I had also been noticing that the startup time for fish shell itself was getting longer and longer. I found that I was incorrectly setting fish_user_paths
as as @gmile had mentioned. This was causing the variable to bloat over time (tens of thousands of directories long). Removing this and then re-installing the plugin seems to have fixed both issues.
@dag Thanks, set shell=sh
resolved my issue..!
Moreover, start up time of entire vim got faster!
(echo &shell
was /bin/zsh).
hmm, I found it is still slow when I put anyenv init code in config.fish:
eval (anyenv init - fish | source)
When I put sleep 5
it tooks 5 secs to open config.fish file with vim.
There is job for vim & neovim could be used to avoid the block running system command.
I'm definitely still experiencing slowness. After profiling, I was able to narrow down the problem to ftplugin but beyond that, I'm not sure. I've also tried the suggestion of set shell=sh
which sped up vim in general but didn't make much of a difference to vim-fish startup time.
As a side note, is this repo still being maintained? I'd love to help with it in any way I can
Takes 3 seconds longer to start Neovim when opening a file of filetype fish
with vim-fish
enabled. Instant when starting same configuration from Zsh or Bash, so let me see….
In my case it seems to be because my Fish is slow at startup (because of something in my configuration, apparently), and Fish is for some reason called by vim-fish
even when I specify set shell=sh
in Neovim's init.vim
as the top to be sure it has an effect on plugins.
Workaround (with reduced functionality): I commented out every system()
and execute
in $HOME/.local/share/dein/repos/github.com/dag/vim-fish/*/*
, then fought the cache of Dein, somehow eventually successfully.
Solution (for me): Clean up $fish_user_paths
and properly set it (if at all). https://github.com/fish-shell/fish-shell/issues/5834#issuecomment-633265485 Edit $XDG_CONFIG_HOME/fish/config.fish
and make changes according with comments, then erase all of $fish_user_paths
by running set --erase --universal fish_user_paths
and then restart Fish.
@jooize
vim-fish
always calls fish to get the value of $fish_function_path
on startup.
I attempted @chemzqm's suggestion if you'd like to try it out: blankname/vim-fish/pull/3
If all of the cases of this slowness are traced to misconfiguration of fish, I probably won't merge it.
Is there any chance running the job in the background results in undesired behavior?
If something uses path
before the job has finished it won't contain the $fish_function_path
directories.
Vim's docs have some things that use path
listed:
Plugins may also use path
.
The worry is that this change might be added complication to solve a problem that's better solved outside of vim through fish configuration fixes.
It seems the reason we're evaluating job_start
should be solved without it. Asynchronous startup can be a worthy pursuit, but in this case I agree that it appears worse to make that change.
I actually hadn't fixed my problem with $fish_user_paths
, but learned how with some help over at https://github.com/fish-shell/fish-shell/issues/5834#issuecomment-633267311.
Thank you for your time, @blankname.
my performance issues ended up being a misconfigured $fish_user_paths
in my config.fish.
simple fix for me was to do the following:
set fish_user_paths $fish_user_paths /some/path
)
echo $fish_user_paths > ~/fish_user_paths.bak
set updated_paths (echo $fish_user_paths | tr " " "\n" | sort -r | uniq)
echo $updated_paths | tr " " "\n" | nl
set --universal fish_user_paths $updated_paths
I've been loving using fish, but I've found that the startup time of this plugin is super slow, upwards of 5 seconds sometimes. I've pasted below a bit of the output of my
vim --startuptime vim.log test.fish
command. Is there any way to improve the performance? I'm not sure if it's just me, but I'd definitely like to use this plugin without the startuptime lag