What's the difference between plugin, autoload, Ftplugin?
Many of the first friends with VIM will have some doubts when installing plugins. The same plug-ins, some tutorials say installed in the plugin directory, some say installed in the Ftplugin directory, some say installed in the AutoLoad directory, exactly what are the differences between these directories? Today Ju to explain to you.
In general, after we install VIM, we should create a user vim folder, the subdirectory structure and the original VIM directory structure almost the same, for example, under the Windows platform this name is Vimfiles, under the Unix class platform is ~/.vim. But their subdirectory structure is similar to the following:
|-after
|-ftplugin
|-syntax
|-autoload
|-colors
|-compiler
|-doc
|-ftplugin
|-latex-suite
|-–dictionaries
|-–macros
|-–packages
|-–templates
|-python
|-indent
|-plugin
|-spell
|-syntax
~/.vim/colors/is used to store the vim color scheme.
The ~/.vim/plugin/store is a plugin that will be run once every time vim is started, meaning that the plugin that you want to run when Vim starts is placed in this directory.
The files in the ~/.vim/ftdetect/will also run when Vim is started. There may be times when this directory is not available. Ftdetect stands for "FileType detection (file type detection)". The files in this directory should use automatic commands (autocommands) to detect and set the file type, except that there is nothing else. In other words, they should only have one or two rows.
~/.vim/ftplugin/files in this directory are somewhat different. When Vim sets a value to the buffer's filetype, vim will find and filetype files of the same name in the ~/.vim/ftplugin/directory. For example, after you run the Set FILETYPE=DERP command, VIM will look for ~/.vim/ftplugin/derp.vim this file and run it if it exists. Not only that, it will also run all the files in subdirectories of the same name under Ftplugin, such as ~/.vim/ftplugin/derp/files under this folder will be run. The local buffering option should be set for different file types each time it is enabled, and all open buffers will be overwritten if the global buffering option is set.
~/.vim/indent/the files in this file are similar to those in the ftplugin, and they are loaded according to their names. It places the indentation of the relevant file type. such as how Python should be indented, how Java should be indented, and so on. In fact, in the Ftplugin can also be, but listed alone just for the convenience of document management and understanding.
~/.vim/compiler/and indent are like, it puts the option of how the corresponding file type should be compiled.
~/.vim/after/This file will also be loaded at vim each time it is started, but wait for the ~/.vim/plugin/load to complete before loading after content, so called after.
~/.vim/autoload/It is a very important directory, although it sounds more complicated than it really is. In short, it is placed in a file that is automatically loaded when you really need it, rather than when the vim starts.
~/.vim/doc/Place the document for the plugin. For example: can be used when help.
~/.vim/spell/the spelling checker script.
The ~/.vim/syntax/syntax describes the script.
Vim Directory Description