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

Don't load vim-preview on unrelated filetypes #31

Closed
barraponto opened this Issue Jan 26, 2013 · 7 comments

Comments

Projects
None yet
3 participants
@barraponto

barraponto commented Jan 26, 2013

vim-preview should only load on the respective filetypes (configurable, maybe). Right now, it seems to be loading all the time.

@greyblake

This comment has been minimized.

Show comment
Hide comment
@greyblake

greyblake Jan 28, 2013

Owner

As far as I know almost every plugin works this way:

  • Some small initial stuff is located in plugin/name.vim
  • Main stuff is located in autoload/name.vim.

plugin/name.vim is loaded when you open Vim. It defines some basic commands. But when you execute them it automatically does lazy loading of autoload/name.vim. So must not be a perfomance issue.

However, could you point me to a plugin where it implemented the way you want? (ftplugin doesn't seem to be work as I expected and seems to be not loaded with pathogen at all).

Owner

greyblake commented Jan 28, 2013

As far as I know almost every plugin works this way:

  • Some small initial stuff is located in plugin/name.vim
  • Main stuff is located in autoload/name.vim.

plugin/name.vim is loaded when you open Vim. It defines some basic commands. But when you execute them it automatically does lazy loading of autoload/name.vim. So must not be a perfomance issue.

However, could you point me to a plugin where it implemented the way you want? (ftplugin doesn't seem to be work as I expected and seems to be not loaded with pathogen at all).

@blueyed

This comment has been minimized.

Show comment
Hide comment
@blueyed

blueyed Mar 2, 2014

ftplugin .. seems to be not loaded with pathogen at all

That shouldn't be the case.

However, the plugin+autoload approach is the common ground.

@barraponto
Maybe you can elaborate on what you had/have in mind?

blueyed commented Mar 2, 2014

ftplugin .. seems to be not loaded with pathogen at all

That shouldn't be the case.

However, the plugin+autoload approach is the common ground.

@barraponto
Maybe you can elaborate on what you had/have in mind?

@barraponto

This comment has been minimized.

Show comment
Hide comment
@barraponto

barraponto Mar 3, 2014

I profiled vim using --startuptime as suggested in http://usevim.com/2012/04/18/startuptime/

I noticed vimpreview is one of the worst performance offenders regardless of whether I'm opening MD files.

barraponto commented Mar 3, 2014

I profiled vim using --startuptime as suggested in http://usevim.com/2012/04/18/startuptime/

I noticed vimpreview is one of the worst performance offenders regardless of whether I'm opening MD files.

@blueyed

This comment has been minimized.

Show comment
Hide comment
@blueyed

blueyed Mar 3, 2014

@barraponto
Can you provide the profiling information?

I am sometimes profiling Vim, too, but never had seen vim-preview up in the list.

blueyed commented Mar 3, 2014

@barraponto
Can you provide the profiling information?

I am sometimes profiling Vim, too, but never had seen vim-preview up in the list.

@greyblake

This comment has been minimized.

Show comment
Hide comment
@greyblake

greyblake Mar 3, 2014

Owner

Cool! I haven't known about --startuptime! Let me see..

Owner

greyblake commented Mar 3, 2014

Cool! I haven't known about --startuptime! Let me see..

@greyblake

This comment has been minimized.

Show comment
Hide comment
@greyblake

greyblake Mar 3, 2014

Owner

In my case it takes ~ 11 msec.. And I've figured out what exactly causes the delay. We use shell call uname to detect Mac OS and to set appropriate list of browsers by default:

    if(system("uname") =~ "Darwin")
        let g:PreviewBrowsers    = 'open,safari,firefox,chromium-browser,epiphany,google-chrome,opera'
    else
        let g:PreviewBrowsers    = 'firefox,safari,chromium-browser,epiphany,google-chrome,opera'
    endif
Owner

greyblake commented Mar 3, 2014

In my case it takes ~ 11 msec.. And I've figured out what exactly causes the delay. We use shell call uname to detect Mac OS and to set appropriate list of browsers by default:

    if(system("uname") =~ "Darwin")
        let g:PreviewBrowsers    = 'open,safari,firefox,chromium-browser,epiphany,google-chrome,opera'
    else
        let g:PreviewBrowsers    = 'firefox,safari,chromium-browser,epiphany,google-chrome,opera'
    endif
@greyblake

This comment has been minimized.

Show comment
Hide comment
@greyblake

greyblake Mar 3, 2014

Owner

@barraponto @blueyed Thanks for the interesting report and the involvement.
I've moved defenition of the defaults to autoload. It addresses the issue and now vim-preview takes only 0.230 msec on vim starup.
I guess I can close the issue. The original issue about unrelated filetypes seems to be irrelevant already.

Thanks guys!

Owner

greyblake commented Mar 3, 2014

@barraponto @blueyed Thanks for the interesting report and the involvement.
I've moved defenition of the defaults to autoload. It addresses the issue and now vim-preview takes only 0.230 msec on vim starup.
I guess I can close the issue. The original issue about unrelated filetypes seems to be irrelevant already.

Thanks guys!

@greyblake greyblake closed this Mar 3, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment