Fork me on GitHub
#vim
<
2022-04-20
>
reborg08:04:08

Dear vimmers, I noticed that when I have a poor connection or network trouble of some sort, I'm unable to open some type of files (for example, clj but also Dockerfile) as Vim hangs while opening the buffer. Sometimes I can get around it by repeatedly ctrl+C on it until it stops doing whatever is connecting to. Any hints about debugging what is trying to connect to what and why?

Nundrum12:04:04

Try -X. Vim will try to connect to an X server on startup. A slow connection can make that noticeable. That flag will turn off that feature, at the cost of some of the X integration not working.

Proctor12:04:48

is this opening a remote file, or a local file?

reborg18:04:45

Local files. I'm able to replicate if I open up a Clojure project for example, but only the first time I open it. The second time it's instant. I think I've seen it happening with a Dockerfile as well as ruby files. But at the moment, I'm concentrating on Clojure projects. So as suggested by @U09LZR36F I've used the :profile function and then asked vim to open a project.clj file. This is the only thing that seems to have consumed 90 seconds:

FUNCTION  <SNR>42_scrape_path()
    Defined: ~/.vim/bundle/vim-salve/plugin/salve.vim:166
Called 1 time
Total time:  97.017427
 Self time:   0.022392

count  total (s)   self (s)
    1              0.000002   let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd'
    1              0.000002   let cwd = getcwd()
    1              0.000000   try
    1              0.000008     execute cd fnameescape(b:salve.root)
    1  97.017363   0.022328     let path = matchstr(system(b:salve.classpath_cmd), "[^\n]*\\ze\n*$")
    1              0.000006     if v:shell_error
    1              0.000004       return []
                                endif
                                return map(s:split(path), 's:absolute(v:val, b:salve.root)')
    1              0.000001   finally
    1              0.000029     execute cd fnameescape(cwd)
    1              0.000002   endtry
Which seems to point at https://github.com/tpope/vim-salve plugin

dominicm18:04:26

Yep. I've never used salve because I find it too slow.

dominicm18:04:45

I assume your problem is having a snapshot dependency, and it's being checked against maven for the latest version.

reborg18:04:04

that sounds plausible. I'm not even sure why I'm using salve, will investigate. Hopefully it is the only problem and I should assume other slowness was because I had a project.clj in the folder

chrisjd11:04:43

Sounds like you've tracked your issue down, but FWIW I sometimes get issues like this with neovim if I've recently opened remote files (eg on NFS mounts). In those cases, I delete the recent file history with rm ~/.local/share/nvim/shada/main.shada

dominicm08:04:33

@reborg the profiler is your friend.

👍 1
👀 1