sponsor Vim development Vim logo Vim Book Ad

autopack : Load optional packs by command, map, filetype etc.

 script karma  Rating 5/2, Downloaded by 1617  Comments, bugs, improvements  Vim wiki

created by
Tom Link
 
script type
utility
 
description
VIM 8.0 introduced a new way to handle (optional) plugins via the
|:packload| command. This plugin aims at facilitating the handling of
optional packs by loading packs when certain triggers are invoked. The
goal of this approach is to reduce startup time without interferring
with your workflow.

A trigger could be
- Invocation of a command (see |:Autocommand|)
- Invocation of a map (see |:Automap|)
- Editing a file with a specific filetype (see |:Autofiletype|)
- Editing a file matching a specific file pattern (see
  |:Autofilepattern|)

How to use this plugin~
- Edit ~/.vim/packrc/autorc.vim
- Add autopack commands (|:Autocommand|, |:Automap|, |:Autofiletype|,
  |:Autofilepattern| as needed)
- "Filetype packs", i.e. packs matching `pack/ft_{FILETYPE}/opt/*` in
  you 'runtimepath' are automatically enabled when editing a file with
  the respective filetype
- Restart vim

Example autorc.vim file >
    Automap ttoc_vim nnoremap <Leader>cc :TToC<cr>
    Autocommand trag_vim Trag
    Autofiletype workbook_vim r
    Autofilepattern ttodo_vim *todo.txt *TODO.TX
 
install details
Either use the zip archive:
    - Download the zip archive
    - Extract it to `~/.vim/pack/tml/start/autopack`

or install from github:
    - Start a terminal
    - Change the working directory to `~/.vim/pack/tml/start/`
    - Type: `git clone https://github.com/tomtom/autopack_vim`

NOTE: If you don't want to run this plugin on startup, use
`~/.vim/pack/tml/opt/`.

NOTE: On Windows, ~/.vim might be ~/vimfiles. Please see 'runtimepath'
for details.

NOTE: If you want to have autopack-related commands available in your VIMRC
file or if you want to load packrc configuration files for packs in a
`start` subdirectory, you should move the plugin directory to
`pack/tml/opt/autopack_vim` instead and add `:packadd autopack_vim` to
your vimrc file.
 

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
autopack.zip 0.02 2017-05-02 7.0 Tom Link - Autocommand, autopack#NewAutocommand: Support for multiple commands
- g:autopack_config: Check for has('vim_starting')
- NEW :Automakeprelude command (collect ftdetect information)
- g:autopack#use_cmdundefined: Option to use the CmdUndefined event
- Make sure not to redefine auto-commands or maps
- autopack#NewFilepattern(): FIX only the last plugins per pattern was loaded
MD5 checksum: e0525313c600e33aebb5f6f81bdbc90b
autopack.zip 0.01 2017-02-14 8.0 Tom Link Initial upload
ip used for rating: 142.132.191.50

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