-
Notifications
You must be signed in to change notification settings - Fork 3
Folder and File Structure
~/.config/nvim
│
├── lua # LUA FOLDER
│ ├── core
│ │ ├── autocommands.lua # File to store all the autocommands
│ │ ├── usercommands.lua # File to store all the usercommands
│ │ ├── keymaps.lua # Keybindings
│ │ └── options.lua # All Neovim options
│ └── plugins
│ ├── lsp # LSP RELATED PLUGINS FOLDER
│ │ ├── lsp-config.lua # nvim-lspconfig
│ │ └── other-lsp-plugins.lua # Other lsp related plugins
│ ├── init.lua # Many plugins in one file
│ ├── plugin_1.lua # One or more plugins in one file
│ ├── plugin_2.lua # One or more plugins in one file
│ ├── **
│ └── plugin_xx.lua
├── snippets
│ ├── javaspript.lua # JavaScript snippets
│ └── lua.lua # Lua snippets
├── ftplugin
│ └── java.lua # Java configuration
└── init.lua # Main file
Main file is init.lua
in the root directory.
In this file is the code to bootstrap lazy.nvim.
- Boottrap lazy.nvim
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable', -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
vim.g.mapleader = ','
vim.g.maplocalleader = ','
require('core.options')
require('core.keymaps')
require('core.autocommands')
require('core.usercommands')
local opts = {}
require('lazy').setup('plugins', opts)
The mapleader
and the localmapleader
have to be set before lazy.nvim load all the plugins.
If you want, you can to change the leader key
it in this file.
vim.g.mapleader = ','
vim.g.maplocalleader = ','
require('lazy').setup('plugins', opts)
In this folder are the core options and settings for Neovim, like autocommands, usercommands, keymaps and options.
The files in this folder has to be required in the ./init.lua
file.
Again, before lazy.nvim loads the plugins.
require('core.options')
require('core.keymaps')
require('core.autocommands')
require('core.usercommands')
require('lazy').setup('plugins', opts)
All the plugins come in this folder as .lua
files.
You can put your plugins all in one file (./lua/plugins/init.lua
) or create a new ./lua/plugins/<plugin_name>.lua
file in this directory with the plugin name.
Lazy.nvim loads every file in this directory.
Then you have to install the plugin with Lazy.nvim. Just open Lazy with the command :Lazy
and press I
to install the plugin.
Here are all the LSP related plugins, like nvim-lspconfig, trouble.nvim and more.
Lazy.nvim loads also every file in this directory, because of this option:
require('lazy').setup({ { import = 'plugins' }, { import = 'plugins.lsp' } }, opts)
Here are all the snippets for different filetypes, that CMP can load with LuaSnip.
See this great YouTube - Video how to use LuaSnip.
In this folder is the configuration file, to work with *.java
files in Neovim.