Project structure - KingEdwardI/Neovide Wiki

This will be a description of the way that I've set up the folder structure and why. Subject to change as better structures are discovered.

- lua/                      -- This is just required by lua
  - [plugin folder]/        -- Separate different plugin configuration by folder
    - config.lua            -- Consistently named config file for the given plugin
    - keymap.lua            -- Consistently named keymap file for the given plugin
                               -- This must be separate from the config for lazy loaded 
                               -- plugins that are loaded when a command is executed
  - lsp/                    -- Separate folder for lsp, simple organization
    - config.lua            -- Contains the main on_attach method that is shared between lsps
    - lsp.lua               -- File to centralize all lsp imports
    - [lsp type].lua        -- Separate different lsp servers by file
  - colorscheme.lua
  - keymappings.lua         -- File to centralize all keymap imports
  - plugins.lua             -- This is where Packer is setup and all plugins are listed
  - settings.lua            -- General global options
  - utils.lua               -- Shared utils methods
- packer.nvim/
- plugin/
- init.lua

Plugins and their configs are in individual folders with either/both of config.lua and keymap.lua. The purpose of this is for lazy loading and error handling. In order for the config of each plugin to not throw an error if the plugin isn't installed, it must be required as a callback of the config key passed to the use function. The keymap cannot be part of the config for plugins that load on command execution or else the keymapping will not be available.