fix completions
This commit is contained in:
1 parent
9700278b5f
commit
c8e4b090d5
6 files changed
+71
-15
No files matched your search
@@ -9,6 +9,8 @@ vim.pack.add({
|
|||||||
{ src = "https://github.com/nvim-lualine/lualine.nvim" },
|
{ src = "https://github.com/nvim-lualine/lualine.nvim" },
|
||||||
{ src = "https://github.com/nvim-mini/mini.nvim" },
|
{ src = "https://github.com/nvim-mini/mini.nvim" },
|
||||||
{ src = "https://github.com/rafamadriz/friendly-snippets" },
|
{ src = "https://github.com/rafamadriz/friendly-snippets" },
|
||||||
|
{ src = "https://github.com/iamcco/markdown-preview.nvim" },
|
||||||
|
{ src = "https://github.com/kepano/flexoki-neovim" },
|
||||||
})
|
})
|
||||||
|
|
||||||
require('lualineconf')
|
require('lualineconf')
|
||||||
|
|||||||
+16
-1
@@ -1,9 +1,24 @@
|
|||||||
vim.lsp.enable({ "lua_ls", "nixd", "clang", "rust-analyzer"})
|
vim.lsp.enable({ "lua_ls", "nixd", "clang", "rust-analyzer" })
|
||||||
|
|
||||||
-- RUST
|
-- RUST
|
||||||
vim.lsp.config('rust-analyzer', {
|
vim.lsp.config('rust-analyzer', {
|
||||||
cmd = { 'rust-analyzer' },
|
cmd = { 'rust-analyzer' },
|
||||||
filetypes = { 'rust' },
|
filetypes = { 'rust' },
|
||||||
|
settings = {
|
||||||
|
["rust_analyzer"] = {
|
||||||
|
completion = {
|
||||||
|
callable = {
|
||||||
|
snippets = "fill_arguments",
|
||||||
|
},
|
||||||
|
postfix = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
autoimport = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- NIX
|
-- NIX
|
||||||
|
|||||||
+41
-12
@@ -5,12 +5,12 @@ require('mini.icons').setup()
|
|||||||
|
|
||||||
-- Notifications
|
-- Notifications
|
||||||
require('mini.notify').setup({
|
require('mini.notify').setup({
|
||||||
-- only show messages
|
-- only show messages
|
||||||
content = {
|
content = {
|
||||||
format = function(notif)
|
format = function(notif)
|
||||||
return notif.msg
|
return notif.msg
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Commandline
|
-- Commandline
|
||||||
@@ -20,22 +20,51 @@ require('mini.cmdline').setup({
|
|||||||
|
|
||||||
-- Autocompletion
|
-- Autocompletion
|
||||||
local MiniCompletion = require('mini.completion')
|
local MiniCompletion = require('mini.completion')
|
||||||
|
|
||||||
|
-- Priority
|
||||||
|
local kind_priority = {
|
||||||
|
[5] = 1, -- Field (Struct fields)
|
||||||
|
[10] = 1, -- Property
|
||||||
|
[2] = 2, -- Method
|
||||||
|
[3] = 3, -- Function
|
||||||
|
[6] = 4, -- Variable
|
||||||
|
}
|
||||||
|
|
||||||
MiniCompletion.setup({
|
MiniCompletion.setup({
|
||||||
lsp_completion = {
|
lsp_completion = {
|
||||||
auto_setup = true,
|
auto_setup = true,
|
||||||
process_items = function(items, base)
|
process_items = function(items, base)
|
||||||
return MiniCompletion.default_process_items(items, base, {
|
-- 1. Apply standard fuzzy matching and basic sorting first
|
||||||
|
items = MiniCompletion.default_process_items(items, base, {
|
||||||
filtersort = "fuzzy",
|
filtersort = "fuzzy",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- 2. Sort by custom kind priority (Fields -> Methods -> Functions -> Others -> Snippets/Text)
|
||||||
|
table.sort(items, function(a, b)
|
||||||
|
local prio_a = kind_priority[a.kind] or 100
|
||||||
|
local prio_b = kind_priority[b.kind] or 100
|
||||||
|
|
||||||
|
-- Push Snippets (15) and Text (1) to the absolute bottom
|
||||||
|
if a.kind == 15 or a.kind == 1 then prio_a = 999 end
|
||||||
|
if b.kind == 15 or b.kind == 1 then prio_b = 999 end
|
||||||
|
|
||||||
|
if prio_a ~= prio_b then
|
||||||
|
return prio_a < prio_b
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Fallback to default sortText or label when kinds match
|
||||||
|
return (a.sortText or a.label) < (b.sortText or b.label)
|
||||||
|
end)
|
||||||
|
|
||||||
|
return items
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
local MiniSnipets = require('mini.snippets')
|
local MiniSnippets = require('mini.snippets')
|
||||||
MiniSnipets.setup({
|
MiniSnippets.setup({
|
||||||
snippets = {
|
snippets = {
|
||||||
MiniSnipets.gen_loader.from_lang(),
|
MiniSnippets.gen_loader.from_lang(),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
MiniSnipets.start_lsp_server({ match = false })
|
MiniSnippets.start_lsp_server({ match = MiniSnippets.default_match })
|
||||||
|
|
||||||
@@ -38,4 +38,5 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.cmd("syntax enable")
|
vim.cmd("syntax enable")
|
||||||
+3
-2
@@ -53,6 +53,7 @@ require("oil").setup({
|
|||||||
view_options = { show_hidden = true },
|
view_options = { show_hidden = true },
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.cmd("colorscheme habamax")
|
-- vim.cmd("colorscheme habamax")
|
||||||
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
vim.cmd("colorscheme flexoki-dark")
|
||||||
|
-- vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
||||||
|
|
||||||
@@ -16,6 +16,10 @@
|
|||||||
"rev": "d1e7c7c45d45c6b6a25427bf62db4db73b03ff3d",
|
"rev": "d1e7c7c45d45c6b6a25427bf62db4db73b03ff3d",
|
||||||
"src": "https://github.com/Saghen/blink.nvim"
|
"src": "https://github.com/Saghen/blink.nvim"
|
||||||
},
|
},
|
||||||
|
"flexoki-neovim": {
|
||||||
|
"rev": "c3e2251e813d29d885a7cbbe9808a7af234d845d",
|
||||||
|
"src": "https://github.com/kepano/flexoki-neovim"
|
||||||
|
},
|
||||||
"friendly-snippets": {
|
"friendly-snippets": {
|
||||||
"rev": "6cd7280adead7f586db6fccbd15d2cac7e2188b9",
|
"rev": "6cd7280adead7f586db6fccbd15d2cac7e2188b9",
|
||||||
"src": "https://github.com/rafamadriz/friendly-snippets"
|
"src": "https://github.com/rafamadriz/friendly-snippets"
|
||||||
@@ -28,6 +32,10 @@
|
|||||||
"rev": "221ce6b2d999187044529f49da6554a92f740a96",
|
"rev": "221ce6b2d999187044529f49da6554a92f740a96",
|
||||||
"src": "https://github.com/nvim-lualine/lualine.nvim"
|
"src": "https://github.com/nvim-lualine/lualine.nvim"
|
||||||
},
|
},
|
||||||
|
"markdown-preview.nvim": {
|
||||||
|
"rev": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee",
|
||||||
|
"src": "https://github.com/iamcco/markdown-preview.nvim"
|
||||||
|
},
|
||||||
"mini.nvim": {
|
"mini.nvim": {
|
||||||
"rev": "946ae64e0ee807ae3c41f382f0114b4ed4915b2c",
|
"rev": "946ae64e0ee807ae3c41f382f0114b4ed4915b2c",
|
||||||
"src": "https://github.com/nvim-mini/mini.nvim"
|
"src": "https://github.com/nvim-mini/mini.nvim"
|
||||||
|
|||||||
Reference in new issue
Block a user