Skip to content

Plugins

Ilias Dougias edited this page May 10, 2024 · 9 revisions

Install a plugin

There are three ways to install a plugin.

First way to install a plugin

Go to ./lua/plugins/ folder and create a <plugin_name>.lua file, with the name of the plugin, like flash.lua.

Lazy.nvim loads every file in this directory and installs the plugins.

Example: ./lua/plugins/flash.lua

return {
    'folke/flash.nvim',
    event = 'VeryLazy',
    opts = {},
}

Then you have to open Lazy with the command :Lazy and press I to install the plugin, or reopen Neovim and lazy.nvim install the plugin automaticaly.

Second way to install a plugin

Keep all the plugins in one file. This is the ./lua/plugins/init.lua file.

Example: ./lua/plugins/init.lua

return {
    {
        "plugin-one",
        -- options ...
        -- plugin configuration ...
    },
    {
        "plugin-two",
        -- options ...
        -- plugin configuration ...
    },
    {
        "plugin-**",
        -- options ...
        -- plugin configuration ...
    },
}

Third way to install a plugin

Keep specific plugins in one file, like git.lua in the ./lua/plugins/ folder.

Example: ./lua/plugins/git.lua

return {
    {
        'sindrets/diffview.nvim',
        -- plugin options ...
        -- plugin configuration ...
    },
    {
        'lewis6991/gitsigns.nvim',
        -- plugin options ...
        -- plugin configuration ...
    },
    {
        'NeogitOrg/neogit',
        -- plugin options ...
        -- plugin configuration ...
    },
}

Uninstall a plugin

There are two ways to uninstall a plugin

First way to uninstall a plugin

Delete the the plugin file from the ./lua/plugins/ folder. Open lazy.nvim with the command :Lazy and press X.

Second way to uninstall a plugin

Add enabled = false in the plugin option.

Example:

return {
    {
        'rlane/pounce.nvim',
         enabled = false,
    },
}

Then open lazy.nvim with :Lazy and press X.