setup nvim-treesitter
This commit is contained in:
23
README.md
23
README.md
@@ -4,6 +4,8 @@ Bienvenue dans ma configuration Neovim ! Ce dépôt contient tous les fichiers n
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Table des matières
|
## Table des matières
|
||||||
|
|
||||||
* [Installation](#installation)
|
* [Installation](#installation)
|
||||||
@@ -14,6 +16,8 @@ Bienvenue dans ma configuration Neovim ! Ce dépôt contient tous les fichiers n
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
1. Clone ce dépôt dans ton répertoire de configuration Neovim (\~/.config/nvim) :
|
1. Clone ce dépôt dans ton répertoire de configuration Neovim (\~/.config/nvim) :
|
||||||
@@ -28,6 +32,8 @@ git clone https://git.ghirardiv.fr/valentin/neovim-config.git ~/.config/nvim
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Structure
|
## Structure
|
||||||
|
|
||||||
```text
|
```text
|
||||||
@@ -41,11 +47,14 @@ git clone https://git.ghirardiv.fr/valentin/neovim-config.git ~/.config/nvim
|
|||||||
├── catpuccin.lua
|
├── catpuccin.lua
|
||||||
├── nvim-tree.lua
|
├── nvim-tree.lua
|
||||||
├── telescope.lua
|
├── telescope.lua
|
||||||
└── lualine.lua
|
├── lualine.lua
|
||||||
|
└── nvim-treesitter.lua
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Plugins
|
## Plugins
|
||||||
|
|
||||||
### 1. [catppuccin](https://github.com/catppuccin/nvim)
|
### 1. [catppuccin](https://github.com/catppuccin/nvim)
|
||||||
@@ -71,8 +80,18 @@ git clone https://git.ghirardiv.fr/valentin/neovim-config.git ~/.config/nvim
|
|||||||
|
|
||||||
* **Description** : Barre de status
|
* **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
|
## Mappings
|
||||||
|
|
||||||
* `<C-z>` → Annuler la dernière modification
|
* `<C-z>` → Annuler la dernière modification
|
||||||
@@ -80,6 +99,8 @@ git clone https://git.ghirardiv.fr/valentin/neovim-config.git ~/.config/nvim
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Licence
|
## Licence
|
||||||
|
|
||||||
MIT License © [GHIRARDI Valentin](https://git.ghirardiv.fr/valentin/neovim-config)
|
MIT License © [GHIRARDI Valentin](https://git.ghirardiv.fr/valentin/neovim-config)
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
-- Control + z : Annuler la dernière modification
|
-- Annuler la dernière modification
|
||||||
vim.keymap.set("i", "<C-z>", "<C-o>:undo<CR>", {
|
vim.keymap.set("i", "<C-z>", "<C-o>:undo<CR>", {
|
||||||
desc = "Undo last edit",
|
desc = "Undo last edit",
|
||||||
noremap = true,
|
noremap = true,
|
||||||
silent = true
|
silent = true
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Control + y : Rétablir la dernière modification
|
-- Rétablir la dernière modification
|
||||||
vim.keymap.set("i", "<C-y>", "<C-o>:redo<CR>", {
|
vim.keymap.set("i", "<C-y>", "<C-o>:redo<CR>", {
|
||||||
desc = "Redo last edit",
|
desc = "Redo last edit",
|
||||||
noremap = true,
|
noremap = true,
|
||||||
|
|||||||
@@ -12,3 +12,6 @@ vim.opt.shiftwidth = 4
|
|||||||
-- Définir le leader à espace
|
-- Définir le leader à espace
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
vim.g.maplocalleader = " "
|
vim.g.maplocalleader = " "
|
||||||
|
|
||||||
|
-- Activer le presse-papier système
|
||||||
|
vim.opt.clipboard = "unnamedplus"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
return {
|
return {
|
||||||
require("plugins.catppuccin"),
|
require("plugins.catppuccin"),
|
||||||
require("plugins.lualine"),
|
|
||||||
require("plugins.nvim-tree"),
|
require("plugins.nvim-tree"),
|
||||||
require("plugins.telescope")
|
require("plugins.telescope"),
|
||||||
|
require("plugins.lualine"),
|
||||||
|
require("plugins.nvim-treesitter")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
return {
|
return {
|
||||||
"catppuccin/nvim",
|
"catppuccin/nvim",
|
||||||
|
|
||||||
config = function()
|
config = function()
|
||||||
require("catppuccin").setup({
|
local catppuccin = require("catppuccin")
|
||||||
|
|
||||||
|
catppuccin.setup({
|
||||||
flavour = "mocha",
|
flavour = "mocha",
|
||||||
transparant_background = true,
|
transparant_background = true,
|
||||||
show_end_of_buffer = true
|
show_end_of_buffer = true
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.cmd("colorscheme catppuccin")
|
vim.cmd("colorscheme catppuccin")
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
return {
|
return {
|
||||||
"nvim-lualine/lualine.nvim",
|
"nvim-lualine/lualine.nvim",
|
||||||
|
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{
|
{
|
||||||
"nvim-tree/nvim-web-devicons",
|
"nvim-tree/nvim-web-devicons",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
config = function()
|
config = function()
|
||||||
require("lualine").setup({
|
local lualine = require("lualine")
|
||||||
|
|
||||||
|
lualine.setup({
|
||||||
options = {
|
options = {
|
||||||
theme = "catppuccin"
|
theme = "catppuccin"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
return {
|
return {
|
||||||
"nvim-tree/nvim-tree.lua",
|
"nvim-tree/nvim-tree.lua",
|
||||||
|
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{
|
{
|
||||||
"nvim-tree/nvim-web-devicons",
|
"nvim-tree/nvim-web-devicons",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
config = function()
|
config = function()
|
||||||
vim.g.loaded_netrw = 1
|
vim.g.loaded_netrw = 1
|
||||||
vim.g.loaded_netrwPlugin = 1
|
vim.g.loaded_netrwPlugin = 1
|
||||||
@@ -16,25 +18,30 @@ return {
|
|||||||
width = 30,
|
width = 30,
|
||||||
side = "left"
|
side = "left"
|
||||||
},
|
},
|
||||||
|
|
||||||
git = {
|
git = {
|
||||||
enable = true
|
enable = true
|
||||||
},
|
},
|
||||||
|
|
||||||
renderer = {
|
renderer = {
|
||||||
highlight_git = true
|
highlight_git = true
|
||||||
},
|
},
|
||||||
|
|
||||||
filters = {
|
filters = {
|
||||||
dotfiles = false,
|
dotfiles = false,
|
||||||
custom = {
|
custom = {
|
||||||
".git"
|
".git"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
update_cwd = true,
|
update_cwd = true,
|
||||||
|
|
||||||
update_focused_file = {
|
update_focused_file = {
|
||||||
enable = true
|
enable = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Leader + e : Ouvrir/fermer l'explorateur de fichiers
|
-- Ouvrir/fermer l'explorateur de fichiers
|
||||||
vim.keymap.set("n", "<leader>e", ":NvimTreeToggle<CR>", {
|
vim.keymap.set("n", "<leader>e", ":NvimTreeToggle<CR>", {
|
||||||
desc = "Toggle file explorer",
|
desc = "Toggle file explorer",
|
||||||
noremap = true,
|
noremap = true,
|
||||||
|
|||||||
73
lua/plugins/nvim-treesitter.lua
Normal file
73
lua/plugins/nvim-treesitter.lua
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
return {
|
return {
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
|
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
},
|
},
|
||||||
|
|
||||||
config = function()
|
config = function()
|
||||||
local telescope = require("telescope")
|
local telescope = require("telescope")
|
||||||
local telescope_builtin = require("telescope.builtin")
|
local telescope_builtin = require("telescope.builtin")
|
||||||
@@ -14,14 +16,14 @@ return {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Leader + f : Ouvrir la recherche de fichiers
|
-- Ouvrir la recherche de fichiers
|
||||||
vim.keymap.set("n", "<leader>f", telescope_builtin.find_files, {
|
vim.keymap.set("n", "<leader>f", telescope_builtin.find_files, {
|
||||||
desc = "Find files",
|
desc = "Find files",
|
||||||
noremap = true,
|
noremap = true,
|
||||||
silent = true
|
silent = true
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Leader + g : Ouvrir la recherche textuelle
|
-- Ouvrir la recherche textuelle
|
||||||
vim.keymap.set("n", "<leader>g", telescope_builtin.live_grep, {
|
vim.keymap.set("n", "<leader>g", telescope_builtin.live_grep, {
|
||||||
desc = "Live grep",
|
desc = "Live grep",
|
||||||
noremap = true,
|
noremap = true,
|
||||||
|
|||||||
Reference in New Issue
Block a user