This commit is contained in:
2025-11-12 17:19:04 +01:00
commit 304b807ac2
105 changed files with 4761 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
local cmp = require("cmp")
local luasnip = require("luasnip")
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = {
["<Tab>"] = cmp.mapping.select_next_item(),
["<S-Tab>"] = cmp.mapping.select_prev_item(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
-- add more mappings if needed
},
sources = {
{ name = "nvim_lsp" },
{ name = "buffer" },
{ name = "path" },
{ name = "luasnip" },
{ name = 'nvim_lsp_signature_help' }
},
})

View File

@@ -0,0 +1,9 @@
vim.g.mapleader = " "
local map = vim.keymap.set
map("n", "<leader>e", ":nvimtreetoggle<cr>")
map("n", "<leader>q", ":q<cr>")
map("n", "<leader>w", ":w<cr>")
vim.api.nvim_set_keymap('n', '<leader>e', '<cmd>lua vim.diagnostic.open_float()<CR>', { noremap = true, silent = true })
vim.cmd [[tnoremap <Esc> <C-\><C-n>]]

View File

@@ -0,0 +1,267 @@
--Bootstrap lazy.nvim si pas encore installé
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
require("lazy").setup({
{
"uloco/bluloco.nvim",
lazy = false,
priority = 1000,
dependencies = { "rktjmp/lush.nvim" },
config = function()
-- your optional config goes here, see below.
require("bluloco").setup {
style = "dark", -- "auto" | "dark" | "light"
transparent = true,
italics = false,
guicursor = true,
}
vim.opt.termguicolors = true
vim.cmd "colorscheme bluloco"
end,
},
-- File explorer
{
'nvim-tree/nvim-tree.lua',
dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function()
require('nvim-tree').setup({
view = {
width = 30,
side = 'left',
},
renderer = {
icons = {
show = {
git = true,
folder = true,
file = true,
folder_arrow = true,
},
},
},
})
end
}, {
"j-morano/buffer_manager.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("buffer_manager").setup({})
end,
},
-- LSP and Mason
"neovim/nvim-lspconfig",
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
-- Completion
"hrsh7th/nvim-cmp",
"hrsh7th/cmp-nvim-lsp",
-- Snippets
"L3MON4D3/LuaSnip",
{
'windwp/nvim-autopairs',
event = "InsertEnter",
config = function()
require("nvim-autopairs").setup()
end
},
-- Fuzzy finder
{ "nvim-telescope/telescope.nvim", dependencies = { "nvim-lua/plenary.nvim" } },
-- LSP and Mason
"neovim/nvim-lspconfig",
{
"williamboman/mason.nvim",
build = ":MasonUpdate", -- keep Mason packages updated
config = function()
require("mason").setup()
end,
},
{
"williamboman/mason-lspconfig.nvim",
config = function()
require("mason-lspconfig").setup({
ensure_installed = { "pyright", "tsserver", "lua_ls" },
automatic_installation = true,
})
end,
},
{
"jose-elias-alvarez/null-ls.nvim", -- install null-ls.nvim plugin
dependencies = { "nvim-lua/plenary.nvim" }, -- null-ls dependency
config = function()
require("null-ls").setup()
end,
},
{
"jay-babu/mason-null-ls.nvim",
config = function()
require("mason-null-ls").setup({
ensure_installed = { "prettier", "eslint_d", "stylua" },
automatic_installation = true,
})
end,
},
{
"kana/vim-textobj-user",
},
{
"sgur/vim-textobj-parameter",
dependencies = { "kana/vim-textobj-user" }
},
{
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
config = function()
require('nvim-treesitter.configs').setup {
ensure_installed = { "lua", "python", "javascript", "typescript", "c", "cpp", "java", "rust", "go" }, -- ajoute les langages que tu veux
highlight = {
enable = true,
},
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["aa"] = "@parameter.outer",
["ia"] = "@parameter.inner",
},
},
move = {
enable = true,
set_jumps = true,
goto_next_start = {
["]a"] = "@parameter.inner",
},
goto_previous_start = {
["[a"] = "@parameter.inner",
},
},
},
}
end,
dependencies = {
{
'nvim-treesitter/nvim-treesitter-textobjects',
},
},
}, { 'hrsh7th/nvim-cmp' },
{ 'hrsh7th/cmp-nvim-lsp-signature-help' },
-- Completion
"hrsh7th/nvim-cmp",
"hrsh7th/cmp-nvim-lsp",
-- Snippets
"L3MON4D3/LuaSnip",
{
"hrsh7th/nvim-cmp", -- Completion plugin
"hrsh7th/cmp-nvim-lsp", -- LSP source for nvim-cmp
"hrsh7th/cmp-buffer", -- Buffer completions
"hrsh7th/cmp-path", -- Path completions
"saadparwaiz1/cmp_luasnip", -- Snippet completions
"L3MON4D3/LuaSnip", -- Snippet engine
},
-- Fuzzy finder
{
"nvim-telescope/telescope.nvim",
version = false,
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
local telescope = require("telescope")
telescope.setup({
defaults = {
layout_strategy = "horizontal",
layout_config = { preview_width = 0.5 },
},
})
-- Keymaps
vim.keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<CR>", { desc = "Find files" })
vim.keymap.set("n", "<leader>fg", "<cmd>Telescope live_grep<CR>", { desc = "Live grep" })
vim.keymap.set("n", "<leader><leader>", "<cmd>Telescope buffers<CR>", { desc = "List buffers" })
vim.keymap.set("n", "<leader>fh", "<cmd>Telescope help_tags<CR>", { desc = "Help tags" })
end,
},
{
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
event = "BufReadPre",
opts = {
indent = {
char = "",
},
whitespace = {
remove_blankline_trail = false,
},
scope = { enabled = false },
},
},
{
"nvimdev/dashboard-nvim",
event = "VimEnter",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require("dashboard").setup {
theme = "hyper",
config = {
header = {
" ",
" ▄▄▄▄▄ ▄▄ ▄▄▄ ▄▄ ██ ",
" ██▀▀▀██ ██ ███ ██ ▀▀ ",
" ██ ██ ██ ██ ██ ▄██▀ ██▀█ ██ ██▄ ▄██ ████ ████▄██▄ ",
" ██ ██ ██ ██ ██▄██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ",
" ██ ██ ██ ██ ██▀██▄ ██ █▄██ ▀█▄▄█▀ ██ ██ ██ ██ ",
" ██▄▄▄██ ██▄▄▄███ ██ ▀█▄ ██ ███ ████ ▄▄▄██▄▄▄ ██ ██ ██ ",
" ▀▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀▀▀ ▀▀ ▀▀▀ ▀▀ ▀▀▀▀▀▀▀▀ ▀▀ ▀▀ ▀▀ ",
" [ DukNvim ] ",
},
shortcut = {
{
desc = "󰈞 Find File",
group = "Label",
action = "Telescope find_files",
key = "f",
},
{
desc = " New File",
group = "Label",
action = "ene | startinsert",
key = "n",
},
{
desc = " Config",
group = "Number",
action = "e ~/.config/nvim/init.lua",
key = "c",
},
{
desc = "󰗼 Quit",
group = "DiagnosticError",
action = "qa",
key = "q",
},
},
footer = {
"󰘧 Welcome to DukNvim.",
},
}
}
end
},
})

View File

@@ -0,0 +1,52 @@
require("mason-lspconfig").setup({
ensure_installed = {
"rust_analyzer", -- Rust
"clangd", -- C/C++
"pyright", -- Python
"html", -- HTML
"cssls", -- CSS
"ts_ls", -- JavaScript/TypeScript
"emmet_ls", -- Emmet support (verify availability)
"marksman", -- Markdown
"lua_ls", -- Lua
},automatic_enable = true,
})
-- Configure Mason null-ls tools (formatters and linters)
require("mason-null-ls").setup({
ensure_installed = {
"clippy", -- Rust linter
"clang-format", -- C/C++ formatter
"cpplint", -- C++ linter
"black", -- Python formatter
"flake8", -- Python linter
"isort", -- Python import sorter
"prettier", -- JS/HTML/CSS/MD formatter
"eslint_d", -- JS linter
"stylelint", -- CSS linter
"markdownlint" -- Markdown linter
},
automatic_setup = true,
})
-- Configure Treesitter for better syntax highlighting
require("nvim-treesitter.configs").setup({
ensure_installed = {
"rust", "java", "c", "cpp", "python",
"html", "css", "javascript", "typescript",
"markdown", "lua"
},
highlight = { enable = true },
})
vim.diagnostic.config({
virtual_text = {
prefix = '', -- Could be '■', '▎', '●' or 'none'
spacing = 4,
},
signs = true, -- Show signs in the gutter
underline = true, -- Underline the problematic code
update_in_insert = false, -- Do not update diagnostics while in insert mode
severity_sort = true, -- Sort diagnostics by severity
})

View File

@@ -0,0 +1,38 @@
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.termguicolors = true
vim.opt.cursorline = true
vim.opt.clipboard = "unnamedplus"
-- Create an autocommand group to toggle relative number on InsertEnter/InsertLeave
vim.api.nvim_create_augroup("RelNumToggle", { clear = true })
vim.api.nvim_create_autocmd("InsertEnter", {
group = "RelNumToggle",
callback = function()
vim.opt.relativenumber = false -- Disable relative numbers in insert mode
end,
})
vim.api.nvim_create_autocmd("InsertLeave", {
group = "RelNumToggle",
callback = function()
vim.opt.relativenumber = true -- Enable relative numbers when leaving insert mode
end,
})
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = "*",
callback = function()
-- Vérifie s'il y a un client LSP actif pour ce buffer avant de formater
local clients = vim.lsp.get_active_clients({ bufnr = vim.api.nvim_get_current_buf() })
if next(clients) ~= nil then
vim.lsp.buf.format({ async = false })
end
end,
})