Add new config
This commit is contained in:
36
init.lua
Normal file
36
init.lua
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
-- Désactive l'avertissement de dépréciation de nvim-lspconfig
|
||||||
|
vim.g.lspconfig_suppress_deprecation_warning = true
|
||||||
|
-- Au lieu de : set number
|
||||||
|
vim.opt.number = true
|
||||||
|
vim.opt.relativenumber = true -- Très utile pour les sauts de ligne en tant que dev
|
||||||
|
|
||||||
|
-- Indentation (Python/C friendly)
|
||||||
|
vim.opt.tabstop = 4
|
||||||
|
vim.opt.shiftwidth = 4
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
|
||||||
|
-- Recherche
|
||||||
|
vim.opt.ignorecase = true
|
||||||
|
vim.opt.smartcase = true
|
||||||
|
|
||||||
|
-- Clipboard (pour copier vers l'OS directement)
|
||||||
|
vim.opt.clipboard = "unnamedplus"
|
||||||
|
|
||||||
|
-- 1. Définir la touche Leader (Espace est le standard moderne)
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
|
||||||
|
-- 2. Installer Lazy.nvim si absent
|
||||||
|
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", lazypath,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
-- 3. Charger tes options et tes plugins
|
||||||
|
require("core.options")
|
||||||
|
require("core.keymaps")
|
||||||
|
|
||||||
|
require("lazy").setup("plugins") -- Il va chercher les fichiers dans lua/plugins/
|
||||||
12
lazy-lock.json
Normal file
12
lazy-lock.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"catppuccin": { "branch": "main", "commit": "12c004cde3f36cb1d57242f1e6aac46b09a0e5b4" },
|
||||||
|
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||||
|
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
|
||||||
|
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "2163c54bb6cfec53e3e555665ada945b8c8331b9" },
|
||||||
|
"nvim-tree.lua": { "branch": "master", "commit": "4b30847c91d498446cb8440c03031359b045e050" },
|
||||||
|
"nvim-treesitter": { "branch": "main", "commit": "5cb05e1b0fa3c469958a2b26f36b3fe930af221c" },
|
||||||
|
"nvim-web-devicons": { "branch": "master", "commit": "737cf6c657898d0c697311d79d361288a1343d50" },
|
||||||
|
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||||
|
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }
|
||||||
|
}
|
||||||
24
lua/core/keymaps.lua
Normal file
24
lua/core/keymaps.lua
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
local keymap = vim.keymap.set
|
||||||
|
|
||||||
|
-- Mieux gérer les splits (Fenêtres)
|
||||||
|
keymap("n", "<leader>v", ":vsplit<CR>", { desc = "Split vertical" })
|
||||||
|
keymap("n", "<leader>h", ":split<CR>", { desc = "Split horizontal" })
|
||||||
|
|
||||||
|
-- Navigation entre les splits avec Ctrl + direction (comme dans tmux)
|
||||||
|
keymap("n", "<C-h>", "<C-w>h")
|
||||||
|
keymap("n", "<C-j>", "<C-w>j")
|
||||||
|
keymap("n", "<C-k>", "<C-w>k")
|
||||||
|
keymap("n", "<C-l>", "<C-w>l")
|
||||||
|
|
||||||
|
-- Gestion des Buffers (les fichiers ouverts)
|
||||||
|
keymap("n", "<leader>bn", ":bnext<CR>", { desc = "Buffer suivant" })
|
||||||
|
keymap("n", "<leader>bp", ":bprev<CR>", { desc = "Buffer précédent" })
|
||||||
|
keymap("n", "<leader>bd", ":bdelete<CR>", { desc = "Fermer le buffer" })
|
||||||
|
|
||||||
|
-- Garder le curseur au milieu lors des sauts de page (confort visuel)
|
||||||
|
keymap("n", "<C-d>", "<C-d>zz")
|
||||||
|
keymap("n", "<C-u>", "<C-u>zz")
|
||||||
|
|
||||||
|
-- Déplacer des blocs de texte en mode Visuel (Alt + j/k)
|
||||||
|
keymap("v", "J", ":m '>+1<CR>gv=gv")
|
||||||
|
keymap("v", "K", ":m '<-2<CR>gv=gv")
|
||||||
0
lua/core/options.lua
Normal file
0
lua/core/options.lua
Normal file
27
lua/plugins/lsp.lua
Normal file
27
lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
config = function()
|
||||||
|
require("mason").setup()
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
config = function()
|
||||||
|
-- AU LIEU DE : local lspconfig = require('lspconfig')
|
||||||
|
-- ON UTILISE DIRECTEMENT L'API 0.11 :
|
||||||
|
|
||||||
|
-- Configuration pour Python
|
||||||
|
vim.lsp.config('pyright', {})
|
||||||
|
|
||||||
|
-- Configuration pour C/C++
|
||||||
|
vim.lsp.config('clangd', {})
|
||||||
|
|
||||||
|
-- Configuration pour Bash
|
||||||
|
vim.lsp.config('bashls', {})
|
||||||
|
|
||||||
|
-- Note : Si tu veux ajouter des options spécifiques plus tard,
|
||||||
|
-- c'est dans le deuxième argument {} qu'on les met.
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
||||||
9
lua/plugins/telescope.lua
Normal file
9
lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
return {
|
||||||
|
'nvim-telescope/telescope.nvim', tag = '0.1.5',
|
||||||
|
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||||
|
config = function()
|
||||||
|
local builtin = require('telescope.builtin')
|
||||||
|
vim.keymap.set('n', '<leader>ff', builtin.find_files, {}) -- Recherche fichier
|
||||||
|
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {}) -- Recherche texte (nécessite ripgrep)
|
||||||
|
end
|
||||||
|
}
|
||||||
8
lua/plugins/tree.lua
Normal file
8
lua/plugins/tree.lua
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
return {
|
||||||
|
"nvim-tree/nvim-tree.lua",
|
||||||
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||||
|
config = function()
|
||||||
|
require("nvim-tree").setup()
|
||||||
|
vim.keymap.set('n', '<leader>e', ':NvimTreeToggle<CR>') -- Espace + e pour ouvrir/fermer
|
||||||
|
end
|
||||||
|
}
|
||||||
17
lua/plugins/treesitter.lua
Normal file
17
lua/plugins/treesitter.lua
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
build = ":TSUpdate",
|
||||||
|
config = function()
|
||||||
|
-- On utilise pcall pour éviter de crash si le plugin n'est pas encore là
|
||||||
|
local status, ts = pcall(require, "nvim-treesitter.configs")
|
||||||
|
if not status then return end
|
||||||
|
|
||||||
|
ts.setup({
|
||||||
|
ensure_installed = { "lua", "vim", "vimdoc", "bash", "python", "c" },
|
||||||
|
highlight = { enable = true },
|
||||||
|
indent = { enable = true },
|
||||||
|
})
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
||||||
9
lua/plugins/ui.lua
Normal file
9
lua/plugins/ui.lua
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
return {
|
||||||
|
-- Thème
|
||||||
|
{ "catppuccin/nvim", name = "catppuccin", priority = 1000,
|
||||||
|
config = function() vim.cmd.colorscheme "catppuccin" end },
|
||||||
|
|
||||||
|
-- Barre de statut
|
||||||
|
{ "nvim-lualine/lualine.nvim", dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||||
|
config = function() require('lualine').setup() end },
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user