Add: first import
This commit is contained in:
commit
82641f61be
23 changed files with 800 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
.DS_Store
|
||||||
|
lazy-lock.json
|
||||||
59
TODO.md
Normal file
59
TODO.md
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
## Productivité boostée
|
||||||
|
|
||||||
|
TODO: Undotree
|
||||||
|
Vim-fugitive
|
||||||
|
Vimux
|
||||||
|
Via Vimux : gestion pomodoro
|
||||||
|
Afficher les images dans Telescope file browser
|
||||||
|
Afficher les stats distraction free à la demande
|
||||||
|
Recherche : telescope & telescope-fzf-native
|
||||||
|
Templates : skeleton.nvim
|
||||||
|
Sticky Content: nvim-treesitter-context
|
||||||
|
TODO: Manage maskdown tasks as Obsidian do
|
||||||
|
Kanban: un plugin existe ?
|
||||||
|
Tableau: Aide mise en page
|
||||||
|
Autosave: plugin ?
|
||||||
|
Move line up and down in visual mode
|
||||||
|
uppercase word
|
||||||
|
lowercase word
|
||||||
|
upload visual to pastebin
|
||||||
|
Automatic folding (si 2 ##, on ferme le premier par exemple)
|
||||||
|
Se déplacer de titre en titre, de function en function
|
||||||
|
Increase, decrease heading
|
||||||
|
rajouter le mot sous curseur au dictionnaire
|
||||||
|
Markdown TOC
|
||||||
|
Markdown: create file with urlize title
|
||||||
|
Avoir le nombre de mot y compris en ZenMode
|
||||||
|
Markdown preview
|
||||||
|
nvim as pager
|
||||||
|
Avoir la liste des fonction dans une barre à droite ?
|
||||||
|
Voiir quel images docker tournent
|
||||||
|
Désactiver l’enregistrement avec q
|
||||||
|
multicursor
|
||||||
|
regarder markview
|
||||||
|
key-analyser.nvim
|
||||||
|
nvim-surround
|
||||||
|
Filetype toml
|
||||||
|
|
||||||
|
## Dev ultime
|
||||||
|
|
||||||
|
Autoformat et linting : null-ls.nvim, formatter.nvim
|
||||||
|
Gestion des LSP : lsp-zero.nvim, trouble.nvim
|
||||||
|
navigation de projets: neogit, gitsigns.nvim
|
||||||
|
indent guides
|
||||||
|
commit git
|
||||||
|
|
||||||
|
## Look & Feel
|
||||||
|
|
||||||
|
|
||||||
|
## ftplugin
|
||||||
|
|
||||||
|
Dockerfile
|
||||||
|
|
||||||
|
# Snippets
|
||||||
|
|
||||||
|
Template file
|
||||||
|
code exemple (tex, md, rst, bash, python, etc ...)
|
||||||
|
include real datetime
|
||||||
|
|
||||||
|
|
||||||
2
ftplugin/conf.lua
Normal file
2
ftplugin/conf.lua
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
-- 📄 Déclare le filetype et les options simples
|
||||||
|
vim.opt_local.commentstring = "# %s" -- Commentaires avec #
|
||||||
13
ftplugin/cpp.lua
Normal file
13
ftplugin/cpp.lua
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
-- ftplugin/cpp.lua
|
||||||
|
|
||||||
|
-- Configuration des tabulations pour le C++
|
||||||
|
vim.bo.expandtab = true -- Utiliser des espaces
|
||||||
|
vim.bo.shiftwidth = 4 -- Largeur des indentations
|
||||||
|
vim.bo.tabstop = 4 -- Taille d'une tabulation
|
||||||
|
|
||||||
|
-- Activer le pliage basé sur la syntaxe
|
||||||
|
vim.wo.foldmethod = 'syntax'
|
||||||
|
|
||||||
|
-- Activer les numéros relatifs pour un meilleur mouvement dans le code
|
||||||
|
vim.wo.relativenumber = true
|
||||||
|
|
||||||
20
ftplugin/dockerfile.lua
Normal file
20
ftplugin/dockerfile.lua
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
-- Indentation propre
|
||||||
|
vim.opt_local.expandtab = true -- Utilise des espaces au lieu de tabs
|
||||||
|
vim.opt_local.shiftwidth = 2 -- Indentation : 2 espaces
|
||||||
|
vim.opt_local.tabstop = 2 -- Largeur d'une tabulation : 2
|
||||||
|
|
||||||
|
-- Mise en surbrillance des instructions Docker
|
||||||
|
vim.cmd([[
|
||||||
|
syntax keyword dockerfileInstruction FROM RUN CMD LABEL MAINTAINER EXPOSE ENV ADD COPY ENTRYPOINT VOLUME USER WORKDIR ARG ONBUILD STOPSIGNAL HEALTHCHECK SHELL
|
||||||
|
highlight link dockerfileInstruction Keyword
|
||||||
|
]])
|
||||||
|
|
||||||
|
-- 🛠️ Autoformat avec hadolint (si installé)
|
||||||
|
if vim.fn.executable("hadolint") == 1 then
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||||
|
pattern = "Dockerfile",
|
||||||
|
callback = function()
|
||||||
|
vim.cmd("!hadolint %")
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
8
ftplugin/lua.lua
Normal file
8
ftplugin/lua.lua
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
-- Indentation verrouillée à 4 espaces
|
||||||
|
vim.bo.expandtab = true -- Remplace les tabs par des espaces
|
||||||
|
vim.bo.shiftwidth = 4 -- Indentation : 4 espaces
|
||||||
|
vim.bo.tabstop = 4 -- Largeur d'une tabulation : 4
|
||||||
|
vim.bo.softtabstop = 4 -- Tabulation en édition : 4
|
||||||
|
vim.bo.autoindent = true -- Copie l’indentation précédente
|
||||||
|
vim.bo.smartindent = true -- Indentation intelligente
|
||||||
|
vim.opt.number = true
|
||||||
7
ftplugin/make.lua
Normal file
7
ftplugin/make.lua
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
-- Indentation verrouillée à 4 espaces
|
||||||
|
vim.bo.expandtab = true -- Remplace les tabs par des espaces
|
||||||
|
vim.bo.shiftwidth = 4 -- Indentation : 4 espaces
|
||||||
|
vim.bo.tabstop = 4 -- Largeur d'une tabulation : 4
|
||||||
|
vim.bo.softtabstop = 4 -- Tabulation en édition : 4
|
||||||
|
vim.bo.autoindent = true -- Copie l’indentation précédente
|
||||||
|
vim.bo.smartindent = true -- Indentation intelligente
|
||||||
13
ftplugin/markdown.lua
Normal file
13
ftplugin/markdown.lua
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
-- Activation automatique de Zen Mode pour Markdown
|
||||||
|
-- vim.api.nvim_create_autocmd("BufReadPost", {
|
||||||
|
-- pattern = { "*.md", "*.markdown" },
|
||||||
|
-- callback = function()
|
||||||
|
-- if not vim.g.zen_mode_active then
|
||||||
|
-- vim.defer_fn(function()
|
||||||
|
-- vim.cmd("ZenMode") -- ⚡ Active Zen Mode
|
||||||
|
-- print(" Zen Mode activé pour Markdown !")
|
||||||
|
-- end, 200) -- Délai pour éviter les conflits
|
||||||
|
-- end
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
|
||||||
11
ftplugin/meson.lua
Normal file
11
ftplugin/meson.lua
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
-- ftplugin/meson.lua
|
||||||
|
-- Configuration des tabulations pour Meson
|
||||||
|
vim.bo.expandtab = true -- Utiliser des espaces au lieu de tabulations
|
||||||
|
vim.bo.shiftwidth = 4 -- Largeur des indentations (4 espaces)
|
||||||
|
vim.bo.tabstop = 4 -- Taille d'une tabulation
|
||||||
|
|
||||||
|
-- Activer la coloration syntaxique (si désactivée par défaut)
|
||||||
|
vim.cmd('syntax on')
|
||||||
|
|
||||||
|
-- Définir le formatage automatique
|
||||||
|
vim.bo.formatoptions = vim.bo.formatoptions .. 'cqrn' -- Respecter les retours à la ligne et auto-indent
|
||||||
10
ftplugin/python.lua
Normal file
10
ftplugin/python.lua
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
-- LSP Pyright
|
||||||
|
require("lspconfig").pyright.setup({})
|
||||||
|
|
||||||
|
-- Autoformat avec Black à l'enregistrement
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
pattern = "*.py",
|
||||||
|
callback = function()
|
||||||
|
vim.cmd("Black")
|
||||||
|
end,
|
||||||
|
})
|
||||||
18
ftplugin/rst.lua
Normal file
18
ftplugin/rst.lua
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
vim.defer_fn(function()
|
||||||
|
vim.cmd("ZenMode")
|
||||||
|
end, 100)
|
||||||
|
|
||||||
|
-- Activation automatique de Zen Mode pour RST
|
||||||
|
vim.api.nvim_create_autocmd("BufReadPost", {
|
||||||
|
pattern = "*.rst",
|
||||||
|
callback = function()
|
||||||
|
if not vim.g.zen_mode_active then
|
||||||
|
vim.defer_fn(function()
|
||||||
|
vim.cmd("ZenMode") -- Active Zen Mode après chargement
|
||||||
|
print(" Zen Mode activé pour RST !")
|
||||||
|
end, 200) -- Délai pour éviter les conflits
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
8
ftplugin/yaml.lua
Normal file
8
ftplugin/yaml.lua
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
-- 🔧 Configuration propre pour les fichiers YAML
|
||||||
|
vim.bo.expandtab = true -- Utilise des espaces au lieu de tabs
|
||||||
|
vim.bo.shiftwidth = 2 -- Indentation de 2 espaces
|
||||||
|
vim.bo.tabstop = 2 -- Tabulation de 2 espaces
|
||||||
|
vim.bo.softtabstop = 2 -- Tabulation douce de 2 espaces
|
||||||
|
vim.bo.autoindent = true -- Indentation automatique
|
||||||
|
vim.bo.smartindent = true -- Indentation intelligente
|
||||||
|
vim.bo.fileformat = "unix" -- Format de fin de ligne
|
||||||
11
init.lua
Normal file
11
init.lua
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
-- Optimise le temps de chargement
|
||||||
|
vim.loader.enable()
|
||||||
|
|
||||||
|
vim.g.mapleader = ","
|
||||||
|
vim.g.maplocalleader = ","
|
||||||
|
|
||||||
|
|
||||||
|
require("autocmds")
|
||||||
|
require("keymaps")
|
||||||
|
require("pm")
|
||||||
|
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/lua/snippets/" })
|
||||||
117
lua/autocmds.lua
Normal file
117
lua/autocmds.lua
Normal file
|
|
@ -0,0 +1,117 @@
|
||||||
|
-- Ouvrir lz terminal dans une fenetre flottante pour le make
|
||||||
|
vim.cmd([[
|
||||||
|
autocmd FileType cpp setlocal nobuflisted
|
||||||
|
let g:makeprg="make | tee /tmp/make_output" " Ne pas bloquer après make
|
||||||
|
command! Make silent execute 'belowright terminal make'
|
||||||
|
]])
|
||||||
|
|
||||||
|
-- Redimensionne les fenêtres lors du redimensionnement du terminal
|
||||||
|
vim.api.nvim_create_autocmd("VimResized", {
|
||||||
|
group = vim.api.nvim_create_augroup("win_autoresize", { clear = true }),
|
||||||
|
desc = "Auto-resize windows on resizing operation",
|
||||||
|
command = "wincmd =",
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Désactive le highlight après la recherche
|
||||||
|
vim.api.nvim_create_autocmd("InsertEnter", {
|
||||||
|
callback = function()
|
||||||
|
vim.cmd("nohlsearch")
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Activer ZenMode pour les fichiers Markdown
|
||||||
|
vim.api.nvim_create_autocmd({"BufEnter","BufWinEnter"}, {
|
||||||
|
pattern = { "*.md", "*.wiki" },
|
||||||
|
callback = function()
|
||||||
|
vim.defer_fn(function ()
|
||||||
|
if not require("zen-mode.view").is_open() then
|
||||||
|
vim.cmd("ZenMode")
|
||||||
|
end
|
||||||
|
end, 100)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Désactiver ZenMode lors du changement de buffer
|
||||||
|
vim.api.nvim_create_autocmd("BufLeave", {
|
||||||
|
pattern = "*",
|
||||||
|
callback = function()
|
||||||
|
if require("zen-mode.view").is_open() then
|
||||||
|
vim.cmd("ZenMode")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
local function format_and_restore()
|
||||||
|
vim.cmd("normal! mz") -- Place une marque 'z' à la position actuelle
|
||||||
|
vim.cmd([[%s/\s\+$//e]]) -- Supprime les espaces inutiles en fin de ligne
|
||||||
|
--vim.cmd("normal! gg=G") -- Formate tout le fichier
|
||||||
|
vim.cmd("normal! `z") -- Retourne à la marque 'z'
|
||||||
|
end
|
||||||
|
-- Configure l'autocommand pour le formatage à la sauvegarde
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
pattern = "*", -- Applique à tous les fichiers
|
||||||
|
callback = function()
|
||||||
|
local ft = vim.bo.filetype -- Récupère le type de fichier
|
||||||
|
|
||||||
|
if ft == "cpp" or ft == "c" then
|
||||||
|
-- Utilise LSP pour formater le C et C++
|
||||||
|
vim.lsp.buf.format({ async = false })
|
||||||
|
elseif ft == "python" then
|
||||||
|
-- Utilise Black pour formater le Python
|
||||||
|
vim.cmd("Black")
|
||||||
|
elseif ft ~= "markdown" then
|
||||||
|
format_and_restore()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
-- Vérifie si tmux est installé
|
||||||
|
local function is_tmux_installed()
|
||||||
|
return vim.fn.executable("tmux") == 1
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Vérifie si on est dans une session tmux
|
||||||
|
local function is_in_tmux()
|
||||||
|
return os.getenv("TMUX") ~= nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Récupère la couleur d'un groupe de highlight
|
||||||
|
local function get_hl_color(hl, attr)
|
||||||
|
local ok, hl_data = pcall(vim.api.nvim_get_hl, 0, { name = hl })
|
||||||
|
if ok and hl_data[attr] then
|
||||||
|
return string.format("#%06x", hl_data[attr])
|
||||||
|
else
|
||||||
|
return "#444444" -- Gris par défaut si rien trouvé
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 📡 Synchronise les couleurs avec Tmux selon le mode
|
||||||
|
local function set_tmux_status(mode)
|
||||||
|
if not (is_tmux_installed() and is_in_tmux()) then
|
||||||
|
return -- Ne fait rien si tmux n'est pas dispo
|
||||||
|
end
|
||||||
|
|
||||||
|
local mode_colors = {
|
||||||
|
n = get_hl_color("MiniStatuslineModeNormal", "bg"),
|
||||||
|
i = get_hl_color("MiniStatuslineModeInsert", "bg"),
|
||||||
|
v = get_hl_color("MiniStatuslineModeVisual", "bg"),
|
||||||
|
V = get_hl_color("MiniStatuslineModeVisual", "bg"),
|
||||||
|
[""] = get_hl_color("MiniStatuslineModeVisual", "bg"),
|
||||||
|
R = get_hl_color("MiniStatuslineModeReplace", "bg"),
|
||||||
|
c = get_hl_color("MiniStatuslineModeCommand", "bg"),
|
||||||
|
}
|
||||||
|
|
||||||
|
local color = mode_colors[mode] or get_hl_color("MiniStatuslineModeNormal", "bg")
|
||||||
|
os.execute(string.format("tmux set-option -g status-bg '%s'", color))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Active la synchronisation Tmux ↔ Neovim
|
||||||
|
if is_tmux_installed() and is_in_tmux() then
|
||||||
|
vim.api.nvim_create_autocmd("ModeChanged", {
|
||||||
|
pattern = "*",
|
||||||
|
callback = function()
|
||||||
|
local mode = vim.fn.mode()
|
||||||
|
set_tmux_status(mode)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
44
lua/keymaps.lua
Normal file
44
lua/keymaps.lua
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
vim.keymap.set('v', '<C-c>', '"+y', { noremap = true })
|
||||||
|
vim.keymap.set('n', '<C-v>', '"+p', { noremap = true })
|
||||||
|
-- Keymaps
|
||||||
|
vim.keymap.set("n", "<leader>fb", function()
|
||||||
|
require("telescope").extensions.file_browser.file_browser()
|
||||||
|
end, { desc="file browser"} )
|
||||||
|
-- -- Navigation entre buffers en mode NORMAL
|
||||||
|
-- vim.keymap.set("n", "<Tab>", ":bnext<CR>", { desc = "⬅️ Buffer précédent" })
|
||||||
|
-- vim.keymap.set("n", "<S-Tab>", ":bprevious<CR>", { desc = "⬅️ Buffer précédent" })
|
||||||
|
--
|
||||||
|
-- -- Indentation en mode INSERT et VISUEL
|
||||||
|
-- vim.keymap.set("i", "<Tab>", "<Tab>", { desc = "➡️ Tabulation" })
|
||||||
|
-- vim.keymap.set("v", "<Tab>", ">gv", { desc = "➡️ Indenter la sélection" })
|
||||||
|
-- vim.keymap.set("v", "<S-Tab>", "<gv", { desc = "⬅️ Désindenter la sélection" })
|
||||||
|
|
||||||
|
-- Fonction générique pour créer une commande Docker
|
||||||
|
local function create_docker_command(name, cmd)
|
||||||
|
vim.api.nvim_create_user_command(name, function()
|
||||||
|
local Terminal = require("toggleterm.terminal").Terminal
|
||||||
|
local cwd = vim.fn.getcwd()
|
||||||
|
local docker_terminal = Terminal:new({
|
||||||
|
cmd = "docker run --platform=linux/amd64 --rm -it -v " .. cwd .. ":/app lomigandtux/meson-gcc:latest sh -c \"cd /app && " .. cmd .. "\"",
|
||||||
|
close_on_exit = false,
|
||||||
|
direction = "float",
|
||||||
|
hidden = true,
|
||||||
|
float_opts = {
|
||||||
|
border = "curved",
|
||||||
|
width = 80,
|
||||||
|
height = 20,
|
||||||
|
winblend = 10,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
docker_terminal:toggle()
|
||||||
|
end, {})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Ajout des commandes Docker
|
||||||
|
create_docker_command("Make", "make")
|
||||||
|
create_docker_command("MakeClean", "make clean")
|
||||||
|
create_docker_command("MakeRun", "/bin/bash run.sh")
|
||||||
|
create_docker_command("MesonSetup", "meson setup build")
|
||||||
|
create_docker_command("MesonBuild", "ninja -C build")
|
||||||
|
create_docker_command("MesonClean", "ninja -C build clean")
|
||||||
|
create_docker_command("MesonRun", "cd build && ./main")
|
||||||
24
lua/plugins/basic.lua
Normal file
24
lua/plugins/basic.lua
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-lua/plenary.nvim", -- lua functions that many plugins use
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"christoomey/vim-tmux-navigator", -- tmux & split window navigation
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
build = ":TSUpdate",
|
||||||
|
config = function()
|
||||||
|
require("nvim-treesitter.configs").setup({
|
||||||
|
ensure_installed = { "lua", "python", "bash", "markdown" }, -- Parsers à installer
|
||||||
|
sync_install = false,
|
||||||
|
auto_install = true,
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
additional_vim_regex_highlighting = false,
|
||||||
|
},
|
||||||
|
indent = { enable = true },
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
16
lua/plugins/comments.lua
Normal file
16
lua/plugins/comments.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"folke/todo-comments.nvim",
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
|
config = function()
|
||||||
|
require("todo-comments").setup({
|
||||||
|
keywords = {
|
||||||
|
FIX = { icon = " ", color = "error", alt = { "BUG", "FIXME" } },
|
||||||
|
TODO = { icon = " ", color = "info" },
|
||||||
|
HACK = { icon = " ", color = "warning" },
|
||||||
|
NOTE = { icon = " ", color = "hint", alt = { "INFO" } },
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
}
|
||||||
45
lua/plugins/distraction-free.lua
Normal file
45
lua/plugins/distraction-free.lua
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"folke/zen-mode.nvim",
|
||||||
|
opts = {
|
||||||
|
window = {
|
||||||
|
backdrop = 0.95,
|
||||||
|
width = 120,
|
||||||
|
options = {
|
||||||
|
signcolumn = "no",
|
||||||
|
number = false,
|
||||||
|
relativenumber = false,
|
||||||
|
cursorline = false,
|
||||||
|
cursorcolumn = false,
|
||||||
|
foldcolumn = "0",
|
||||||
|
--list = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugins = {
|
||||||
|
options = {
|
||||||
|
enabled = true,
|
||||||
|
ruler = false,
|
||||||
|
showcmd = false,
|
||||||
|
laststatus = 2,
|
||||||
|
},
|
||||||
|
tmux = { enabled = true },
|
||||||
|
todo = { enabled = true },
|
||||||
|
},
|
||||||
|
on_open = function()
|
||||||
|
-- vim.g.zen_mode_active = true
|
||||||
|
vim.cmd("Limelight") -- Active Limelight avec ZenMode
|
||||||
|
end,
|
||||||
|
on_close = function()
|
||||||
|
-- vim.g.zen_mode_active = false
|
||||||
|
vim.cmd("Limelight!") -- Désactive Limelight avec ZenMode
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"junegunn/limelight.vim",
|
||||||
|
config = function()
|
||||||
|
vim.g.limelight_conceal_ctermfg = "gray" -- Couleur des lignes non actives en terminal
|
||||||
|
vim.g.limelight_conceal_guifg = "gray" -- Couleur des lignes non actives en GUI
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
174
lua/plugins/lsp.lua
Normal file
174
lua/plugins/lsp.lua
Normal file
|
|
@ -0,0 +1,174 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
build = ":MasonUpdate",
|
||||||
|
config = function()
|
||||||
|
require("mason").setup()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Mason-LSPconfig : Intégration avec les serveurs LSP
|
||||||
|
{
|
||||||
|
"williamboman/mason-lspconfig.nvim",
|
||||||
|
config = function()
|
||||||
|
require("mason-lspconfig").setup({
|
||||||
|
ensure_installed = { "clangd","pyright", "lua_ls", "marksman", "ruff" },
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- LSP Config : Configuration des serveurs LSP
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
config = function()
|
||||||
|
local lspconfig = require("lspconfig")
|
||||||
|
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||||
|
|
||||||
|
local navic = require("nvim-navic")
|
||||||
|
|
||||||
|
local on_attach = function(client, bufnr)
|
||||||
|
if client.server_capabilities.documentSymbolProvider then
|
||||||
|
navic.attach(client, bufnr) -- Attache Navic au LSP
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Cpp
|
||||||
|
lspconfig.clangd.setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-- Python
|
||||||
|
lspconfig.pyright.setup({
|
||||||
|
on_attach = on_attach,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Lua
|
||||||
|
lspconfig.lua_ls.setup({
|
||||||
|
on_attach = on_attach,
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
diagnostics = { globals = { "vim" } },
|
||||||
|
workspace = { library = vim.api.nvim_get_runtime_file("", true) },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Markdown & reStructuredText
|
||||||
|
lspconfig.marksman.setup({})
|
||||||
|
|
||||||
|
local navic = require("nvim-navic")
|
||||||
|
|
||||||
|
-- Exemple avec Pyright
|
||||||
|
require("lspconfig").pyright.setup({
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
if client.server_capabilities.documentSymbolProvider then
|
||||||
|
navic.attach(client, bufnr) -- Attache Navic au LSP
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
build = "make install_jsregexp",
|
||||||
|
config = function()
|
||||||
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
-- nvim-cmp : Moteur d’autocomplétion
|
||||||
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
dependencies = {
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
"hrsh7th/cmp-buffer",
|
||||||
|
"hrsh7th/cmp-path",
|
||||||
|
"hrsh7th/cmp-cmdline",
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
"saadparwaiz1/cmp_luasnip",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local cmp = require("cmp")
|
||||||
|
local luasnip = require("luasnip")
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
mapping = {
|
||||||
|
-- Comportement intelligent pour Tab
|
||||||
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item() -- Sélectionne l'élément suivant si le menu est ouvert
|
||||||
|
elseif luasnip.expand_or_jumpable() then
|
||||||
|
luasnip.expand_or_jump() -- Passe au placeholder suivant si dans un snippet
|
||||||
|
else
|
||||||
|
fallback() -- Sinon, insère une tabulation normale
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item() -- Sélectionne l'élément précédent si le menu est ouvert
|
||||||
|
elseif luasnip.jumpable(-1) then
|
||||||
|
luasnip.jump(-1) -- Passe au placeholder précédent si dans un snippet
|
||||||
|
else
|
||||||
|
fallback() -- Sinon, insère une tabulation normale
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
-- Comportement pour Entrée
|
||||||
|
["<CR>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.confirm({ select = true }) -- Confirme la sélection
|
||||||
|
elseif luasnip.jumpable(1) then
|
||||||
|
luasnip.jump(1) -- Passe au placeholder suivant dans un snippet
|
||||||
|
else
|
||||||
|
fallback() -- Sinon, insère une nouvelle ligne
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
},
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = "luasnip" },
|
||||||
|
{ name = "buffer" },
|
||||||
|
{ name = "path" },
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
-- black : Formatage de python
|
||||||
|
{
|
||||||
|
"psf/black",
|
||||||
|
ft = { "python" },
|
||||||
|
build = ":BlackUpgrade",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"jose-elias-alvarez/null-ls.nvim",
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
|
config = function()
|
||||||
|
local null_ls = require("null-ls")
|
||||||
|
|
||||||
|
null_ls.setup({
|
||||||
|
sources = {
|
||||||
|
null_ls.builtins.formatting.clang_format.with({
|
||||||
|
filetypes = { "cpp", "c", "objc", "objcpp" }, -- Limiter aux langages supportés
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
-- Optionnel : configurer un mapping ou autoformat
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
if client.supports_method("textDocument/formatting") then
|
||||||
|
local group = vim.api.nvim_create_augroup("LspFormatting", { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
group = group,
|
||||||
|
buffer = bufnr,
|
||||||
|
callback = function()
|
||||||
|
vim.lsp.buf.format({ bufnr = bufnr })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
49
lua/plugins/tools.lua
Normal file
49
lua/plugins/tools.lua
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope-file-browser.nvim",
|
||||||
|
dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"folke/which-key.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
opts = {
|
||||||
|
-- your configuration comes here
|
||||||
|
-- or leave it empty to use the default settings
|
||||||
|
-- refer to the configuration section below
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>?",
|
||||||
|
function()
|
||||||
|
require("which-key").show({ global = false })
|
||||||
|
end,
|
||||||
|
desc = "Buffer Local Keymaps (which-key)",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kylechui/nvim-surround",
|
||||||
|
version = "*",
|
||||||
|
event = "VeryLazy",
|
||||||
|
config = function()
|
||||||
|
require("nvim-surround").setup({})
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"windwp/nvim-autopairs",
|
||||||
|
event = "InsertEnter",
|
||||||
|
config = function()
|
||||||
|
local npairs = require("nvim-autopairs")
|
||||||
|
npairs.setup({
|
||||||
|
check_ts = true, -- Active la vérification via Treesitter
|
||||||
|
fast_wrap = {},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Intégration avec nvim-cmp
|
||||||
|
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||||
|
local cmp = require("cmp")
|
||||||
|
|
||||||
|
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
105
lua/plugins/ui.lua
Normal file
105
lua/plugins/ui.lua
Normal file
|
|
@ -0,0 +1,105 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
'AlexvZyl/nordic.nvim',
|
||||||
|
lazy = false,
|
||||||
|
priority = 1000,
|
||||||
|
config = function()
|
||||||
|
require('nordic').load()
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"akinsho/toggleterm.nvim",
|
||||||
|
version = "*",
|
||||||
|
config = function()
|
||||||
|
require("toggleterm").setup({
|
||||||
|
open_mapping = [[<C-\>]], -- Par défaut, ouvre le terminal avec Ctrl+\
|
||||||
|
direction = "horizontal", -- Terminal en bas (horizontal)
|
||||||
|
size = 15, -- Hauteur du terminal
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvim-lualine/lualine.nvim",
|
||||||
|
dependencies = { "nvim-tree/nvim-web-devicons", },
|
||||||
|
config = function()
|
||||||
|
local navic = require("nvim-navic")
|
||||||
|
|
||||||
|
require("lualine").setup({
|
||||||
|
options = {
|
||||||
|
theme = "auto",
|
||||||
|
section_separators = { "", "" },
|
||||||
|
component_separators = { "|", "|" },
|
||||||
|
},
|
||||||
|
sections = {
|
||||||
|
lualine_a = { "mode" },
|
||||||
|
lualine_b = { "branch", "diff" },
|
||||||
|
lualine_c = {
|
||||||
|
{
|
||||||
|
"filename", -- Affiche le chemin du fichier
|
||||||
|
path = 1, -- 0 = Nom du fichier, 1 = Relatif, 2 = Absolu
|
||||||
|
symbols = {
|
||||||
|
modified = " ●", -- Fichier modifié
|
||||||
|
readonly = " 🔒", -- Lecture seule
|
||||||
|
unnamed = " [No Name]",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
function()
|
||||||
|
return navic.is_available() and navic.get_location() or ""
|
||||||
|
end,
|
||||||
|
icon = " ➤ "
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lualine_x = { "encoding", "filetype" },
|
||||||
|
lualine_y = { "progress" },
|
||||||
|
lualine_z = { "location" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"gorbit99/codewindow.nvim",
|
||||||
|
config = function()
|
||||||
|
local codewindow = require("codewindow")
|
||||||
|
codewindow.setup({
|
||||||
|
auto_enable = true,
|
||||||
|
width = 10,
|
||||||
|
minimap_width = 15,
|
||||||
|
window_border = "none",
|
||||||
|
use_lsp = true,
|
||||||
|
use_treesitter = true,
|
||||||
|
exclude_filetypes = { "markdown", "" },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Raccourci pour activer/désactiver la minimap
|
||||||
|
vim.keymap.set("n", "<leader>m", function()
|
||||||
|
codewindow.toggle_minimap()
|
||||||
|
end, { desc = "Basculer la minimap" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"SmiteshP/nvim-navic",
|
||||||
|
dependencies = { "neovim/nvim-lspconfig" },
|
||||||
|
config = function()
|
||||||
|
require("nvim-navic").setup({
|
||||||
|
highlight = true,
|
||||||
|
separator = " > ",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"akinsho/bufferline.nvim",
|
||||||
|
version = "*",
|
||||||
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||||
|
config = function()
|
||||||
|
require("bufferline").setup({
|
||||||
|
options = {
|
||||||
|
mode = "buffers",
|
||||||
|
separator_style = "slant",
|
||||||
|
diagnostics = "nvim_lsp",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
19
lua/pm.lua
Normal file
19
lua/pm.lua
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
-- Chemin où lazy.nvim sera installé
|
||||||
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
|
|
||||||
|
-- Vérifie si lazy.nvim est déjà installé, sinon le clone automatiquement
|
||||||
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
|
print("Clonage de lazy.nvim...")
|
||||||
|
vim.fn.system({
|
||||||
|
"git",
|
||||||
|
"clone",
|
||||||
|
"--filter=blob:none",
|
||||||
|
"https://github.com/folke/lazy.nvim.git",
|
||||||
|
"--branch=stable", -- Utilise la branche stable
|
||||||
|
lazypath,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
require("lazy").setup({ import = "plugins" })
|
||||||
|
|
||||||
25
lua/snippets/cpp.lua
Normal file
25
lua/snippets/cpp.lua
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
local ls = require("luasnip") -- Import LuaSnip
|
||||||
|
local s = ls.snippet
|
||||||
|
local t = ls.text_node
|
||||||
|
local i = ls.insert_node
|
||||||
|
|
||||||
|
return {
|
||||||
|
s("main", {
|
||||||
|
t({ "#include <iostream>", "", "int main() {", " " }),
|
||||||
|
i(1, "// Code ici"),
|
||||||
|
t({ "", " return 0;", "}" }),
|
||||||
|
}),
|
||||||
|
s("for", {
|
||||||
|
t("for (int "),
|
||||||
|
i(1, "i"),
|
||||||
|
t(" = 0; "),
|
||||||
|
i(2, "i"),
|
||||||
|
t(" < "),
|
||||||
|
i(3, "n"),
|
||||||
|
t("; ++"),
|
||||||
|
i(4, "i"),
|
||||||
|
t({ ") {", " " }),
|
||||||
|
i(5, "// Corps de la boucle"),
|
||||||
|
t({ "", "}" }),
|
||||||
|
}),
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue