unzip /tmp/fancy.zip
< If the archive layout is different make sure that you end up with a
path like this:
~/.local/share/nvim/site/pack/fancy/start/fancytext/plugin/fancy.vim ~
Here "fancytext" is the name of the package, it can be anything
else.
Adding nohlsearch package *nohlsearch-install* *package-nohlsearch*
Load the plugin with this command: >
packadd nohlsearch
<
Automatically execute |:nohlsearch| after 'updatetime' or getting into
|Insert| mode.
Thus assuming default updatetime, hlsearch would be suspended/turned off after
4 seconds of idle time.
To disable the effect of the plugin after it has been loaded: >
au! nohlsearch
<
More information about packages can be found here: |packages|.
==============================================================================
*05.5* Adding a plugin *add-plugin* *plugin*
Vim's functionality can be extended by adding plugins. A plugin is nothing
more than a Vim script file that is loaded automatically when Vim starts. You
can add a plugin very easily by dropping it in your plugin directory.
There are two types of plugins:
global plugin: Used for all kinds of files
filetype plugin: Only used for a specific type of file
The global plugins will be discussed first, then the filetype ones
|add-filetype-plugin|.
GLOBAL PLUGINS *standard-plugin*
When you start Vim, it will automatically load a number of global plugins.
You don't have to do anything for this. They add functionality that most
people will want to use, but which was implemented as a Vim script instead of
being compiled into Vim. You can find them listed in the help index
|standard-plugin-list|. Also see |load-plugins|.
*add-global-plugin*
You can add a global plugin to add functionality that will always be present
when you use Vim. There are only two steps for adding a global plugin:
1. Get a copy of the plugin.
2. Drop it in the right directory.
GETTING A GLOBAL PLUGIN
Where can you find plugins?
- Some are always loaded, you can see them in the directory $VIMRUNTIME/plugin.
- Some come with Vim. You can find them in the directory $VIMRUNTIME/macros
and its sub-directories and under $VIM/vimfiles/pack/dist/opt/.
- Download from the net. There is a large collection on https://www.vim.org.
- They are sometimes posted in a Vim maillist.
- You could write one yourself, see |write-plugin|.
USING A GLOBAL PLUGIN
First read the text in the plugin itself to check for any special conditions.
Then copy the file to your plugin directory:
system plugin directory ~
Unix ~/.local/share/nvim/site/plugin
Example for Unix (assuming you didn't have a plugin directory yet): >
mkdir -p ~/.local/share/nvim/site/plugin
cp /tmp/yourplugin.vim ~/.local/share/nvim/site/plugin
That's all! Now you can use the commands defined in this plugin.
Instead of putting plugins directly into the plugin/ directory, you may
better organize them by putting them into subdirectories under plugin/.
As an example, consider using "~/.local/share/nvim/site/plugin/perl/*.vim" for
all your Perl plugins.
FILETYPE PLUGINS *add-filetype-plugin* *ftplugins*
The Vim distribution comes with a set of plugins for different filetypes that
you can start using with this command: >
:filetype plugin on
That's all! See |vimrc-filetype|.
If you are missing a plugin for a filetype you are using, or you found a
better one, you can add it. There are two steps for adding a filetype plugin:
1. Get a copy of the plugin.
2. Drop it in the right directory.
GETTING A FILETYPE PLUGIN
You can find them in the same places as the global plugins. Watch out if the
type of file is mentioned, then you know if the plugin is a global or a
filetype one. The scripts in $VIMRUNTIME/macros are global ones, the filetype
plugins are in $VIMRUNTIME/ftplugin.
USING A FILETYPE PLUGIN *ftplugin-name*
You can add a filetype plugin by dropping it in the right directory. The
name of this directory is in the same