Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vim freezes when editing around URL-like text #4

Open
machakann opened this issue Mar 13, 2019 · 9 comments
Open

Vim freezes when editing around URL-like text #4

machakann opened this issue Mar 13, 2019 · 9 comments

Comments

@machakann
Copy link

When I edited a markdown file, I experienced vim freezing several times. It seems that fnamemodify() is the reason.

let l:cwd = fnamemodify(l:cwd, ':p:h')

If l:cwd is a text like '//a/b/c', vim freezes several seconds. Probably, fnamemodify() might try to search for a network drive in windows os (?) If l:cwd starts with \\ current one is expected behavior, but it would be nice to avoid it if l:cwd starts with //.

I'm using gvim 8.1.1005 on windows 10.

@machakann
Copy link
Author

How to reproduce

  1. Prepare a buffer contains a URL-like text
https://foo.com/
  1. Vim freezes when insert a character after foo.com/ and a space.
https://foo.com/ a

This problem would occur only the first time.

@prabirshrestha
Copy link
Owner

Does it reproduce in v2 branch?

@machakann
Copy link
Author

Yes, I'm using v2 branch.

@amadeus
Copy link
Contributor

amadeus commented Aug 19, 2019

Another example I've found that seems to cause a massive freeze - is typing out a block comment in css or js: /** and when typing that final / it just locks up.

@habamax
Copy link

habamax commented Jan 28, 2020

Confirm on vim/gvim (8.1.158), neovim-nightly.

  • latest async, asyncomplete, asyncomplete-file
  • OS: win10

asyncomplete-file

To reproduce:

  1. paste
git clone https://github.com/habamax/vim-asciidoctor.git ./habamax/start/vim-asciidoctor
git clone https://github.com/habamax/vim-evalvim.git ./habamax/start/vim-evalvim
git clone https://github.com/habamax/vim-skipit.git ./habamax/start/vim-skipit
git clone https://github.com/habamax/vim-elixir-mix-test.git ./habamax/start/vim-elixir-mix-test
git clone https://github.com/habamax/vim-sendtoterm.git ./habamax/start/vim-sendtoterm
git clone https://github.com/habamax/vim-colors-defminus.git ./habamax/start/vim-colors-defminus
git clone https://github.com/habamax/vim-colors-defnoche.git ./habamax/start/vim-colors-defnoche
git clone https://github.com/habamax/vim-colors-lessthan.git ./habamax/start/vim-colors-lessthan
git clone https://github.com/habamax/vim-winlayout.git ./habamax/start/vim-winlayout
git clone https://github.com/habamax/vim-num2words.git ./habamax/start/vim-num2words
  1. goto winlayout word
  2. cw and type anything

@Shatur
Copy link

Shatur commented Mar 10, 2020

It also hangs even with the following string:

/$ typing every character after this symbols causing small freeze

@ZSaberLv0
Copy link

ZSaberLv0 commented Jul 11, 2022

got the same issue, and I think it's the globpath()'s issue: file.vim#L50

when a:ctx['typed'] is http://, the l:kw and l:cwd would be //, finally causing a globpath call with this:

globpath('//', '.\=[^.]*')

a workaround:

let l:kw    = matchstr(l:typed, '<\@<!\(\.\{0,2}/\|\~\).*$')
" add these lines:
if match(l:kw, '^//') >= 0
  let l:kw = strpart(l:kw, 1)
endif

@prabirshrestha
Copy link
Owner

@ZSaberLv0 does it also support ** pattern as in #14? related PR: #11

@ZSaberLv0
Copy link

ZSaberLv0 commented Jul 12, 2022

I think it's different issue

#14 result to globpath('/**', '.\=[^.]*') , I think it would recursively glob the entire file system, with tons of result, which caused slow

this issue resut to globpath('//', '.\=[^.]*'), which would try to glob network drives, and it's very slow for Windows, even with limited result, but only for the first time


maybe, the best solution would be:

let l:kw = substitute(l:kw, '\(/\|^\)\*\+\(/\|$\)', '\1\2', 'g')
let l:kw = substitute(l:kw, '\\', '/', 'g')
let l:kw = substitute(l:kw, '//\+', '/', 'g')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants