Migration from packer to lazy.nvim

main
theodugautier 2025-07-17 00:26:57 +02:00
parent fd2c1d305a
commit cd92e00593
24 changed files with 88 additions and 1222 deletions

View File

@ -1,6 +0,0 @@
local ok, autopairs = pcall(require, "nvim-autopairs")
if (not ok) then return end
autopairs.setup({
disable_filetype = { "TelescopePrompt" , "vim" },
})

View File

@ -1,69 +0,0 @@
local ok, cmp = pcall(require, "cmp")
if (not ok) then return end
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
]]

View File

@ -1,4 +0,0 @@
local ok, comment = pcall(require, "Comment")
if (not ok) then return end
comment.setup()

View File

@ -1,47 +0,0 @@
local ok, copilot = pcall(require, 'copilot')
if (not ok) then return end
copilot.setup({
panel = {
enabled = true, -- 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 = true, -- 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 = {},
})

View File

@ -1,33 +0,0 @@
local ok, _ = pcall(require, 'formatter')
if (not ok) then return end
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
}
}
}

View File

@ -1,20 +0,0 @@
local ok, _ = pcall(require, 'git-conflict')
if (not ok) then return end
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',
},
}

View File

@ -1,10 +0,0 @@
local ok, _ = pcall(require, "gitblame")
if (not ok) then return end
require('gitblame').setup {
--Note how the `gitblame_` prefix is omitted in `setup`
enabled = false,
display_virtual_text = false,
message_template = '<author> • <date>',
date_format = '%r'
}

View File

@ -1,4 +0,0 @@
local ok, gitsigns = pcall(require, "gitsigns")
if (not ok) then return end
gitsigns.setup {}

View File

@ -1,47 +0,0 @@
local ok, lspkind = pcall(require, "lspkind")
if (not ok) then return end
lspkind.init({
-- enables text annotations
--
-- default: true
mode = 'symbol',
-- default symbol map
-- can be either 'default' (requires nerd-fonts font) or
-- 'codicons' for codicon preset (requires vscode-codicons font)
--
-- default: 'default'
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 = ""
},
})

View File

@ -1,47 +0,0 @@
local ok, lualine = pcall(require, "lualine")
local git_blame = require('gitblame')
if (not ok) then return end
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 = {}
}

View File

@ -1,3 +0,0 @@
require('luasnip.loaders.from_snipmate').lazy_load()
require('luasnip.loaders.from_vscode').lazy_load()

View File

@ -1,61 +0,0 @@
local ok, mason = pcall(require, "mason")
if (not ok) then return end
mason.setup()
local ok, mason_lspconfig = pcall(require, "mason-lspconfig")
if (not ok) then return end
mason_lspconfig.setup()
-- Fonction on_attach avec les raccourcis
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
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,
})

View File

@ -1,174 +0,0 @@
local status, neotree = pcall(require, "neo-tree")
if not status then
return
end
neotree.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 })

View File

@ -1,4 +0,0 @@
local ok, stabilize = pcall(require, 'stabilize')
if (not ok) then return end
stabilize.setup()

View File

@ -1,48 +0,0 @@
local ok, telescope = pcall(require, 'telescope')
if (not ok) then return end
local actions = require('telescope.actions')
local builtin = require('telescope.builtin')
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)
telescope.load_extension("ag")

View File

@ -1,10 +1,6 @@
require('plugins') require("lazy-config")
require('lsp.lspconfig')
require('lsp.lspsaga')
require('settings') require('settings')
require('settings.filetype') require('settings.filetype')
require('settings.colors') require('settings.colors')
require('settings.keymaps') require('settings.keymaps')
require('settings.theme')

View File

@ -0,0 +1,48 @@
{
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
"LuaSnip": { "branch": "master", "commit": "66b5c2707e624dcd2cd3605676c64a2efe47e9d1" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
"cmp-path": { "branch": "main", "commit": "e52e640b7befd8113b3350f46e8cfcfe98fcf730" },
"crates.nvim": { "branch": "main", "commit": "33ec63096f7f72b610ed3bb1760be34c2fffb694" },
"delimitMate": { "branch": "master", "commit": "becbd2d353a2366171852387288ebb4b33a02487" },
"emmet-vim": { "branch": "master", "commit": "e98397144982d1e75b20d94d55a82de3ec8f648d" },
"formatter.nvim": { "branch": "master", "commit": "b9d7f853da1197b83b8edb4cc4952f7ad3a42e41" },
"git-blame.nvim": { "branch": "master", "commit": "8503b199edf9a666fe7b1a989cf14e3c26b2eb03" },
"git-conflict.nvim": { "branch": "main", "commit": "a1badcd070d176172940eb55d9d59029dad1c5a6" },
"github-nvim-theme": { "branch": "main", "commit": "c106c9472154d6b2c74b74565616b877ae8ed31d" },
"gitsigns.nvim": { "branch": "main", "commit": "0cb5a7753d3c4b8e9cfdc9d88d9110cb8d4b1544" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
"lspkind-nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
"lspsaga.nvim": { "branch": "main", "commit": "8efe00d6aed9db6449969f889170f1a7e43101a1" },
"lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "bc743e4f3dc4b6d22b0a9e0b68a6664d93f8a694" },
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
"neo-tree.nvim": { "branch": "main", "commit": "84c3df0aa276da7f6095b000de314986f7b5ac98" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
"nvim-lspconfig": { "branch": "master", "commit": "5bb3fb4a63eb38361f3f992618f65dd4fa52e72b" },
"nvim-web-devicons": { "branch": "master", "commit": "0422a19d9aa3aad2c7e5cca167e5407b13407a9d" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"rust.vim": { "branch": "master", "commit": "889b9a7515db477f4cb6808bef1769e53493c578" },
"splitjoin.vim": { "branch": "main", "commit": "d6e48fb035c90262bbe6276e6b83d35cb641c014" },
"stabilize.nvim": { "branch": "master", "commit": "eeb1873daffaba67246188a5668b366e45ed1de1" },
"telescope-ag": { "branch": "main", "commit": "7d25064da3c7689461bcfa89ad1f08548415193d" },
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
"typescript-vim": { "branch": "master", "commit": "4740441db1e070ef8366c888c658000dd032e4cb" },
"vim-css-color": { "branch": "master", "commit": "14fd934cdd9ca1ac0e53511094e612eb9bace373" },
"vim-endwise": { "branch": "master", "commit": "eab530110d7a0d985902a3964894816b50dbf31a" },
"vim-graphql": { "branch": "master", "commit": "3583ea204e5d51529a56c9e9aecf4bfd9cfc6120" },
"vim-illuminate": { "branch": "master", "commit": "0d1e93684da00ab7c057410fecfc24f434698898" },
"vim-javascript": { "branch": "master", "commit": "b26c9edb3563e02f5c0b20580f7cf9743e95b157" },
"vim-jsx-typescript": { "branch": "master", "commit": "22df470d92651426f2377e3166488672f7b4b4ef" },
"vim-rails": { "branch": "master", "commit": "b0a5c76f86ea214ade36ab0b811e730c3f0add67" },
"vim-ruby": { "branch": "master", "commit": "bf3a5994ce63796db7b1b04aea92772271f387aa" },
"vim-snippets": { "branch": "master", "commit": "f0a3184d9f90b96b044d5914625a25c554d7f301" },
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
"vim-test": { "branch": "master", "commit": "fba18e168565f055d4061408ada0f6abd9ea8bbd" },
"vim-trailing-whitespace": { "branch": "master", "commit": "5540b3faa2288b226a8d9a4e8244558b12c598aa" }
}

View File

@ -0,0 +1,37 @@
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Make sure to setup `mapleader` and `maplocalleader` before
-- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = ","
vim.g.maplocalleader = "\\"
-- Setup lazy.nvim
require("lazy").setup({
spec = {
-- import your plugins
{ import = "plugins" },
},
-- Configure any other settings here. See the documentation for more details.
-- colorscheme that will be used when installing plugins.
install = { colorscheme = { "habamax" } },
-- automatically check for plugin updates
checker = { enabled = true },
})

View File

@ -1,171 +0,0 @@
--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,
})

View File

@ -1,10 +0,0 @@
local status, saga = pcall(require, "lspsaga")
if (not status) then return end
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)

View File

@ -1,107 +0,0 @@
local ensure_packer = function()
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
vim.cmd [[packadd packer.nvim]]
return true
end
return false
end
local packer_bootstrap = ensure_packer()
local status, packer = pcall(require, "packer")
if (not status) then
print("Packer is not installed")
return
end
return packer.startup(function(use)
use 'wbthomason/packer.nvim'
-- appearances
use 'projekt0n/github-nvim-theme'
use 'nvim-lualine/lualine.nvim' -- Statusline
-- LSP and completion
use 'nvim-lua/plenary.nvim' -- Common utilities
use 'neovim/nvim-lspconfig' -- LSP
use 'onsails/lspkind-nvim' -- vscode-like pictograms
use 'hrsh7th/cmp-buffer' -- nvim-cmp source for buffer words
use 'hrsh7th/cmp-path' -- completion pathname
use 'hrsh7th/cmp-nvim-lsp' -- nvim-cmp source for neovim's built-in LSP
use 'hrsh7th/nvim-cmp' -- Completion
use 'jose-elias-alvarez/null-ls.nvim' -- inject LSP diagnostics, code actions
use 'glepnir/lspsaga.nvim' -- LSP UIs
use 'mason-org/mason.nvim' -- manage lsp
use "mason-org/mason-lspconfig.nvim" -- bridge mason with lspconfig
-- Snippets
use 'L3MON4D3/LuaSnip'
use 'honza/vim-snippets'
-- code fasters
use 'Raimondi/delimitMate' -- auto close colon
use 'mattn/emmet-vim' -- emmet for vim
use 'tpope/vim-surround' -- just tpope the GOD OF VIM
use 'ap/vim-css-color' -- colors display
use 'numToStr/Comment.nvim' -- comments tools
use 'mhartington/formatter.nvim' -- format code
use 'AndrewRadev/splitjoin.vim' -- refactor plugin
use 'RRethy/vim-illuminate' -- highlight other uses of the word under the cursor
use 'folke/trouble.nvim' -- better diagnostics
-- Ruby development
use 'vim-ruby/vim-ruby'
use 'tpope/vim-rails'
use 'tpope/vim-endwise' -- autoclose function
-- javacript development
use 'peitalin/vim-jsx-typescript'
use 'pangloss/vim-javascript'
use 'leafgarland/typescript-vim'
-- GraphQl
use 'jparise/vim-graphql'
-- Rust development
use 'rust-lang/rust.vim'
use { 'saecki/crates.nvim', requires = { 'nvim-lua/plenary.nvim' } }
-- IA
use { "zbirenbaum/copilot.lua" }
-- Testing
use { 'vim-test/vim-test' }
-- others utilities
use 'nvim-telescope/telescope.nvim' -- equivalent ctrl-p, fzf
use({ "kelly-lin/telescope-ag", requires = { { "nvim-telescope/telescope.nvim" } } }) -- silver search with telescope
use 'windwp/nvim-autopairs' -- auto brackets pairing
use 'lewis6991/gitsigns.nvim' -- git graphic helpers
use 'bronson/vim-trailing-whitespace' -- detect trailing-whitespace
use 'nvim-tree/nvim-web-devicons' -- use devicons
-- File explorer moderne
use {
'nvim-neo-tree/neo-tree.nvim',
branch = 'v3.x',
requires = {
'nvim-lua/plenary.nvim',
'nvim-tree/nvim-web-devicons',
'MunifTanjim/nui.nvim',
}
}
use "luukvbaal/stabilize.nvim" -- to fix my fucking headache when openclosed panes
use 'f-person/git-blame.nvim'
use {'akinsho/git-conflict.nvim', tag = "*", config = function() -- conflict management
require('git-conflict').setup()
end}
if packer_bootstrap then
require('packer').sync()
end
end)

View File

@ -2,7 +2,8 @@ vim.cmd("autocmd!")
vim.scriptencoding = 'utf-8' vim.scriptencoding = 'utf-8'
vim.opt.encoding = 'utf-8' vim.opt.encoding = 'utf-8'
vim.opt.fileencoding = 'utf-8' vim.cmd('set fileencoding=utf-8')
-- vim.opt.fileencoding = 'utf-8'
vim.opt.clipboard:append { 'unnamedplus' } vim.opt.clipboard:append { 'unnamedplus' }
vim.opt.autoread = true vim.opt.autoread = true

View File

@ -1,22 +0,0 @@
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]]

View File

@ -1,329 +0,0 @@
-- Automatically generated packer.nvim plugin loader code
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
return
end
vim.api.nvim_command('packadd packer.nvim')
local no_errors, error_msg = pcall(function()
_G._packer = _G._packer or {}
_G._packer.inside_compile = true
local time
local profile_info
local should_profile = false
if should_profile then
local hrtime = vim.loop.hrtime
profile_info = {}
time = function(chunk, start)
if start then
profile_info[chunk] = hrtime()
else
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
end
end
else
time = function(chunk, start) end
end
local function save_profiles(threshold)
local sorted_times = {}
for chunk_name, time_taken in pairs(profile_info) do
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
end
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
local results = {}
for i, elem in ipairs(sorted_times) do
if not threshold or threshold and elem[2] > threshold then
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
end
end
if threshold then
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
end
_G._packer.profile_output = results
end
time([[Luarocks path setup]], true)
local package_path_str = "/Users/torpenn/.cache/nvim/packer_hererocks/2.1.1744318430/share/lua/5.1/?.lua;/Users/torpenn/.cache/nvim/packer_hererocks/2.1.1744318430/share/lua/5.1/?/init.lua;/Users/torpenn/.cache/nvim/packer_hererocks/2.1.1744318430/lib/luarocks/rocks-5.1/?.lua;/Users/torpenn/.cache/nvim/packer_hererocks/2.1.1744318430/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/Users/torpenn/.cache/nvim/packer_hererocks/2.1.1744318430/lib/lua/5.1/?.so"
if not string.find(package.path, package_path_str, 1, true) then
package.path = package.path .. ';' .. package_path_str
end
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
package.cpath = package.cpath .. ';' .. install_cpath_pattern
end
time([[Luarocks path setup]], false)
time([[try_loadstring definition]], true)
local function try_loadstring(s, component, name)
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
if not success then
vim.schedule(function()
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
end)
end
return result
end
time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true)
_G.packer_plugins = {
LuaSnip = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/LuaSnip",
url = "https://github.com/L3MON4D3/LuaSnip"
},
["cmp-buffer"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/cmp-buffer",
url = "https://github.com/hrsh7th/cmp-buffer"
},
["cmp-nvim-lsp"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
},
["cmp-path"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/cmp-path",
url = "https://github.com/hrsh7th/cmp-path"
},
["copilot.lua"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/copilot.lua",
url = "https://github.com/zbirenbaum/copilot.lua"
},
["crates.nvim"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/crates.nvim",
url = "https://github.com/saecki/crates.nvim"
},
delimitMate = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/delimitMate",
url = "https://github.com/Raimondi/delimitMate"
},
["emmet-vim"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/emmet-vim",
url = "https://github.com/mattn/emmet-vim"
},
["formatter.nvim"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/formatter.nvim",
url = "https://github.com/mhartington/formatter.nvim"
},
["git-blame.nvim"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/git-blame.nvim",
url = "https://github.com/f-person/git-blame.nvim"
},
["git-conflict.nvim"] = {
config = { "\27LJ\2\n:\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\17git-conflict\frequire\0" },
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/git-conflict.nvim",
url = "https://github.com/akinsho/git-conflict.nvim"
},
["github-nvim-theme"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/github-nvim-theme",
url = "https://github.com/projekt0n/github-nvim-theme"
},
["gitsigns.nvim"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
url = "https://github.com/lewis6991/gitsigns.nvim"
},
["lspkind-nvim"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/lspkind-nvim",
url = "https://github.com/onsails/lspkind-nvim"
},
["lspsaga.nvim"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/lspsaga.nvim",
url = "https://github.com/glepnir/lspsaga.nvim"
},
["lualine.nvim"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/lualine.nvim",
url = "https://github.com/nvim-lualine/lualine.nvim"
},
["mason-lspconfig.nvim"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
url = "https://github.com/mason-org/mason-lspconfig.nvim"
},
["mason.nvim"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/mason.nvim",
url = "https://github.com/mason-org/mason.nvim"
},
["null-ls.nvim"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/null-ls.nvim",
url = "https://github.com/jose-elias-alvarez/null-ls.nvim"
},
["nvim-autopairs"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/nvim-autopairs",
url = "https://github.com/windwp/nvim-autopairs"
},
["nvim-cmp"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/nvim-cmp",
url = "https://github.com/hrsh7th/nvim-cmp"
},
["nvim-comment"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/nvim-comment",
url = "https://github.com/terrortylor/nvim-comment"
},
["nvim-lspconfig"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
url = "https://github.com/neovim/nvim-lspconfig"
},
["nvim-tree.lua"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
url = "https://github.com/nvim-tree/nvim-tree.lua"
},
["nvim-web-devicons"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
url = "https://github.com/nvim-tree/nvim-web-devicons"
},
["packer.nvim"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/packer.nvim",
url = "https://github.com/wbthomason/packer.nvim"
},
["plenary.nvim"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/plenary.nvim",
url = "https://github.com/nvim-lua/plenary.nvim"
},
["rust.vim"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/rust.vim",
url = "https://github.com/rust-lang/rust.vim"
},
["splitjoin.vim"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/splitjoin.vim",
url = "https://github.com/AndrewRadev/splitjoin.vim"
},
["stabilize.nvim"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/stabilize.nvim",
url = "https://github.com/luukvbaal/stabilize.nvim"
},
["telescope-ag"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/telescope-ag",
url = "https://github.com/kelly-lin/telescope-ag"
},
["telescope.nvim"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/telescope.nvim",
url = "https://github.com/nvim-telescope/telescope.nvim"
},
["trouble.nvim"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/trouble.nvim",
url = "https://github.com/folke/trouble.nvim"
},
["typescript-vim"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/typescript-vim",
url = "https://github.com/leafgarland/typescript-vim"
},
["vim-css-color"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-css-color",
url = "https://github.com/ap/vim-css-color"
},
["vim-endwise"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-endwise",
url = "https://github.com/tpope/vim-endwise"
},
["vim-graphql"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-graphql",
url = "https://github.com/jparise/vim-graphql"
},
["vim-illuminate"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-illuminate",
url = "https://github.com/RRethy/vim-illuminate"
},
["vim-javascript"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-javascript",
url = "https://github.com/pangloss/vim-javascript"
},
["vim-jsx-typescript"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-jsx-typescript",
url = "https://github.com/peitalin/vim-jsx-typescript"
},
["vim-rails"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-rails",
url = "https://github.com/tpope/vim-rails"
},
["vim-ruby"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-ruby",
url = "https://github.com/vim-ruby/vim-ruby"
},
["vim-snippets"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-snippets",
url = "https://github.com/honza/vim-snippets"
},
["vim-surround"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-surround",
url = "https://github.com/tpope/vim-surround"
},
["vim-test"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-test",
url = "https://github.com/vim-test/vim-test"
},
["vim-trailing-whitespace"] = {
loaded = true,
path = "/Users/torpenn/.local/share/nvim/site/pack/packer/start/vim-trailing-whitespace",
url = "https://github.com/bronson/vim-trailing-whitespace"
}
}
time([[Defining packer_plugins]], false)
-- Config for: git-conflict.nvim
time([[Config for git-conflict.nvim]], true)
try_loadstring("\27LJ\2\n:\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\17git-conflict\frequire\0", "config", "git-conflict.nvim")
time([[Config for git-conflict.nvim]], false)
_G._packer.inside_compile = false
if _G._packer.needs_bufread == true then
vim.cmd("doautocmd BufRead")
end
_G._packer.needs_bufread = false
if should_profile then save_profiles() end
end)
if not no_errors then
error_msg = error_msg:gsub('"', '\\"')
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
end