This commit is contained in:
ant 2023-12-08 00:40:10 +07:00
parent a785f25b83
commit 843582f1c8
4 changed files with 114 additions and 64 deletions

View file

@ -31,7 +31,10 @@ local options = {
end,
},
sources = {
{ name = "luasnip" },
{ name = "nvim_lsp" },
-- { name = 'nvim_lsp_signature_help' },
{ name = "nvim_lsp_document_symbol" },
{ name = "nvim_lua" },
{ name = "path" },
},

View file

@ -1,57 +1,50 @@
require("mason-lspconfig").setup_handlers {
-- The first entry (without a key) will be the default handler
-- and will be called for each installed server that doesn't have
-- a dedicated handler.
function(server_name) -- default handler (optional)
require("lspconfig")[server_name].setup {}
end,
-- Next, you can provide a dedicated handler for specific servers.
-- For example, a handler override for the `rust_analyzer`:
-- ["rust_analyzer"] = function ()
-- require("rust-tools").setup {}
-- end
["lua_ls"] = function()
require("lspconfig").lua_ls.setup {
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
workspace = {
library = {
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
[vim.fn.stdpath "data" .. "/lazy/extensions/nvchad_types"] = true,
[vim.fn.stdpath "data" .. "/lazy/lazy.nvim/lua/lazy"] = true,
},
maxPreload = 100000,
preloadFileSize = 10000,
},
},
local default = {
on_attach = function(client, bufnr)
require "lsp_signature".on_attach(
{
bind = true, -- This is mandatory, otherwise border config won't get registered.
handler_opts = {
border = "none"
},
hint_enable = false,
doc_lines = 0,
floating_window_off_x = 999,
floating_window_off_y = 1,
-- floating_window = false,
}
, bufnr) -- Note: add in lsp client on-attach
end,
capabilities = require('cmp_nvim_lsp').default_capabilities()
}
["ltex"] = function()
require("lspconfig").ltex.setup {
local servers = {
java_language_server = { cmd = {"java-language-server"} },
ocamllsp = {},
-- "pyright",
lua_ls = {},
clangd = {},
jedi_language_server = {},
nil_ls = {},
ltex = {
settings = {
ltex = {
language = "fr",
checkFrequency = "save"
},
-- set formatter
formatters = {
["latexindent"] = {
exe = "latexindent",
args = { "-sl", "-g /dev/stderr" },
stdin = true,
},
},
},
}
}
}
for server, config in pairs(servers) do
local lsp = require("lspconfig")[server]
-- print(server)
local config = vim.tbl_deep_extend("keep", config, default, lsp.document_config.default_config)
if config.cmd ~= nil then
if vim.fn.executable(config.cmd[1]) == 1 then
lsp.setup(config)
end
end
end
}
vim.diagnostic.config({
virtual_text = false,

View file

@ -15,6 +15,11 @@ vim.keymap.set(
'<leader>ff',
"<cmd> Telescope find_files follow=true <CR>"
)
vim.keymap.set(
'n',
'<leader>fg',
"<cmd> Telescope live_grep <CR>"
)
vim.keymap.set(
'n',
'<leader>fF',
@ -31,6 +36,15 @@ vim.keymap.set('n', '<leader>N', "<cmd> Neogit <cr>", { desc = "Open Neogit" })
vim.keymap.set('n', '<a-f1>', "<cmd> Copilot <cr>", { desc = "Start Copilot" })
vim.keymap.set('x', 'p', 'p:let @+=@0<CR>:let @"=@0<CR>', { desc = "Start Copilot" })
-- Luasnip
local ls = require("luasnip")
vim.keymap.set({"i", "s"}, "<A-j>", function() ls.jump( 1) end, {silent = true})
vim.keymap.set({"i", "s"}, "<A-k>", function() ls.jump(-1) end, {silent = true})
-- Hop
vim.keymap.set({'n', 'v'}, 'f', "<cmd> HopWord <cr>", { desc = "HopWord" })
-- Global mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
-- Use LspAttach autocommand to only map the following keys

View file

@ -13,16 +13,17 @@ local plugins = {
require('configs.treesitter')
end,
},
{
"williamboman/mason-lspconfig.nvim",
dependencies = {
"williamboman/mason.nvim",
},
config = function()
require("mason").setup()
require("mason-lspconfig").setup()
end
},
-- {
-- "williamboman/mason-lspconfig.nvim",
-- dependencies = {
-- "williamboman/mason.nvim",
-- },
-- config = function()
-- require("mason").setup()
-- require("mason-lspconfig").setup()
-- --
-- end
-- },
{
"neovim/nvim-lspconfig",
config = function()
@ -60,7 +61,13 @@ local plugins = {
crust = "#000000",
},
},
custom_highlights = {},
custom_highlights = function(C)
return {
HopNextKey = { bg = C.text, fg = C.base, style = { "bold", "underline" } },
HopNextKey1 = { bg = C.text, fg = C.base, style = { "bold" } },
HopNextKey2 = { bg = C.text, fg = C.base, style = { "bold", "italic" } },
}
end,
integrations = {
cmp = true,
gitsigns = true,
@ -72,6 +79,7 @@ local plugins = {
illuminate = false,
-- noice = true,
notify = true,
flash = true,
telescope = {
enabled = true,
style = "nvchad"
@ -80,6 +88,9 @@ local plugins = {
enabled = true,
enable_ui = true, -- enable nvim-dap-ui
},
indent_blankline = {
enabled = true,
},
native_lsp = {
enabled = true,
virtual_text = {
@ -136,7 +147,16 @@ local plugins = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-path",
{
"L3MON4D3/LuaSnip",
dependencies = {
"rafamadriz/friendly-snippets",
},
init = function()
require("luasnip.loaders.from_vscode").lazy_load()
end
},
'saadparwaiz1/cmp_luasnip'
},
},
@ -306,7 +326,16 @@ local plugins = {
)
end,
},
{ "lukas-reineke/indent-blankline.nvim" },
{
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
opts = {
scope = {
show_start = false,
show_end = false,
},
},
},
{
'michaelb/sniprun',
-- run = 'sh ./install.sh',
@ -390,7 +419,18 @@ local plugins = {
render = "minimal",
stages = "static",
}
}
},
{
"ray-x/lsp_signature.nvim",
event = "VeryLazy",
},
{
'smoka7/hop.nvim',
version = "*",
opts = {
uppercase_labels = true,
},
},
}
return plugins