sponsor Vim development Vim logo Vim Book Ad

tplugin : A plugin loader/runtimepath manager with autoload capabilities

 script karma  Rating 11/4, Downloaded by 4565  Comments, bugs, improvements  Vim wiki

created by
Tom Link
script type
tplugin is a plugin management tool similar to pathogen. Other than
pathogen tplugin expands the 'runtimepath' as needed (e.g. when
calling a command or function that is defined in a bundle) in order to
have minimal impact on startup time.

This plugin helps users to deal with plugins that are distributed via
source code repositories. Usually, you would make those plugins
available to vim by adding the local copies of those repositories to
|runtimepath|. The disadvantage of this approach is that the value of
|runtimepath| becomes unnecessarily complex and that the plugins are
loaded on startup.

tplugin scans those plugins for commands and functions. It then amends
the |runtimepath| only if a respective command/function/map is called
(similar to the AsNeeded plugin). This helps to keep your |runtimepath|
simple and to improve startup time.

In order to achieve this goal, plugins are installed in an alternative
directory structure where each plugin (consequently referred to as
"repo") is installed in a subdirectory. tplugin takes care of modifying
'runtimepath' and of loading the vim script files as necessary.

Alternative directory layout:


Repos can be enabled (i.e. added to 'runtimepath') either explicitly
with the |:TPlugin| command or automatically by calling a command,
function, or by requesting a filetype plugin/syntax/indent file defined
in a repo -- this is done similar to how AsNeeded autoloads files.

Full docs:
install details
Edit the vba file and type: >

    :so %

See :help vimball for details. If you have difficulties or use vim 7.0,
please make sure, you have the current version of vimball
(vimscript #1502) installed or update your runtime.

Getting started:

    1. Add this to your vimrc file:

        runtime macros/tplugin.vim
        " Only necessary if you use a non-standard root directory
        TPluginRoot /home/x/src/repos

    2. Install your plugins/repos in the root directory.

    3. After restarting vim, type :TPluginScan!

Also available as git repository:

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
tplugin.vba 1.00 2012-11-22 7.0 Tom Link - Don't try to run :helptags on directories with no text files
- g:tplugin#show_helptags_errors: If true, show errors when running :helptags.
- Support for extradite
- TPluginVimEnter(): :do VimEnter commands only if such autocommands are defined
- Make sure to register repos with no plugin file
- Autoload: Ignore E121 errors (local variables) and echo v:exception on errors
- g:tplugin#show_helptags_errors: If true, show errors when running helptags
MD5 checksum: 7c454f3a1f0a380743d5dcb39cfae912
tplugin.vba 0.14 2012-01-21 7.0 Tom Link - TPluginRegisterPlugin works again
- TPluginRoot!: With bang, mark this root for shallow scans
- Speed up scanning of "shallow roots"
MD5 checksum: fba3e4a4fad872e074f76dd3988c2cb3
tplugin.vba 0.13 2011-12-17 7.0 Tom Link - Fix message when rescanning roots due to outdated meta files; rescan only once
MD5 checksum: 395629f472fea537b25cfb12ae01f829
tplugin.vba 0.12 2011-05-26 7.0 Tom Link - Run helptags with silent!
- vcsdo: Finalize the name of the log buffer as script-local variable
- Experimental support for <VIMPLUGIN> tags used in vx* plugins.
- .gitignore
- Experimental support for parsing *-addon-info.txt and simpler dependency management
- s:AutoloadFunction(): Properly support autoload funcs in subdirectories
- &rtp wasn't properly updated in certain situations
- Experimental: Scan sources for VimEnter autocommands
- autoload/tplugin/vcscommand: Adapt to new arguments
- FIX: scanning of autocmds: Don't use \k
- autoload/tplugin/fugitive: Don't call #fugitive_utility#VimEnter
- SetRoot(): Use inputdialog() to display "Rescanning roots: Please be patient" message
- TPluginRequire: Remove check for s:done[rootrepo] (over-optimization)
- s:TPluginComplete(): show all known repos as completion candidates
MD5 checksum: 8ff9f5f7c97d3e306bb543a60cf16271
tplugin.vba 0.11 2010-11-01 7.0 Tom Link Please see http://github.com/tomtom/tplugin_vim/commits/master/
tplugin.vba 0.10 2010-10-02 7.0 Tom Link - Make helptags of repositories that weren't yet loaded available to the user.
- Renamed variables: g:tplugin#autoload_exclude, g:tplugin#scan
- Custom autoload definitions for some 3rd party plugins (PoC)
tplugin.vba 0.9 2010-08-24 7.0 Tom Link - Renamed #TPluginInclude to @TPluginInclude
- Added support for @TPluginMap, @TPluginBefore, @TPluginAfter annotations
- TPluginMap() restores the proper mode
- Load after/autoload/* files
- ...
tplugin.vba 0.8 2010-04-14 7.0 Tom Link - Delete commands only when they were defined without a bang; make sure all commands in a file defined without a bang are deleted
- g:tplugin_scan defaults to 'cfpt'
- Don't register each autoload function but deduce the repo/plugin from the prefix.
- g:tplugin_scan defaults to 'cfpta'
- TPluginCommand and TPluginFunction are functions. Removed the commands with the same name.
- #TPluginInclude tag
tplugin.vba.gz 0.7 2010-02-20 7.0 Tom Link - TPluginScan: try to maintain information about command-line completion (this won't work if a custom script-local completion function is used)
tplugin.vba.gz 0.6 2010-02-16 7.0 Tom Link - CHANGE: The root specific autoload files are now called '_tplugin.vim'
- Provide a poor-man implementation of fnameescape() for users of older versions of vim.
- If the root name ends with '*', the root is no directory tree but a single directory (actually a plugin repo)
- s:TPluginComplete(): Hide tplugin autoload files.
tplugin.vba.gz 0.5 2010-02-02 7.0 Tom Link - Support for ftdetect
- Support for ftplugins in directories and named {&FT}_{NAME}.vim
- :TPlugin accepts "-" as argument, which means load "NO PLUGIN".
- :TPluginScan: don't use full filenames as arguments for TPluginFiletype()
- FIX: Concatenation of filetype-related files
- FIX: Don't add autoload files to the menu.
- FIX: Don't load any plugins when autoloading an "autoload function"
- FIX: Filetype-related problems
- FIX: s:ScanLine: Don't create duplicate autoload commands.
- FIX: s:ScanRoots(): Remove empty entries from filelist
- g:tplugin_autoload_exclude: Exclude repos from autoloading
- If g:tplugin_autoload == 2, run |:TPluginScan| after updating tplugin.
- Moved autoload functions to macros/tplugin.vim -- users have to rescan their repos.
- Per repo metadata (ROOT/REPO/tplugin.vim)
- Relaxed the rx for functions
- Replaced :TPluginMap with a function TPluginMap()
- Speed up :TPluginScan (s:ScanRoots(): run glob() only once, filter file contents before passing it to s:ScanSource())
- TPluginMap(): Don't map keys if the key already is mapped (via maparg())
tplugin.vba.gz 0.3 2010-01-19 7.0 Tom Link - TPluginBefore, TPluginAfter commands to define inter-repo dependencies
- Support for autoloading filetypes
- Support for autoloading <plug> maps
- Build helptags during :TPluginScan (i.e. support for helptags requires
autoload to be enabled) - Call delcommand before autoloading a plugin because of an unknown command
- TPluginScan: Take a root directory as the second optional argument
- The autoload file was renamed to ROOT/tplugin.vim
- When adding a repository to &rtp, ROOT/tplugin_REPO.vim is loaded
tplugin.vba.gz 0.2 2010-01-10 7.0 Tom Link - Experimental autoload for commands and functions (à la AsNeeded)
- Improved command-line completion for :TPlugin
- The after path is inserted at the second to last position
- When autoload is enabled and g:tplugin_menu_prefix is not empty, build a menu with available plugins (NOTE: this is disabled by default)
tplugin.vba.gz 0.1 2010-01-05 7.0 Tom Link Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
Vim at Github