Migration from packer to lazy.nvim

main
theodugautier 2025-07-17 00:24:58 +02:00
parent 3396d20027
commit fd2c1d305a
17 changed files with 910 additions and 0 deletions

View File

@ -0,0 +1,77 @@
return {
'hrsh7th/cmp-buffer', -- nvim-cmp source for buffer words
'hrsh7th/cmp-path', -- completion pathname
'hrsh7th/cmp-nvim-lsp', -- nvim-cmp source for neovim's built-in LSP
{
'hrsh7th/nvim-cmp', -- Completion
config = function()
local cmp = require 'cmp'
local lspkind = require 'lspkind'
local luasnip = require 'luasnip'
local has_words_before = function()
if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then return false end
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_text(0, line-1, 0, line-1, col, {})[1]:match("^%s*$") == nil
end
cmp.setup({
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<Tab>"] = vim.schedule_wrap(function(fallback)
if cmp.visible() and has_words_before() then
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true
}),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{
name = 'buffer',
option = {
get_bufnrs = function ()
return vim.api.nvim_list_bufs()
end
}
},
{ name = 'path' },
{ name = 'luasnip' }
}),
formatting = {
format = lspkind.cmp_format({ with_text = false, maxwidth = 50 })
}
})
vim.cmd [[
set completeopt=menuone,noinsert,noselect
highlight! default link CmpItemKind CmpItemMenuDefault
]]
end,
},
}

View File

@ -0,0 +1,73 @@
return {
{
"numToStr/Comment.nvim",
config = function()
require('Comment').setup()
end,
},
{
"mhartington/formatter.nvim",
config = function()
local util = require "formatter.util"
-- Provides the Format, FormatWrite, FormatLock, and FormatWriteLock commands
require("formatter").setup {
-- Enable or disable logging
logging = true,
-- Set the log level
log_level = vim.log.levels.WARN,
-- All formatter configurations are opt-in
filetype = {
ruby = {
function()
return {
exe = 'bundle exec rubocop',
args = {
'--fix-layout',
'--stdin',
util.escape_path(util.get_current_buffer_file_name()),
'--format',
'files',
'|',
"awk 'f; /^====================$/{f=1}'",
},
stdin = true,
}
end
}
}
}
end,
},
{
"AndrewRadev/splitjoin.vim"
},
{
"RRethy/vim-illuminate"
},
{
"ap/vim-css-color"
},
{
"windwp/nvim-autopairs",
config = function()
require('nvim-autopairs').setup({
disable_filetype = { "TelescopePrompt" , "vim" },
})
end
},
{
"bronson/vim-trailing-whitespace",
},
{
"vim-test/vim-test",
},
{
"tpope/vim-surround",
},
{
"Raimondi/delimitMate",
},
{
"nvim-lua/plenary.nvim",
},
}

View File

@ -0,0 +1,41 @@
return {
{
'f-person/git-blame.nvim',
config = function()
require('gitblame').setup {
enabled = true,
display_virtual_text = false,
message_template = '<author> • <date>',
date_format = '%r'
}
end,
},
{
'lewis6991/gitsigns.nvim', -- git graphic helpers
config = function()
require('gitsigns').setup()
end,
},
{
'akinsho/git-conflict.nvim',
config = function()
require('git-conflict').setup {
default_commands = true, -- disable commands created by this plugin
disable_diagnostics = false, -- This will disable the diagnostics in a buffer whilst it is conflicted
list_opener = 'copen', -- command or function to open the conflicts list
highlights = { -- They must have background color, otherwise the default color will be used
incoming = 'DiffAdd',
current = 'DiffText',
},
default_mappings = {
ours = 'o',
theirs = 't',
none = '0',
both = 'b',
next = 'n',
prev = 'p',
},
}
end,
},
}

View File

@ -0,0 +1,3 @@
return {
'jparise/vim-graphql',
}

View File

@ -0,0 +1,3 @@
return {
'mattn/emmet-vim', -- emmet for vim
}

View File

@ -0,0 +1,54 @@
-- NOTES: disabled copilot it sucks ! FUCK AI
if true then return {} end
return {
{
"zbirenbaum/copilot.lua",
config = function()
require("config.lazy").setup({
panel = {
enabled = false, -- false for copilot-cmp
auto_refresh = false,
keymap = {
jump_prev = "[[",
jump_next = "]]",
accept = "<CR>",
refresh = "gr",
open = "<M-CR>"
},
layout = {
position = "bottom", -- | top | left | right
ratio = 0.4
},
},
suggestion = {
enabled = false, -- false for copilot-cmp
auto_trigger = true,
hide_during_completion = true,
debounce = 75,
keymap = {
accept = "<C-J>",
accept_word = false,
accept_line = false,
next = "<M-]>",
prev = "<M-[>",
dismiss = "<C-]>",
},
},
filetypes = {
yaml = true,
markdown = false,
help = false,
gitcommit = false,
gitrebase = false,
hgcommit = false,
svn = false,
cvs = false,
["."] = false,
},
copilot_node_command = 'node', -- Node.js version must be > 18.x
server_opts_overrides = {},
})
end,
},
}

View File

@ -0,0 +1,231 @@
return {
{
'neovim/nvim-lspconfig', -- LSP
config = function()
--vim.lsp.set_log_level("debug")
local status, nvim_lsp = pcall(require, "lspconfig")
if (not status) then return end
local protocol = require('vim.lsp.protocol')
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
--Enable completion triggered by <c-x><c-o>
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
local opts = { noremap = true, silent = true }
-- See `:help vim.lsp.*` for documentation on any of the below functions
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
--buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
end
protocol.CompletionItemKind = {
'', -- Text
'', -- Method
'', -- Function
'', -- Constructor
'', -- Field
'', -- Variable
'', -- Class
'', -- Interface
'', -- Module
'', -- Property
'', -- Unit
'', -- Value
'', -- Enum
'', -- Keyword
'', -- Snippet
'', -- Color
'', -- File
'', -- Reference
'', -- Folder
'', -- EnumMember
'', -- Constant
'', -- Struct
'', -- Event
'', -- Operator
'', -- TypeParameter
}
-- Set up completion using nvim_cmp with LSP source
local capabilities = require('cmp_nvim_lsp').default_capabilities(
vim.lsp.protocol.make_client_capabilities()
)
nvim_lsp.flow.setup {
on_attach = on_attach,
capabilities = capabilities
}
-- nvim_lsp.solargraph.setup {}
nvim_lsp.ts_ls.setup {
on_attach = on_attach,
filetypes = { "typescript", "typescriptreact", "typescript.tsx", "javascript", "vue" },
cmd = { "typescript-language-server", "--stdio" },
capabilities = capabilities
}
nvim_lsp.sourcekit.setup {
on_attach = on_attach,
}
nvim_lsp.lua_ls.setup {
on_attach = on_attach,
settings = {
Lua = {
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { 'vim' },
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
checkThirdParty = false
},
},
},
}
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
underline = true,
update_in_insert = false,
virtual_text = { spacing = 4, prefix = "" },
severity_sort = true,
}
)
-- Diagnostic symbols in the sign column (gutter)
local signs = { Error = "", Warn = "", Hint = "", Info = "" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
end
vim.diagnostic.config({
virtual_text = {
prefix = ''
},
update_in_insert = true,
float = {
source = "always", -- Or "if_many"
},
})
_timers = {}
local function setup_diagnostics(client, buffer)
if require("vim.lsp.diagnostic")._enable then
return
end
local diagnostic_handler = function()
local params = vim.lsp.util.make_text_document_params(buffer)
client.request("textDocument/diagnostic", { textDocument = params }, function(err, result)
if err then
local err_msg = string.format("diagnostics error - %s", vim.inspect(err))
vim.lsp.log.error(err_msg)
end
local diagnostic_items = {}
if result then
diagnostic_items = result.items
end
vim.lsp.diagnostic.on_publish_diagnostics(
nil,
vim.tbl_extend("keep", params, { diagnostics = diagnostic_items }),
{ client_id = client.id }
)
end)
end
diagnostic_handler() -- to request diagnostics on buffer when first attaching
vim.api.nvim_buf_attach(buffer, false, {
on_lines = function()
if _timers[buffer] then
vim.fn.timer_stop(_timers[buffer])
end
_timers[buffer] = vim.fn.timer_start(200, diagnostic_handler)
end,
on_detach = function()
if _timers[buffer] then
vim.fn.timer_stop(_timers[buffer])
end
end,
})
end
require("lspconfig").ruby_lsp.setup({
on_attach = function(client, buffer)
setup_diagnostics(client, buffer)
end,
})
end
},
{
'onsails/lspkind-nvim', -- vscode-like pictograms
config = function()
require('lspkind').init({
mode = 'symbol',
preset = 'codicons',
-- override preset symbols
--
-- default: {}
symbol_map = {
Text = "",
Method = "",
Function = "",
Constructor = "",
Field = "",
Variable = "",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "פּ",
Event = "",
Operator = "",
TypeParameter = ""
},
})
end
},
'jose-elias-alvarez/null-ls.nvim', -- inject LSP diagnostics, code actions
{
'glepnir/lspsaga.nvim', -- LSP UIs
config = function()
local opts = { noremap = true, silent = true }
vim.keymap.set('n', '<C-j>', '<Cmd>Lspsaga diagnostic_jump_next<CR>', opts)
vim.keymap.set('n', 'K', '<Cmd>Lspsaga hover_doc<CR>', opts)
-- vim.keymap.set('n', 'gd', '<Cmd>Lspsaga lsp_finder<CR>', opts)
vim.keymap.set('i', '<C-k>', '<Cmd>Lspsaga signature_help<CR>', opts)
vim.keymap.set('n', 'gp', '<Cmd>Lspsaga preview_definition<CR>', opts)
vim.keymap.set('n', 'gr', '<Cmd>Lspsaga rename<CR>', opts)
end
},
'folke/trouble.nvim', -- better diagnostics
}

View File

@ -0,0 +1,52 @@
return {
{
'nvim-lualine/lualine.nvim', -- Statusline
config = function()
local git_blame = require('gitblame')
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'auto',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'filename'},
-- add git blame text
lualine_c = {
{ git_blame.get_current_blame_text, cond = git_blame.is_blame_text_available }
},
lualine_x = {'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
}
end
},
}

View File

@ -0,0 +1,63 @@
return {
{
'mason-org/mason.nvim', -- manage lsp
config = function()
require('mason').setup()
end,
},
{
'mason-org/mason-lspconfig.nvim', -- bridge mason with lspconfig
config = function()
local on_attach = function(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
local opts = { noremap = true, silent = true }
-- Raccourcis LSP
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
buf_set_keymap('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
buf_set_keymap('n', '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
end
-- Configuration automatique pour TOUS les serveurs installés
require('mason-lspconfig').setup({
handlers = {
-- Handler par défaut pour tous les serveurs
function(server_name)
require("lspconfig")[server_name].setup({
on_attach = on_attach,
capabilities = require('cmp_nvim_lsp').default_capabilities(),
})
end,
}
})
-- Configuration globale des raccourcis LSP (au cas où on_attach ne fonctionne pas)
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
local bufnr = args.buf
print("LspAttach autocmd triggered for: " .. client.name) -- Debug
local opts = { noremap = true, silent = true, buffer = bufnr }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
vim.keymap.set('n', '<leader>ca', vim.lsp.buf.code_action, opts)
end,
})
end
}
}

View File

@ -0,0 +1,181 @@
return {
{
'nvim-neo-tree/neo-tree.nvim',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-tree/nvim-web-devicons',
'MunifTanjim/nui.nvim',
},
config = function()
require('neo-tree').setup({
close_if_last_window = false,
popup_border_style = "rounded",
enable_git_status = true,
enable_diagnostics = true,
default_component_configs = {
container = {
enable_character_fade = true
},
indent = {
indent_size = 2,
padding = 1,
with_markers = true,
indent_marker = "",
last_indent_marker = "",
highlight = "NeoTreeIndentMarker",
with_expanders = nil,
expander_collapsed = "",
expander_expanded = "",
expander_highlight = "NeoTreeExpander",
},
icon = {
folder_closed = "",
folder_open = "",
folder_empty = "",
default = "",
highlight = "NeoTreeFileIcon"
},
modified = {
symbol = "[+]",
highlight = "NeoTreeModified",
},
name = {
trailing_slash = false,
use_git_status_colors = true,
highlight = "NeoTreeFileName",
},
git_status = {
symbols = {
added = "",
modified = "",
deleted = "",
renamed = "󰁕",
untracked = "",
ignored = "",
unstaged = "󰄱",
staged = "",
conflict = "",
}
},
},
window = {
position = "left",
width = 30,
mapping_options = {
noremap = true,
nowait = true,
},
mappings = {
["<space>"] = {
"toggle_node",
nowait = false,
},
["<2-LeftMouse>"] = "open",
["<cr>"] = "open",
["o"] = "open",
["S"] = "open_split",
["s"] = "open_vsplit",
["t"] = "open_tabnew",
["w"] = "open_with_window_picker",
["C"] = "close_node",
["z"] = "close_all_nodes",
["a"] = {
"add",
config = {
show_path = "none"
}
},
["A"] = "add_directory",
["d"] = "delete",
["r"] = "rename",
["y"] = "copy_to_clipboard",
["x"] = "cut_to_clipboard",
["p"] = "paste_from_clipboard",
["c"] = "copy",
["m"] = "move",
["q"] = "close_window",
["R"] = "refresh",
["?"] = "show_help",
["<"] = "prev_source",
[">"] = "next_source",
}
},
filesystem = {
filtered_items = {
visible = false,
hide_dotfiles = false,
hide_gitignored = false,
hide_hidden = true,
hide_by_name = {
"node_modules"
},
hide_by_pattern = {
"*.meta",
"*/src/*/tsconfig.json",
},
always_show = {
".gitignore"
},
never_show = {
".DS_Store",
"thumbs.db"
},
},
follow_current_file = {
enabled = true,
leave_dirs_open = false,
},
group_empty_dirs = false,
hijack_netrw_behavior = "open_default",
use_libuv_file_watcher = false,
window = {
mappings = {
["<bs>"] = "navigate_up",
["."] = "set_root",
["H"] = "toggle_hidden",
["/"] = "fuzzy_finder",
["D"] = "fuzzy_finder_directory",
["f"] = "filter_on_submit",
["<c-x>"] = "clear_filter",
["[g"] = "prev_git_modified",
["]g"] = "next_git_modified",
}
}
},
buffers = {
follow_current_file = {
enabled = true,
leave_dirs_open = false,
},
group_empty_dirs = true,
show_unloaded = true,
window = {
mappings = {
["bd"] = "buffer_delete",
["<bs>"] = "navigate_up",
["."] = "set_root",
}
},
},
git_status = {
window = {
position = "float",
mappings = {
["A"] = "git_add_all",
["gu"] = "git_unstage_file",
["ga"] = "git_add_file",
["gr"] = "git_revert_file",
["gc"] = "git_commit",
["gp"] = "git_push",
["gg"] = "git_commit_and_push",
}
}
}
})
-- Raccourcis clavier
vim.keymap.set('n', '<c-t>', ':Neotree toggle<CR>', { noremap = true, silent = true })
vim.keymap.set('n', '<c-f>', ':Neotree focus<CR>', { noremap = true, silent = true })
end
},
}

View File

@ -0,0 +1,9 @@
return {
'nvim-tree/nvim-web-devicons', -- use devicons
{
'luukvbaal/stabilize.nvim', -- to fix my fucking headache when openclosed panes
config = function()
require('stabilize').setup()
end,
},
}

View File

@ -0,0 +1,5 @@
return {
'vim-ruby/vim-ruby',
'tpope/vim-rails', -- helpers Econtroller Emodel, Eview and other rails tools
'tpope/vim-endwise', -- autoclose function
}

View File

@ -0,0 +1,7 @@
return {
'rust-lang/rust.vim',
{
'saecki/crates.nvim',
requires = { 'nvim-lua/plenary.nvim' },
},
}

View File

@ -0,0 +1,15 @@
return {
{
'L3MON4D3/LuaSnip',
config = function()
require('luasnip.loaders.from_snipmate').lazy_load()
require('luasnip.loaders.from_vscode').lazy_load()
end,
},
{
'honza/vim-snippets',
requires = {
'L3MON4D3/LuaSnip',
},
},
}

View File

@ -0,0 +1,62 @@
return {
{
'nvim-telescope/telescope.nvim', -- equivalent ctrl-p, fzf
dependencies = {
'nvim-lua/plenary.nvim',
},
config = function()
local actions = require('telescope.actions')
local builtin = require('telescope.builtin')
require('telescope').setup {
defaults = {
mappings = {
n = {
["q"] = actions.close
},
},
},
pickers = {
git_files = {
theme = 'dropdown',
}
},
}
vim.keymap.set('n', '<C-p>', function()
builtin.find_files({
hidden = true
})
end)
vim.keymap.set('n', ';r', function()
builtin.live_grep()
end)
vim.keymap.set('n', '\\\\', function()
builtin.buffers()
end)
vim.keymap.set('n', ';g', function()
builtin.git_status()
end)
vim.keymap.set('n', ';;', function()
builtin.resume()
end)
vim.keymap.set('n', ';e', function()
builtin.diagnostics()
end)
end,
},
{
"kelly-lin/telescope-ag", -- silver search with telescope
dependencies = {
"nvim-telescope/telescope.nvim"
},
config = function()
require('telescope').load_extension('ag')
end,
}
}

View File

@ -0,0 +1,29 @@
return {
{
'projekt0n/github-nvim-theme',
config = function()
require('github-theme').setup({
options = {
styles = {
functions = "NONE"
},
darken = { -- Darken floating windows and sidebar-like windows
floats = false,
sidebars = {
enable = true,
list = {"qf", "vista_kind", "terminal", "packer"}, -- Apply dark background to specific windows
},
},
},
palettes = {
all = {
hint = "orange",
error = "#ff0000"
},
},
})
vim.cmd[[colorscheme github_dark_high_contrast]]
end,
},
}

View File

@ -0,0 +1,5 @@
return {
'peitalin/vim-jsx-typescript',
'pangloss/vim-javascript',
'leafgarland/typescript-vim',
}