Giter Site home page Giter Site logo

Comments (2)

junegunn avatar junegunn commented on August 19, 2024

Without preceding filetype plugin indent on

  • plug#end()
    • Load ftdetect
    • au PlugLOD FileType xxx call s:lod_ft('xxx', 'vim-xxx')
    • filetype plugin indent on
      • au filetypedetect BufNewFile,BufRead ...
      • au filetypeplugin FileType * call s:LoadFTPlugin()
      • au filetypeindent FileType * call s:LoadIndent()
  • Open xxx
    • ftdetect
    • PlugLOD
      • Add plugin path to &rtp
      • Load plugin and after/plugin
    • filetypeplugin
      • Load ftplugin
    • filetypeindent
      • Load indent

All is well.

With preceding filetype plugin indent on

  • /etc/vimrc
    • filetype plugin indent on
      • au filetypedetect BufNewFile,BufRead ...
      • au filetypeplugin FileType * call s:LoadFTPlugin()
      • au filetypeindent FileType * call s:LoadIndent()
  • plug#end()
    • Load ftdetect
    • au PlugLOD FileType xxx call s:lod_ft('xxx', 'vim-xxx')
    • filetype plugin indent on
      • did_load_filetypes
      • did_load_ftplugin
      • did_indent_on
  • Open xxx
    • ftdetect
    • filetypeplugin
      • Load ftplugin
    • filetypeindent
      • Load indent
    • PlugLOD
      • Add plugin path to &rtp
      • Load plugin and after/plugin

Files under ftplugin are not loaded as &rtp is not yet updated.

Removing filetypeplugin autocmd

  • /etc/vimrc
    • filetype plugin indent on
      • au filetypedetect BufNewFile,BufRead ...
      • au filetypeplugin FileType * call s:LoadFTPlugin()
      • au filetypeindent FileType * call s:LoadIndent()
  • plug#end()
    • Load ftdetect
    • au PlugLOD FileType xxx call s:lod_ft('xxx', 'vim-xxx')
    • au! filetypeplugin *, unlet did_load_ftplugin, ...
    • filetype plugin indent on
      • did_load_filetypes
      • au filetypeplugin FileType * call s:LoadFTPlugin()
      • au filetypeindent FileType * call s:LoadIndent()
  • Open xxx
    • ftdetect
    • PlugLOD
      • Add plugin path to &rtp
      • Load plugin and after/plugin
    • filetypeplugin
      • Load ftplugin
    • filetypeindent
      • Load indent

Reissuing autocmds (current solution)

  • /etc/vimrc
    • filetype plugin indent on
      • au filetypedetect BufNewFile,BufRead ...
      • au filetypeplugin FileType * call s:LoadFTPlugin()
      • au filetypeindent FileType * call s:LoadIndent()
  • plug#end()
    • Load ftdetect
    • au PlugLOD FileType xxx call s:lod_ft('xxx', 'vim-xxx')
    • filetype plugin indent on
      • did_load_ftplugin
      • did_load_filetypes
      • did_indent_on
  • Open xxx
    • ftdetect
    • filetypeplugin
      • Load ftplugin
    • filetypeindent
      • Load indent
    • PlugLOD
      • Add plugin path to &rtp
      • Load plugin and after/plugin
      • doautocmd filetypeplugin FileType
        • Load ftplugin
      • doautocmd filetypeindent FileType
        • Load indent

from vim-plug.

junegunn avatar junegunn commented on August 19, 2024

There were some errors in the description.
Due to the commit 7f1ec7b, autocmd appearing before plug#end() will be invoked before ftplugin. This behavior is consistent regardless of whether filetype plugin indent on is called before plug#end() or not. So if you want to override ftplugin defaults, make sure to put autocmd after plug#end() call.


  • With filetype plugin indent on before plug#end()
    • ftplugin (by s:lod_ft)
    • vimrc autocmd
  • Without filetype plugin indent on before plug#end()
    • ftplugin
    • ftplugin (by s:lod_ft, redundant)
    • vimrc autocmd

Most ftplugins have b:did_ftplugin guard, so loading it again should be fine. 😐

from vim-plug.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.