How do I install a plugin in Vim/vi?

  • How do I install a plugin in Vim?

    Does it matter:

    • Whether I use vi or Vim?
    • Whether I use gVim?
    • Which version of Vim I'm using?
    • What my OS is?
  • muru

    muru Correct answer

    6 years ago

    To install a plugin, we need to know what form it comes in. It can be:

    A single .vim file is supposed to be placed in the .vim/plugin directory.

    A Vimball file can be installed by opening it in Vim and running :source %.

    A set of files in the standard directory layout can be installed either by copying them to .vim, or using a plugin package manager.

    Plugins may depend on certain features. Therefore:

    • It may matter if you're using Vi or Vim,
    • It may matter if you're using gVim or not (gVim typically has more features enabled at compile time than Vim on the same distribution).
    • It may matter which version of Vim you're on, since a feature may have been added after your version of Vim.
    • It may matter which OS you're on, especially if the plugin calls in external commands.

    For most plugins, though, it may not matter.

    It definitely matters if you're using Vi -- the concept of plugins doesn't exist for Vi. Of course, typing `vi` on any modern box will probably just launch `vim` with some features turned off. I doubt many people have access to *actual* Vi these days.

License under CC-BY-SA with attribution


Content dated before 6/26/2020 9:53 AM