Home

Awesome

miv

CI Status Hackage Release MIT License

Vim plugin manager written in Haskell

The miv is a command line tool for managing Vim plugins with a single YAML configuration file. The motivation of this tool is

Installation

Homebrew

brew install itchyny/tap/miv

Build with stack

git clone https://github.com/itchyny/miv.git && cd miv && stack install

User guide

  1. Add the miv plugin path to runtimepath in your .vimrc.
  2. Create miv configuration file at ~/.vimrc.yaml. (or ~/.vim/.vimrc.yaml, $XDG_CONFIG_HOME/miv/config.yaml)
  3. Execute miv install.

Example vimrc:

filetype off
if has('vim_starting')
  set rtp^=~/.vim/miv/miv
  " or when you set $XDG_DATA_HOME,
  " set rtp^=$XDG_DATA_HOME/miv/miv
endif
filetype plugin indent on

Example miv configuration file (refer to .vimrc.yaml for how the author configures):

plugin:

  Align:
    command: Align

  itchyny/lightline.vim:
    before: |
      let g:lightline = {
            \   'colorscheme': 'wombat',
            \ }

  itchyny/calendar.vim:
    mapleader: ","
    command: Calendar
    mapping: <Plug>(calendar)
    script: |
      nmap <Leader>z <Plug>(calendar)
    before: |
      let g:calendar_views = [ 'year', 'month', 'day_3', 'clock' ]

  prabirshrestha/vim-lsp:
    before: |
      let g:lsp_async_completion = 1
      let g:lsp_text_edit_enabled = 0
      let g:lsp_signs_enabled = 0
      augroup lsp_install
        autocmd!
        autocmd User lsp_buffer_enabled setlocal omnifunc=lsp#complete
      augroup END

  prabirshrestha/asyncomplete.vim: {}

  prabirshrestha/asyncomplete-lsp.vim:
    dependon: asyncomplete

  prabirshrestha/asyncomplete-buffer.vim:
    dependon: asyncomplete
    after: |
      call asyncomplete#register_source(asyncomplete#sources#buffer#get_source_options({
          \ 'name': 'buffer',
          \ 'whitelist': ['*'],
          \ 'completor': function('asyncomplete#sources#buffer#completor'),
          \ 'config': {
          \    'max_buffer_size': 100000,
          \  },
          \ }))

  prabirshrestha/asyncomplete-file.vim:
    dependon: asyncomplete
    after: |
      call asyncomplete#register_source(asyncomplete#sources#file#get_source_options({
          \ 'name': 'file',
          \ 'whitelist': ['*'],
          \ 'completor': function('asyncomplete#sources#file#completor'),
          \ }))

  mattn/vim-lsp-settings:
    dependon: lsp

  mattn/emmet-vim:
    filetype:
      - html
      - css
    before: |
      let g:user_emmet_settings = { 'indentation' : '  ' }
    after: |
      autocmd FileType html,css imap <buffer> <tab> <plug>(emmet-expand-abbr)

  elzr/vim-json:
    filetype: json

  cespare/vim-toml:
    filetype: toml

  groenewege/vim-less:
    filetype: less

  tpope/vim-haml:
    filetype: haml

  jade.vim:
    filetype: jade

  kana/vim-textobj-user: {}

  kana/vim-textobj-entire:
    dependon: textobj-user
    mapmode:
      - o
      - v
    mapping:
      - <Plug>(textobj-entire-a)
      - <Plug>(textobj-entire-i)
      - ie
      - ae

  kana/vim-textobj-line:
    dependon: textobj-user
    mapmode:
      - o
      - v
    mapping:
      - <Plug>(textobj-line-a)
      - <Plug>(textobj-line-i)
      - il
      - al

before: |
  let g:is_bash = 1
  let g:loaded_2html_plugin = 1
  let g:loaded_rrhelper = 1

after: |
  let g:mapleader = ','

filetype:
  vim: |
    setlocal foldmethod=marker
  css: |
    setlocal iskeyword=37,45,48-57,95,a-z,A-Z,192-255
  make: |
    setlocal noexpandtab
  sh: |
    setlocal iskeyword=36,45,48-57,64,95,a-z,A-Z,192-255

miv subcommands

The miv command has the following subcommands.

commanddescription
installInstalls all the plugins.
updateUpdates the plugins (outdated plugins are skipped).
update!Updates all the plugins.
update [plugins]Updates the specified plugins.
cleanRemoves unused directories and files.
generateGenerates the miv plugin files. (miv install and miv update automatically do this task)
ftdetectGather ftdetect scripts. (miv install and miv update automatically do this task)
helptagsGenerates the helptags file. (miv install and miv update automatically do this task)
listLists all the plugins.
editEdits the miv config file.
commandLists the subcommands of miv.
path [plugins]Prints the paths of the plugins.
each [commands]Executes the commands each directory of the plugins. For example, you can execute miv each pwd or miv each git gc.
helpShows the help of miv.
versionShows the version of miv.

Commands to execute when you want to

do whatcommand
install a new pluginmiv edit, update the configuration file, save, exit the editor and miv install
update the installed plugins but skip outdated pluginsmiv update
update all the installed pluginsmiv update!
update specific pluginsmiv update [plugin1] [plugin2]..
uninstall a pluginmiv edit, remove the related configurations, miv generate (and miv clean if you want)
list all the pluginsmiv list
count the number of plugins<code>miv list | wc -l</code>
change the current working directory to a plugin directorycd "$(miv path [plugin])"
want a helpmiv help

Plugin configuration

Loading triggers for the plugin

keytypedescription
filetype<code>string | string[]</code>load the plugin on setting the filetype
command<code>string | string[]</code>load the plugin on invoking the command
function<code>string | string[]</code>load the plugin on calling a function matching the value in regex
mapping<code>string | string[]</code>load the plugin on the mapping
mapmode<code>'n' | 'v' | 'x' | 's' | 'i' | 'c' | 'l' | 'o' | 't'</code>specify the map-modes for the mapping configuration
cmdline<code>':' | '/' | '?' | '@'</code>the command-line character to load the plugin
insertbooleanload the plugin on entering the insert mode for the first time

Configurations for the plugin

keytypedescription
scriptstringscript run on startup, specify some configurations or mappings to load the plugin
afterstringscript run after the plugin is loaded
beforestringscript run just before the plugin is loaded
mapleaderstringthe mapleader (<Leader>) for the script

Dependency configurations

keytypedescription
dependon<code>string | string[]</code>plugins on which the plugin depends; they are loaded just before the plugin is loaded
dependedby<code>string | string[]</code>(deprecated in favor of loadafter) plugins loaded just after the plugin is loaded
loadbefore<code>string | string[]</code>indicates lazy loading, the plugin is loaded just before any of the configured plugins
loadafter<code>string | string[]</code>indicates lazy loading, the plugin is loaded just after any of the configured plugins

Other miscellaneous configurations

keytypedescription
enablestringenable the plugin when the expression (in Vim script) is truthy
submodulebooleanpull the submodules of the repository
buildstringbuild shell script to execute after installing and updating
syncbooleanskip pulling the repository if the value is false

Author

itchyny (https://github.com/itchyny)

License

This software is released under the MIT License, see LICENSE.