modified structure
This commit is contained in:
95
README.md
95
README.md
@@ -1,94 +1 @@
|
|||||||
# Neovim Configuration
|
TODO
|
||||||
|
|
||||||
Bienvenue dans ma configuration Neovim ! Ce dépôt contient tous les fichiers nécessaires pour avoir un environnement Neovim moderne, rapide et productif, avec des plugins pour le développement, la navigation et l’autocomplétion.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Table des matières
|
|
||||||
|
|
||||||
* [Installation](#installation)
|
|
||||||
* [Structure](#structure)
|
|
||||||
* [Plugins](#plugins)
|
|
||||||
* [Mappings](#mappings)
|
|
||||||
* [Licence](#licence)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
1. Clone ce dépôt dans ton répertoire de configuration Neovim (\~/.config/nvim) :
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://git.ghirardiv.fr/valentin/neovim-config.git ~/.config/nvim
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Installe [Neovim](https://neovim.io) si ce n'est pas déjà fait.
|
|
||||||
3. Lance Neovim et l'installation des plugins devrait se lancer automatiquement.
|
|
||||||
4. Code !
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Structure
|
|
||||||
|
|
||||||
```text
|
|
||||||
~/.config/nvim/
|
|
||||||
├── init.lua # Script d'initialisation
|
|
||||||
└── lua/
|
|
||||||
├── options.lua # Configuration des options générales
|
|
||||||
├── mappings.lua # Configuration des raccourcis clavier généraux
|
|
||||||
├── plugins.lua # Chargement des plugins
|
|
||||||
└── plugins/ # Configurations individuelles des plugins
|
|
||||||
├── catpuccin.lua
|
|
||||||
├── nvim-tree.lua
|
|
||||||
├── telescope.lua
|
|
||||||
├── lualine.lua
|
|
||||||
└── nvim-treesitter.lua
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Plugins
|
|
||||||
|
|
||||||
### 1. [catppuccin](https://github.com/catppuccin/nvim)
|
|
||||||
|
|
||||||
* **Description** : Personnalisation du thème
|
|
||||||
|
|
||||||
### 2. [nvim-tree](https://github.com/nvim-tree/nvim-tree.lua)
|
|
||||||
|
|
||||||
* **Description** : Explorateur de fichiers
|
|
||||||
* **Mappings** :
|
|
||||||
|
|
||||||
* `<leader>e` → Ouvrir/fermer l'explorateur de fichiers
|
|
||||||
|
|
||||||
### 3. [telescope](https://github.com/nvim-telescope/telescope.nvim)
|
|
||||||
|
|
||||||
* **Description** : Moteur de recherche de fichiers et de texte
|
|
||||||
* **Mappings** :
|
|
||||||
|
|
||||||
* `<leader>f` → Ouvrir la recherche de fichiers
|
|
||||||
* `<leader>g` → Ouvrir la recherche textuelle
|
|
||||||
|
|
||||||
### 4. [lualine](https://github.com/nvim-lualine/lualine.nvim)
|
|
||||||
|
|
||||||
* **Description** : Barre de status
|
|
||||||
|
|
||||||
### 5. [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
|
|
||||||
|
|
||||||
* **Description** : Analyseur de code
|
|
||||||
* **Mappings** :
|
|
||||||
|
|
||||||
* `<CS>` → Commencer/agrandir la sélection syntaxique
|
|
||||||
* `<BS>` → Réduire la sélection syntaxique
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Mappings
|
|
||||||
|
|
||||||
* `<C-z>` → Annuler la dernière modification
|
|
||||||
* `<C-y>` → Rétablir la dernière modification
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Licence
|
|
||||||
|
|
||||||
MIT License © [GHIRARDI Valentin](https://git.ghirardiv.fr/valentin/neovim-config)
|
|
||||||
|
|||||||
22
init.lua
22
init.lua
@@ -1,20 +1,2 @@
|
|||||||
require("options")
|
require("core.vim")
|
||||||
require("mappings")
|
require("core.plugin_loader")
|
||||||
|
|
||||||
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",
|
|
||||||
lazypath,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.opt.rtp:prepend(lazypath)
|
|
||||||
|
|
||||||
local plugins = require("plugins")
|
|
||||||
|
|
||||||
require("lazy").setup(plugins)
|
|
||||||
|
|||||||
90
lua/config.lua
Normal file
90
lua/config.lua
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
return {
|
||||||
|
vim = {
|
||||||
|
options = {
|
||||||
|
-- Define leader character
|
||||||
|
leader = " ",
|
||||||
|
|
||||||
|
-- Define tab size
|
||||||
|
tab_size = 4,
|
||||||
|
|
||||||
|
line_numbers = {
|
||||||
|
-- Enable line numbers
|
||||||
|
enabled = true,
|
||||||
|
|
||||||
|
-- Set relative line numbers
|
||||||
|
relative = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
mappings = {
|
||||||
|
-- Undo last edit (insert)
|
||||||
|
undo = "<C-z>",
|
||||||
|
|
||||||
|
-- Redo last edit (insert)
|
||||||
|
redo = "<C-y>"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
plugins = {
|
||||||
|
catppuccin = {
|
||||||
|
-- Enable catppuccin
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
nvim_tree = {
|
||||||
|
-- Enable nvim-tree
|
||||||
|
enabled = true,
|
||||||
|
|
||||||
|
mappings = {
|
||||||
|
-- Toggle file explorer (normal)
|
||||||
|
toggle_file_explorer = "<leader>e"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
telescope = {
|
||||||
|
-- Enable telescope
|
||||||
|
enabled = true,
|
||||||
|
|
||||||
|
mappings = {
|
||||||
|
-- Open file finder (normal)
|
||||||
|
open_file_finder = "<leader>f",
|
||||||
|
|
||||||
|
-- Open text finder (normal)
|
||||||
|
open_text_finder = "<leader>g"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
lualine = {
|
||||||
|
-- Enable lualine
|
||||||
|
enabled = true
|
||||||
|
},
|
||||||
|
|
||||||
|
nvim_treesitter = {
|
||||||
|
-- Enable nvim-treesitter
|
||||||
|
enabled = true,
|
||||||
|
|
||||||
|
options = {
|
||||||
|
parsers = {
|
||||||
|
"angular", "asm", "bash", "c", "c_sharp", "cmake",
|
||||||
|
"cpp", "css", "csv", "dockerfile", "gitignore", "go",
|
||||||
|
"groovy", "html", "htmldjango", "http", "java", "javascript",
|
||||||
|
"json", "kotlin", "lua", "make", "markdown", "nginx",
|
||||||
|
"ocaml", "odin", "pascal", "php", "powershell", "python",
|
||||||
|
"ruby", "rust", "scala", "sql", "toml", "tsx",
|
||||||
|
"twig", "typescript", "vim", "vue", "xml", "yaml"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
mappings = {
|
||||||
|
-- Start incremental selection (normal/visual)
|
||||||
|
start_selection = "<CR>",
|
||||||
|
|
||||||
|
-- Increment incremental selection (visual)
|
||||||
|
increment_selection = "<CR>",
|
||||||
|
|
||||||
|
-- Decrement incremental selection (visual)
|
||||||
|
decrement_selection = "<BS>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
30
lua/core/plugin_loader.lua
Normal file
30
lua/core/plugin_loader.lua
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
local config = require("config").plugins
|
||||||
|
|
||||||
|
-- Plugin loader
|
||||||
|
|
||||||
|
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",
|
||||||
|
lazypath,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
-- Plugins
|
||||||
|
|
||||||
|
local plugins = {}
|
||||||
|
|
||||||
|
for name, info in pairs(config) do
|
||||||
|
if info.enabled then
|
||||||
|
local plugin = require("core.plugins." .. name)
|
||||||
|
table.insert(plugins, plugin)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
require("lazy").setup(plugins)
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
|
local config = require("config").plugins.nvim_tree
|
||||||
|
local mappings = config.mappings
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"nvim-tree/nvim-tree.lua",
|
"nvim-tree/nvim-tree.lua",
|
||||||
|
|
||||||
@@ -41,8 +44,7 @@ return {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Ouvrir/fermer l'explorateur de fichiers
|
vim.keymap.set("n", mappings.toggle_file_explorer, ":NvimTreeToggle<CR>", {
|
||||||
vim.keymap.set("n", "<leader>e", ":NvimTreeToggle<CR>", {
|
|
||||||
desc = "Toggle file explorer",
|
desc = "Toggle file explorer",
|
||||||
noremap = true,
|
noremap = true,
|
||||||
silent = true
|
silent = true
|
||||||
34
lua/core/plugins/nvim_treesitter.lua
Normal file
34
lua/core/plugins/nvim_treesitter.lua
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
local config = require("config").plugins.nvim_treesitter
|
||||||
|
local options = config.options
|
||||||
|
local mappings = config.mappings
|
||||||
|
|
||||||
|
return {
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
|
||||||
|
build = ":TSUpdate",
|
||||||
|
|
||||||
|
config = function()
|
||||||
|
local nvim_treesitter_configs = require("nvim-treesitter.configs")
|
||||||
|
|
||||||
|
nvim_treesitter_configs.setup({
|
||||||
|
ensure_installed = options.parsers,
|
||||||
|
|
||||||
|
highlight = {
|
||||||
|
enable = true
|
||||||
|
},
|
||||||
|
|
||||||
|
indent = {
|
||||||
|
enable = true
|
||||||
|
},
|
||||||
|
|
||||||
|
incremental_selection = {
|
||||||
|
enable = true,
|
||||||
|
keymaps = {
|
||||||
|
init_selection = mappings.start_selection,
|
||||||
|
node_incremental = mappings.increment_selection,
|
||||||
|
node_decremental = mappings.decrement_selection
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
}
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
|
local config = require("config").plugins.telescope
|
||||||
|
local mappings = config.mappings
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
|
|
||||||
@@ -16,16 +19,14 @@ return {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Ouvrir la recherche de fichiers
|
vim.keymap.set("n", mappings.open_file_finder, telescope_builtin.find_files, {
|
||||||
vim.keymap.set("n", "<leader>f", telescope_builtin.find_files, {
|
desc = "Open file finder",
|
||||||
desc = "Find files",
|
|
||||||
noremap = true,
|
noremap = true,
|
||||||
silent = true
|
silent = true
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Ouvrir la recherche textuelle
|
vim.keymap.set("n", mappings.open_text_finder, telescope_builtin.live_grep, {
|
||||||
vim.keymap.set("n", "<leader>g", telescope_builtin.live_grep, {
|
desc = "Open text finder",
|
||||||
desc = "Live grep",
|
|
||||||
noremap = true,
|
noremap = true,
|
||||||
silent = true
|
silent = true
|
||||||
})
|
})
|
||||||
33
lua/core/vim.lua
Normal file
33
lua/core/vim.lua
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
local config = require("config").vim
|
||||||
|
|
||||||
|
-- Options
|
||||||
|
|
||||||
|
local options = config.options
|
||||||
|
|
||||||
|
vim.opt.guicursor = ""
|
||||||
|
|
||||||
|
vim.opt.number = options.line_numbers.enabled
|
||||||
|
vim.opt.relativenumber = options.line_numbers.relative
|
||||||
|
|
||||||
|
vim.opt.shiftwidth = options.tab_size
|
||||||
|
|
||||||
|
vim.g.mapleader = options.leader
|
||||||
|
vim.g.maplocalleader = options.leader
|
||||||
|
|
||||||
|
vim.opt.clipboard = "unnamedplus"
|
||||||
|
|
||||||
|
-- Mappings
|
||||||
|
|
||||||
|
local mappings = config.mappings
|
||||||
|
|
||||||
|
vim.keymap.set("i", mappings.undo, "<C-o>:undo<CR>", {
|
||||||
|
desc = "Undo last edit",
|
||||||
|
noremap = true,
|
||||||
|
silent = true
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.keymap.set("i", mappings.redo, "<C-o>:redo<CR>", {
|
||||||
|
desc = "Redo last edit",
|
||||||
|
noremap = true,
|
||||||
|
silent = true
|
||||||
|
})
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
-- Annuler la dernière modification
|
|
||||||
vim.keymap.set("i", "<C-z>", "<C-o>:undo<CR>", {
|
|
||||||
desc = "Undo last edit",
|
|
||||||
noremap = true,
|
|
||||||
silent = true
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Rétablir la dernière modification
|
|
||||||
vim.keymap.set("i", "<C-y>", "<C-o>:redo<CR>", {
|
|
||||||
desc = "Redo last edit",
|
|
||||||
noremap = true,
|
|
||||||
silent = true
|
|
||||||
})
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
-- Désactiver le changement de curseur
|
|
||||||
vim.opt.guicursor = ""
|
|
||||||
|
|
||||||
-- Activer les numéros de ligne
|
|
||||||
vim.opt.number = true
|
|
||||||
-- Désactiver les numéros de ligne relatifs
|
|
||||||
vim.opt.relativenumber = false
|
|
||||||
|
|
||||||
-- Définir la taille du tab à 4
|
|
||||||
vim.opt.shiftwidth = 4
|
|
||||||
|
|
||||||
-- Définir le leader à espace
|
|
||||||
vim.g.mapleader = " "
|
|
||||||
vim.g.maplocalleader = " "
|
|
||||||
|
|
||||||
-- Activer le presse-papier système
|
|
||||||
vim.opt.clipboard = "unnamedplus"
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
return {
|
|
||||||
require("plugins.catppuccin"),
|
|
||||||
require("plugins.nvim-tree"),
|
|
||||||
require("plugins.telescope"),
|
|
||||||
require("plugins.lualine"),
|
|
||||||
require("plugins.nvim-treesitter")
|
|
||||||
}
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
return {
|
|
||||||
"nvim-treesitter/nvim-treesitter",
|
|
||||||
|
|
||||||
build = ":TSUpdate",
|
|
||||||
|
|
||||||
config = function()
|
|
||||||
local nvim_treesitter_configs = require("nvim-treesitter.configs")
|
|
||||||
|
|
||||||
nvim_treesitter_configs.setup({
|
|
||||||
ensure_installed = {
|
|
||||||
"angular",
|
|
||||||
"asm",
|
|
||||||
"bash",
|
|
||||||
"c",
|
|
||||||
"c_sharp",
|
|
||||||
"cmake",
|
|
||||||
"cpp",
|
|
||||||
"css",
|
|
||||||
"csv",
|
|
||||||
"dockerfile",
|
|
||||||
"gitignore",
|
|
||||||
"go",
|
|
||||||
"groovy",
|
|
||||||
"html",
|
|
||||||
"htmldjango",
|
|
||||||
"http",
|
|
||||||
"java",
|
|
||||||
"javascript",
|
|
||||||
"json",
|
|
||||||
"kotlin",
|
|
||||||
"lua",
|
|
||||||
"make",
|
|
||||||
"markdown",
|
|
||||||
"nginx",
|
|
||||||
"ocaml",
|
|
||||||
"odin",
|
|
||||||
"pascal",
|
|
||||||
"php",
|
|
||||||
"powershell",
|
|
||||||
"python",
|
|
||||||
"ruby",
|
|
||||||
"rust",
|
|
||||||
"scala",
|
|
||||||
"sql",
|
|
||||||
"toml",
|
|
||||||
"tsx",
|
|
||||||
"twig",
|
|
||||||
"typescript",
|
|
||||||
"vim",
|
|
||||||
"vue",
|
|
||||||
"xml",
|
|
||||||
"yaml"
|
|
||||||
},
|
|
||||||
|
|
||||||
highlight = {
|
|
||||||
enable = true
|
|
||||||
},
|
|
||||||
|
|
||||||
indent = {
|
|
||||||
enable = true
|
|
||||||
},
|
|
||||||
|
|
||||||
incremental_selection = {
|
|
||||||
enable = true,
|
|
||||||
keymaps = {
|
|
||||||
init_selection = "<CR>", -- Commencer la sélection syntaxique
|
|
||||||
node_incremental = "<CR>", -- Agrandir la sélection syntaxique
|
|
||||||
node_decremental = "<BS>" -- Réduire la sélection syntaxique
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user