udpates
This commit is contained in:
parent
9ca3c33cd2
commit
f703852dd5
13 changed files with 166 additions and 437 deletions
2
init.lua
2
init.lua
|
@ -26,3 +26,5 @@ require("lazy").setup("plugins", {
|
||||||
vim.cmd("colorscheme material")
|
vim.cmd("colorscheme material")
|
||||||
require("tools")
|
require("tools")
|
||||||
require("autocommands")
|
require("autocommands")
|
||||||
|
|
||||||
|
print("DONE")
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
"glow.nvim": { "branch": "advanced_window", "commit": "f1157d4cb7e46e830c72004e7e1adb81a1f9b04c" },
|
"glow.nvim": { "branch": "advanced_window", "commit": "f1157d4cb7e46e830c72004e7e1adb81a1f9b04c" },
|
||||||
"indent-blankline.nvim": { "branch": "master", "commit": "4541d690816cb99a7fc248f1486aa87f3abce91c" },
|
"indent-blankline.nvim": { "branch": "master", "commit": "4541d690816cb99a7fc248f1486aa87f3abce91c" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "5af331ea65418dc9361769891921fdee4bcc837a" },
|
"lazy.nvim": { "branch": "main", "commit": "5af331ea65418dc9361769891921fdee4bcc837a" },
|
||||||
|
"lazygit.nvim": { "branch": "main", "commit": "3466e48439601445e26c65635421625886f2d0c0" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" },
|
"lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "82685fdd0f67a694b244cb058b83761f54664d68" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "82685fdd0f67a694b244cb058b83761f54664d68" },
|
||||||
"mason-null-ls.nvim": { "branch": "main", "commit": "ae0c5fa57468ac65617f1bf821ba0c3a1e251f0c" },
|
"mason-null-ls.nvim": { "branch": "main", "commit": "ae0c5fa57468ac65617f1bf821ba0c3a1e251f0c" },
|
||||||
|
@ -33,5 +34,6 @@
|
||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" },
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" },
|
||||||
"telescope.nvim": { "branch": "master", "commit": "c1a2af0af69e80e14e6b226d3957a064cd080805" },
|
"telescope.nvim": { "branch": "master", "commit": "c1a2af0af69e80e14e6b226d3957a064cd080805" },
|
||||||
"text-case.nvim": { "branch": "main", "commit": "cd7cc65a412beb713e68f3b84e45990a939b7b6b" },
|
"text-case.nvim": { "branch": "main", "commit": "cd7cc65a412beb713e68f3b84e45990a939b7b6b" },
|
||||||
"undotree": { "branch": "master", "commit": "485f01efde4e22cb1ce547b9e8c9238f36566f21" }
|
"undotree": { "branch": "master", "commit": "485f01efde4e22cb1ce547b9e8c9238f36566f21" },
|
||||||
|
"vim-fugitive": { "branch": "master", "commit": "43f18ab9155c853a84ded560c6104e6300ad41da" }
|
||||||
}
|
}
|
|
@ -65,6 +65,8 @@ require("util").keymaps({
|
||||||
'd:let @u = trim(tolower(system("uuidgen")))<cr>i<C-r>u',
|
'd:let @u = trim(tolower(system("uuidgen")))<cr>i<C-r>u',
|
||||||
desc = "Generate and replace UUID",
|
desc = "Generate and replace UUID",
|
||||||
},
|
},
|
||||||
|
["<leader>y"] = { '"*y', desc = "Copy to system clipboard" },
|
||||||
|
["<Leader>p"] = { '"*p', desc = "Paste from system clipboard" },
|
||||||
},
|
},
|
||||||
i = {
|
i = {
|
||||||
["<C-k>"] = { "<Up>", desc = "Up" },
|
["<C-k>"] = { "<Up>", desc = "Up" },
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
# Plugins to look into
|
|
||||||
|
|
||||||
- https://github.com/lvimuser/lsp-inlayhints.nvim/tree/anticonceal
|
|
||||||
- https://github.com/theHamsta/nvim-dap-virtual-text/tree/inline-text
|
|
||||||
- https://github.com/andythigpen/nvim-coverage
|
|
||||||
- https://github.com/lukas-reineke/indent-blankline.nvim
|
|
||||||
- https://github.com/johmsalas/text-case.nvim
|
|
||||||
- gitsigns?
|
|
||||||
- casing plugins?
|
|
||||||
["<leader>,"] = { name = " Misc Tools" },
|
|
||||||
["<leader>,c"] = { name = " Casing" },
|
|
||||||
["<leader>,cs"] = { ":Snek<CR>", desc = "To Snek Case" },
|
|
||||||
["<leader>,cc"] = { ":Camel<CR>", desc = "To Camel Case" },
|
|
||||||
["<leader>,cp"] = { ":CamelB<CR>", desc = "To Pascal Case" },
|
|
||||||
["<leader>,ck"] = { ":Kebab<CR>", desc = "To Kebab Case" },
|
|
||||||
["<leader>,ce"] = { ":Screm<CR>", desc = "To Screm Case" },
|
|
||||||
- https://github.com/tpope/vim-fugitive
|
|
||||||
- https://github.com/folke/noice.nvim
|
|
||||||
- greg's: https://github.com/gblock0/dotfiles/blob/master/nvim/.config/nvim/lua/gb/plugins.lua
|
|
||||||
- others: https://nvimluau.dev/
|
|
||||||
- https://github.com/NvChad/nvim-colorizer.lua
|
|
||||||
- https://github.com/numToStr/Comment.nvim
|
|
||||||
- https://github.com/windwp/nvim-autopairs
|
|
||||||
- https://github.com/lukas-reineke/indent-blankline.nvim
|
|
3
lua/plugins/git_fugitive.lua
Normal file
3
lua/plugins/git_fugitive.lua
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
return {
|
||||||
|
"tpope/vim-fugitive",
|
||||||
|
}
|
|
@ -1,8 +1,23 @@
|
||||||
vim.cmd([[highlight IndentBlanklineIndent1 guifg=#E06C75 gui=nocombine]])
|
-- Rainbow verison
|
||||||
vim.cmd([[highlight IndentBlanklineIndent2 guifg=#E5C07B gui=nocombine]])
|
--vim.cmd([[highlight IndentBlanklineIndent1 guifg=#E06C75 gui=nocombine]])
|
||||||
vim.cmd([[highlight IndentBlanklineIndent3 guifg=#98C379 gui=nocombine]])
|
--vim.cmd([[highlight IndentBlanklineIndent2 guifg=#E5C07B gui=nocombine]])
|
||||||
vim.cmd([[highlight IndentBlanklineIndent4 guifg=#61AFEF gui=nocombine]])
|
--vim.cmd([[highlight IndentBlanklineIndent3 guifg=#98C379 gui=nocombine]])
|
||||||
vim.cmd([[highlight IndentBlanklineIndent5 guifg=#C678DD gui=nocombine]])
|
--vim.cmd([[highlight IndentBlanklineIndent4 guifg=#61AFEF gui=nocombine]])
|
||||||
|
--vim.cmd([[highlight IndentBlanklineIndent5 guifg=#C678DD gui=nocombine]])
|
||||||
|
|
||||||
|
-- Grayscale version
|
||||||
|
--vim.cmd([[highlight IndentBlanklineIndent1 guifg=#707070 gui=nocombine]])
|
||||||
|
--vim.cmd([[highlight IndentBlanklineIndent2 guifg=#808080 gui=nocombine]])
|
||||||
|
--vim.cmd([[highlight IndentBlanklineIndent3 guifg=#909090 gui=nocombine]])
|
||||||
|
--vim.cmd([[highlight IndentBlanklineIndent4 guifg=#a0a0a0 gui=nocombine]])
|
||||||
|
--vim.cmd([[highlight IndentBlanklineIndent5 guifg=#b0b0b0 gui=nocombine]])
|
||||||
|
|
||||||
|
-- Dull version
|
||||||
|
vim.cmd([[highlight IndentBlanklineIndent1 guifg=#915053 gui=nocombine]])
|
||||||
|
vim.cmd([[highlight IndentBlanklineIndent2 guifg=#A27F3E gui=nocombine]])
|
||||||
|
vim.cmd([[highlight IndentBlanklineIndent3 guifg=#6B7F6E gui=nocombine]])
|
||||||
|
vim.cmd([[highlight IndentBlanklineIndent4 guifg=#5A747D gui=nocombine]])
|
||||||
|
vim.cmd([[highlight IndentBlanklineIndent5 guifg=#6B6282 gui=nocombine]])
|
||||||
|
|
||||||
vim.opt.list = true
|
vim.opt.list = true
|
||||||
-- vim.opt.listchars:append "space:⋅"
|
-- vim.opt.listchars:append "space:⋅"
|
||||||
|
|
30
lua/plugins/lazygit.lua
Normal file
30
lua/plugins/lazygit.lua
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
function prereqs()
|
||||||
|
local output = vim.fn.system({
|
||||||
|
"which",
|
||||||
|
"lazygit",
|
||||||
|
})
|
||||||
|
if output == nil or output == "" then
|
||||||
|
print("Installing lazygit with rtx")
|
||||||
|
-- if v:shell_error != 0 then
|
||||||
|
vim.fn.system({
|
||||||
|
"rtx",
|
||||||
|
"global",
|
||||||
|
"lazygit@latest",
|
||||||
|
})
|
||||||
|
vim.fn.system({
|
||||||
|
"rtx",
|
||||||
|
"install",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
"kdheepak/lazygit.nvim",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
},
|
||||||
|
build = prereqs,
|
||||||
|
keys = {
|
||||||
|
{ "<leader>gg", "<cmd>LazyGit<cr>", desc = "Open lazy git ui" },
|
||||||
|
},
|
||||||
|
}
|
|
@ -74,5 +74,8 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
tabline = {
|
||||||
|
lualine_a = { "filename" }
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,24 @@
|
||||||
-- npm install -g cspell@latest
|
function prereqs()
|
||||||
|
local output = vim.fn.system({
|
||||||
local output = vim.fn.system({
|
|
||||||
"which",
|
"which",
|
||||||
"cspell",
|
"cspell",
|
||||||
})
|
})
|
||||||
if output == nil or output == "" then
|
if output == nil or output == "" then
|
||||||
-- if v:shell_error != 0 then
|
print("Installing cspell globally with npm")
|
||||||
vim.fn.system({
|
vim.fn.system({
|
||||||
"npm",
|
"npm",
|
||||||
"install",
|
"install",
|
||||||
"-g",
|
"-g",
|
||||||
"cspell@latest",
|
"cspell@latest",
|
||||||
})
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"jose-elias-alvarez/null-ls.nvim",
|
"jose-elias-alvarez/null-ls.nvim",
|
||||||
dependencies = { "williamboman/mason.nvim" },
|
dependencies = { "williamboman/mason.nvim" },
|
||||||
|
build = prereqs,
|
||||||
opts = function(_, config)
|
opts = function(_, config)
|
||||||
-- config variable is the default definitions table for the setup function call
|
-- config variable is the default definitions table for the setup function call
|
||||||
local null_ls = require("null-ls")
|
local null_ls = require("null-ls")
|
||||||
|
|
|
@ -2,6 +2,6 @@ return {
|
||||||
"Almo7aya/openingh.nvim",
|
"Almo7aya/openingh.nvim",
|
||||||
event = "BufEnter",
|
event = "BufEnter",
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>gf", ":OpenInGHFile <CR>", desc = "Open in git" },
|
{ "<leader>gf", "<cmd>OpenInGHFile<CR>", desc = "Open in git" },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
11
lua/plugins_disabled/README.md
Normal file
11
lua/plugins_disabled/README.md
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# Plugins to look into
|
||||||
|
- https://github.com/lvimuser/lsp-inlayhints.nvim/tree/anticonceal
|
||||||
|
- https://github.com/theHamsta/nvim-dap-virtual-text/tree/inline-text
|
||||||
|
- https://github.com/andythigpen/nvim-coverage
|
||||||
|
- https://github.com/lukas-reineke/indent-blankline.nvim
|
||||||
|
- gitsigns?
|
||||||
|
- https://github.com/folke/noice.nvim
|
||||||
|
- others: https://nvimluau.dev/
|
||||||
|
- https://github.com/numToStr/Comment.nvim
|
||||||
|
- https://github.com/windwp/nvim-autopairs
|
||||||
|
- https://github.com/lukas-reineke/indent-blankline.nvim
|
|
@ -1,136 +0,0 @@
|
||||||
return {
|
|
||||||
{
|
|
||||||
"L3MON4D3/LuaSnip",
|
|
||||||
dependencies = { "rafamadriz/friendly-snippets" },
|
|
||||||
opts = {
|
|
||||||
history = true,
|
|
||||||
updateevents = "TextChanged,TextChangedI",
|
|
||||||
opts = { store_selection_keys = "<C-x>" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"hrsh7th/nvim-cmp",
|
|
||||||
event = "InsertEnter",
|
|
||||||
dependencies = {
|
|
||||||
-- Snips
|
|
||||||
{
|
|
||||||
"windwp/nvim-autopairs",
|
|
||||||
opts = {
|
|
||||||
fast_wrap = {},
|
|
||||||
disable_filetype = { "TelescopePrompt", "vim" },
|
|
||||||
},
|
|
||||||
config = function(_, opts)
|
|
||||||
require("nvim-autopairs").setup(opts)
|
|
||||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
|
||||||
require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{ "saadparwaiz1/cmp_luasnip" },
|
|
||||||
-- { "hrsh7th/cmp-nvim-lua" },
|
|
||||||
-- { "hrsh7th/cmp-nvim-lsp" },
|
|
||||||
-- { "hrsh7th/cmp-vsnip" },
|
|
||||||
{ "hrsh7th/cmp-buffer" },
|
|
||||||
{ "hrsh7th/cmp-path" },
|
|
||||||
-- { "hrsh7th/cmp-cmdline" },
|
|
||||||
{ "hrsh7th/cmp-nvim-lsp" },
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" })
|
|
||||||
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" })
|
|
||||||
|
|
||||||
local cmp = require("cmp")
|
|
||||||
local snip_status_ok, luasnip = pcall(require, "luasnip")
|
|
||||||
local lspkind_status_ok, lspkind = pcall(require, "lspkind")
|
|
||||||
if not snip_status_ok then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local border_opts = {
|
|
||||||
border = "single",
|
|
||||||
winhighlight = "Normal:Normal,FloatBorder:FloatBorder,CursorLine:Visual,Search:None",
|
|
||||||
}
|
|
||||||
|
|
||||||
cmp.setup({
|
|
||||||
enabled = function()
|
|
||||||
local dap_prompt = vim.tbl_contains(
|
|
||||||
{ "dap-repl", "dapui_watches", "dapui_hover" },
|
|
||||||
vim.api.nvim_get_option_value("filetype", { buf = 0 })
|
|
||||||
)
|
|
||||||
if vim.api.nvim_get_option_value("buftype", { buf = 0 }) == "prompt" and not dap_prompt then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
return vim.g.cmp_enabled
|
|
||||||
end,
|
|
||||||
window = {
|
|
||||||
completion = cmp.config.window.bordered(border_opts),
|
|
||||||
documentation = cmp.config.window.bordered(border_opts),
|
|
||||||
},
|
|
||||||
preselect = cmp.PreselectMode.None,
|
|
||||||
formatting = {
|
|
||||||
fields = { "kind", "abbr", "menu" },
|
|
||||||
format = lspkind_status_ok and lspkind.cmp_format(utils.plugin_opts("lspkind.nvim")) or nil,
|
|
||||||
},
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
luasnip.lsp_expand(args.body)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
duplicates = {
|
|
||||||
nvim_lsp = 1,
|
|
||||||
luasnip = 1,
|
|
||||||
cmp_tabnine = 1,
|
|
||||||
buffer = 1,
|
|
||||||
path = 1,
|
|
||||||
},
|
|
||||||
confirm_opts = {
|
|
||||||
behavior = cmp.ConfirmBehavior.Replace,
|
|
||||||
select = false,
|
|
||||||
},
|
|
||||||
mapping = {
|
|
||||||
["<Up>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
|
|
||||||
["<Down>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
|
|
||||||
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
|
||||||
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
|
||||||
["<C-k>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
|
||||||
["<C-j>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
|
||||||
["<C-u>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
|
|
||||||
["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
|
|
||||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
|
||||||
["<C-y>"] = cmp.config.disable,
|
|
||||||
["<C-e>"] = cmp.mapping({ i = cmp.mapping.abort(), c = cmp.mapping.close() }),
|
|
||||||
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_next_item()
|
|
||||||
elseif luasnip.expand_or_jumpable() then
|
|
||||||
luasnip.expand_or_jump()
|
|
||||||
elseif has_words_before() then
|
|
||||||
cmp.complete()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { "i", "s" }),
|
|
||||||
["<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" }),
|
|
||||||
},
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = "nvim_lsp", priority = 1000 },
|
|
||||||
{ name = "luasnip", priority = 750 },
|
|
||||||
{ name = "buffer", priority = 500 },
|
|
||||||
{ name = "path", priority = 250 },
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"folke/neodev.nvim",
|
|
||||||
opts = {},
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,180 +0,0 @@
|
||||||
return {
|
|
||||||
"VonHeikemen/lsp-zero.nvim",
|
|
||||||
branch = "v2.x",
|
|
||||||
dependencies = {
|
|
||||||
-- LSP Support
|
|
||||||
{ "neovim/nvim-lspconfig" },
|
|
||||||
{
|
|
||||||
"williamboman/mason.nvim",
|
|
||||||
cmd = {
|
|
||||||
"Mason",
|
|
||||||
"MasonUpdate",
|
|
||||||
"MasonInstall",
|
|
||||||
"MasonInstallAll",
|
|
||||||
"MasonUninstall",
|
|
||||||
"MasonUninstallAll",
|
|
||||||
"MasonLog",
|
|
||||||
},
|
|
||||||
build = ":MasonUpdate",
|
|
||||||
event = "BufRead",
|
|
||||||
},
|
|
||||||
{ "williamboman/mason-lspconfig.nvim" },
|
|
||||||
-- Autocompletion
|
|
||||||
{
|
|
||||||
"hrsh7th/nvim-cmp",
|
|
||||||
event = "InsertEnter",
|
|
||||||
dependencies = {
|
|
||||||
-- Snips
|
|
||||||
{
|
|
||||||
"L3MON4D3/LuaSnip",
|
|
||||||
dependencies = "rafamadriz/friendly-snippets",
|
|
||||||
opts = {
|
|
||||||
history = true,
|
|
||||||
updateevents = "TextChanged,TextChangedI",
|
|
||||||
-- config? -- https://github.com/NvChad/NvChad/blob/v2.0/lua/plugins/configs/others.lua#L25-L50
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"windwp/nvim-autopairs",
|
|
||||||
opts = {
|
|
||||||
fast_wrap = {},
|
|
||||||
disable_filetype = { "TelescopePrompt", "vim" },
|
|
||||||
},
|
|
||||||
config = function(_, opts)
|
|
||||||
require("nvim-autopairs").setup(opts)
|
|
||||||
-- setup cmp for autopairs
|
|
||||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
|
||||||
require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{ "saadparwaiz1/cmp_luasnip" },
|
|
||||||
{ "hrsh7th/cmp-nvim-lua" },
|
|
||||||
{ "hrsh7th/cmp-nvim-lsp" },
|
|
||||||
{ "hrsh7th/cmp-buffer" },
|
|
||||||
{ "hrsh7th/cmp-path" },
|
|
||||||
{ "hrsh7th/cmp-cmdline" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
local lsp = require("lsp-zero").preset({})
|
|
||||||
local config = require("lspconfig")
|
|
||||||
local util = require("lspconfig/util")
|
|
||||||
|
|
||||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
|
||||||
capabilities = vim.tbl_deep_extend("keep", capabilities, vim.lsp.protocol.make_client_capabilities())
|
|
||||||
capabilities.textDocument.completion.completionItem = {
|
|
||||||
documentationFormat = { "markdown", "plaintext" },
|
|
||||||
snippetSupport = true,
|
|
||||||
preselectSupport = true,
|
|
||||||
insertReplaceSupport = true,
|
|
||||||
labelDetailsSupport = true,
|
|
||||||
deprecatedSupport = true,
|
|
||||||
commitCharactersSupport = true,
|
|
||||||
tagSupport = { valueSet = { 1 } },
|
|
||||||
resolveSupport = {
|
|
||||||
properties = {
|
|
||||||
"documentation",
|
|
||||||
"detail",
|
|
||||||
"additionalTextEdits",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
local on_attach = function(client, bufnr)
|
|
||||||
client.server_capabilities.documentFormattingProvider = false
|
|
||||||
client.server_capabilities.documentRangeFormattingProvider = false
|
|
||||||
|
|
||||||
lsp.default_keymaps({ buffer = bufnr })
|
|
||||||
|
|
||||||
local opts = { buffer = bufnr }
|
|
||||||
local bind = function(map, cmd, mode)
|
|
||||||
vim.keymap.set("n", map, cmd, opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- diagnostics
|
|
||||||
bind("<leader>ld", "<cmd>lua vim.diagnostic.open_float()<CR>")
|
|
||||||
bind("<leader>[d", "<cmd>lua vim.diagnostic.goto_prev()<CR>")
|
|
||||||
bind("<leader>]d", "<cmd>lua vim.diagnostic.goto_next()<CR>")
|
|
||||||
|
|
||||||
bind("<leader>la", "<cmd>lua vim.lsp.buf.code_action()<CR>")
|
|
||||||
end
|
|
||||||
|
|
||||||
lsp.on_attach(on_attach)
|
|
||||||
local servers = {
|
|
||||||
-- -- https://github.com/williamboman/mason-lspconfig.nvim#available-lsp-servers
|
|
||||||
-- lua
|
|
||||||
"lua_ls",
|
|
||||||
-- rust
|
|
||||||
"rust_analyzer",
|
|
||||||
-- ts/js | web
|
|
||||||
"tsserver",
|
|
||||||
"html",
|
|
||||||
"eslint",
|
|
||||||
"cssls",
|
|
||||||
"cssmodules_ls",
|
|
||||||
|
|
||||||
-- python
|
|
||||||
"pyright",
|
|
||||||
|
|
||||||
-- docker
|
|
||||||
"dockerls",
|
|
||||||
"docker_compose_language_service",
|
|
||||||
}
|
|
||||||
lsp.ensure_installed(servers)
|
|
||||||
|
|
||||||
local default = require("util").spread({
|
|
||||||
on_attach = on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
})
|
|
||||||
|
|
||||||
config.lua_ls.setup(lsp.nvim_lua_ls())
|
|
||||||
|
|
||||||
config.rust_analyzer.setup(default({}))
|
|
||||||
|
|
||||||
config.tsserver.setup(default({
|
|
||||||
root_dir = util.root_pattern("tsconfig.json", ".git"),
|
|
||||||
}))
|
|
||||||
config.html.setup(default({}))
|
|
||||||
config.eslint.setup(default({}))
|
|
||||||
config.cssls.setup(default({}))
|
|
||||||
config.cssmodules_ls.setup(default({}))
|
|
||||||
|
|
||||||
config.pyright.setup(default({}))
|
|
||||||
|
|
||||||
config.dockerls.setup(default({}))
|
|
||||||
config.docker_compose_language_service.setup(default({}))
|
|
||||||
|
|
||||||
lsp.setup()
|
|
||||||
|
|
||||||
local cmp = require("cmp")
|
|
||||||
local cmp_action = require("lsp-zero").cmp_action()
|
|
||||||
|
|
||||||
cmp.setup({
|
|
||||||
window = {
|
|
||||||
documentation = cmp.config.window.bordered(),
|
|
||||||
},
|
|
||||||
sources = {
|
|
||||||
{ name = "nvim_lsp", priority = 1000 },
|
|
||||||
{ name = "luasnip", priority = 750, keyword_length = 2 },
|
|
||||||
{ name = "buffer", priority = 500, keyword_length = 3 },
|
|
||||||
{ nane = "nvim_lua", print = 250, keyword_length = 3 },
|
|
||||||
{ name = "path", priority = 150, keyword_length = 3 },
|
|
||||||
-- { name = "cmdline", priority = 50, keyword_length = 5 },
|
|
||||||
},
|
|
||||||
mapping = {
|
|
||||||
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
|
||||||
["<Tab>"] = cmp_action.tab_complete(),
|
|
||||||
["<S-Tab>"] = cmp_action.select_prev_or_fallback(),
|
|
||||||
-- Ctrl+Space to trigger completion menu
|
|
||||||
["<C-Space>"] = cmp.mapping.complete(),
|
|
||||||
|
|
||||||
["<C-f>"] = cmp_action.luasnip_jump_forward(),
|
|
||||||
["<C-b>"] = cmp_action.luasnip_jump_backward(),
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
-- keys = {
|
|
||||||
-- { "<leader>l", "<Nop>", desc = "LSP" },
|
|
||||||
-- },
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue