mirror of
https://github.com/zoriya/flake.git
synced 2026-06-05 11:39:51 +00:00
Add lsp bindings
This commit is contained in:
@@ -48,6 +48,35 @@ local lsp_keymaps = function(buffer)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local kind_icons = {
|
||||||
|
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 = "",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"dundalek/lazy-lsp.nvim",
|
"dundalek/lazy-lsp.nvim",
|
||||||
@@ -128,4 +157,60 @@ return {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
version = false, -- last release is way too old
|
||||||
|
event = "InsertEnter",
|
||||||
|
dependencies = {
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
"hrsh7th/cmp-buffer",
|
||||||
|
"hrsh7th/cmp-path",
|
||||||
|
"saadparwaiz1/cmp_luasnip",
|
||||||
|
},
|
||||||
|
opts = function()
|
||||||
|
local cmp = require("cmp")
|
||||||
|
return {
|
||||||
|
completion = {
|
||||||
|
completeopt = "menu,menuone,noinsert",
|
||||||
|
},
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
require("luasnip").lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||||
|
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||||
|
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
|
["<C-Space>"] = cmp.mapping.complete(),
|
||||||
|
["<C-e>"] = cmp.mapping.abort(),
|
||||||
|
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = "luasnip" },
|
||||||
|
{ name = "path" },
|
||||||
|
}),
|
||||||
|
formatting = {
|
||||||
|
fields = { "abbr", "kind" },
|
||||||
|
format = function(_, vim_item)
|
||||||
|
vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind)
|
||||||
|
return vim_item
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
navigation = {
|
||||||
|
documentation = {
|
||||||
|
border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
experimental = {
|
||||||
|
ghost_text = {
|
||||||
|
hl_group = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ local options = {
|
|||||||
smartcase = true,
|
smartcase = true,
|
||||||
|
|
||||||
mouse = "a",
|
mouse = "a",
|
||||||
|
mousemodel = "extend",
|
||||||
splitbelow = true,
|
splitbelow = true,
|
||||||
splitright = true,
|
splitright = true,
|
||||||
cursorline = true,
|
cursorline = true,
|
||||||
|
|||||||
Reference in New Issue
Block a user