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

Incredible performance penalty when combined with polyglot via pathogen #43

Open
frioux opened this Issue Sep 5, 2017 · 6 comments

Comments

Projects
None yet
4 participants
@frioux
Copy link

frioux commented Sep 5, 2017

I found that if I open a certain markdown file vim takes forever:

$ time vim doc/ats-feed-docs/README.md +quit

vim doc/ats-feed-docs/README.md +quit 0.396s user 0.916s system 76% cpu 1.714 total

I can reproduce the issue with a vimrc of simply:

set rtp+=~/code/dotfiles/vim/bundle/polyglot
set rtp+=~/code/dotfiles/vim/bundle/sleuth

" Pretend to be pathogen
filetype off
filetype on

Removing any of the above fixes the problem. I suspect that there is some weird thing about polyglot that makes detecting filetypes really slow, though I don't really see why that would involve sleuth. If there is anything else I can do to assist here I'm happy to. If you look at polyglot (it's huge) and see something obviously wrong I am also happy to pass along anything you find.

@alecdwm

This comment has been minimized.

Copy link

alecdwm commented Jun 14, 2018

To note: the issue can be reproduced by replacing vim-polyglot just vim-markdown.

Until the underlying cause is found, I've been using vim-pandoc-syntax instead of vim-markdown by adding it to my .vimrc along with:

let g:polyglot_disabled = ['markdown']
augroup pandoc_syntax
	au! BufNewFile,BufFilePre,BufRead *.md set filetype=markdown.pandoc
augroup END

Update:

I no longer use this workaround.
I've instead replaced it with a method of lazy loading vim-sleuth unless the filetype is markdown:

call plug#begin('~/.vim/plugged')

" load vim-polyglot
Plug 'git@github.com:sheerun/vim-polyglot.git' " lots of languages

" lazy-load vim-sleuth in the indefinite future
Plug 'git@github.com:tpope/vim-sleuth.git', { 'on': [] } " smart indent recognition

call plug#end()

" load vim-sleuth if filetype is not markdown
autocmd Filetype * if &filetype != 'markdown' | call plug#load('vim-sleuth') | endif
@dylan-chong

This comment has been minimized.

Copy link

dylan-chong commented Jul 8, 2018

@alecdwm vim-pandoc-syntax looks like it isn't very well maintained - no commits in one year and seventy two issues! how have you been finding that plugin? has it been really buggy or do you still use it

@alecdwm

This comment has been minimized.

Copy link

alecdwm commented Jul 8, 2018

@dylan-chong I still use vim-pandoc-syntax, and it still works around the long startup time issue in many cases, but there are still some instances in which it also has the long startup time issue.
However, I have not yet been able to narrow down the difference between which markdown files cause the long startup issue and which do not.
As for bugs with vim-pandoc-syntax itself, I haven't run into any yet!

@dylan-chong

This comment has been minimized.

Copy link

dylan-chong commented Jul 8, 2018

@alecdwm

This comment has been minimized.

Copy link

alecdwm commented Jul 10, 2018

@dylan-chong Thanks for mentioning the vim-plug lazy load feature!
With that, I've been able to throw this together:

call plug#begin('~/.vim/plugged')

" load vim-polyglot
Plug 'git@github.com:sheerun/vim-polyglot.git' " lots of languages

" lazy-load vim-sleuth in the indefinite future
Plug 'git@github.com:tpope/vim-sleuth.git', { 'on': [] } " smart indent recognition

call plug#end()

" load vim-sleuth if filetype is not markdown
autocmd Filetype * if &filetype != 'markdown' | call plug#load('vim-sleuth') | endif

Unfortunately, it still doesn't help for the case where I open a non-markdown file, then proceed to open a markdown file in the same session.

@docwhat

This comment has been minimized.

Copy link

docwhat commented Dec 14, 2018

I worked around this problem by creating an ftplugin/markdown.vim file in my configs and putting this in it:

let b:sleuth_automatic = 0

I can still run :Sleuth manually if I really need it, but markdown files should always have a shiftwidth of 4. Anything else doesn't "work".

docwhat added a commit to docwhat/dotfiles that referenced this issue Dec 14, 2018

neovim: disable sleuth for markdown
vim-sleuth is very slow (10 seconds) with markdown files.

related: tpope/vim-sleuth#43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.