feat(nvim): Major source overhaul
This commit is contained in:
parent
efc11e7c89
commit
7352aaad29
@ -1,4 +1,5 @@
|
||||
local cmp = require("cmp")
|
||||
local compare = cmp.config.compare
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
local kind_icons = {
|
||||
@ -44,12 +45,20 @@ cmp.setup({
|
||||
vim_item.kind = string.format("%s %s", kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind
|
||||
-- Source
|
||||
vim_item.menu = ({
|
||||
buffer = "[Buffer]",
|
||||
nvim_lsp = "[LSP]",
|
||||
fuzzy_buffer = "[Buffer]",
|
||||
nvim_lsp = "[Lsp]",
|
||||
luasnip = "[LuaSnip]",
|
||||
nvim_lua = "[Lua]",
|
||||
latex_symbols = "[LaTeX]",
|
||||
path = "[Path]",
|
||||
dictionary = "[Dictionary]",
|
||||
calc = "[Calculator]",
|
||||
neorg = "[Neorg]",
|
||||
emoji = "[Emoji]",
|
||||
zsh = "[Zsh]",
|
||||
crates = "[Crates]",
|
||||
cmdline_history = "[Cmd History]",
|
||||
rg = "[Ripgrep]",
|
||||
npm = "[Npm],",
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end,
|
||||
@ -120,52 +129,81 @@ cmp.setup({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "path" },
|
||||
{ name = "buffer" },
|
||||
{ name = "emoji" },
|
||||
{ name = "neorg" },
|
||||
{ name = "luasnip" }, -- For luasnip users.
|
||||
-- { name = "git" },
|
||||
{ name = "calc" },
|
||||
{ name = "zsh" },
|
||||
{ name = "fuzzy_buffer" },
|
||||
{ name = "rg" },
|
||||
{ name = "npm", keyword_length = 2 },
|
||||
{
|
||||
name = "dictionary",
|
||||
keyword_length = 2,
|
||||
},
|
||||
}),
|
||||
sorting = {
|
||||
priority_weight = 2,
|
||||
comparators = {
|
||||
require("cmp_fuzzy_buffer.compare"),
|
||||
compare.offset,
|
||||
compare.exact,
|
||||
compare.score,
|
||||
compare.recently_used,
|
||||
compare.kind,
|
||||
compare.sort_text,
|
||||
compare.length,
|
||||
compare.order,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- Configure Dictionary
|
||||
require("cmp_dictionary").setup({
|
||||
dic = {
|
||||
["*"] = { "~/.dict/primary_dict" },
|
||||
["*"] = { require("os").getenv("HOME") .. "/.dict/primary_dict" },
|
||||
},
|
||||
async = true
|
||||
first_case_insensitive = true,
|
||||
async = true,
|
||||
})
|
||||
|
||||
-- Git Commit Completions
|
||||
cmp.setup.filetype("gitcommit", {
|
||||
sources = cmp.config.sources({
|
||||
{ name = "cmp_git" },
|
||||
}, {
|
||||
{ name = "conventionalcommits" },
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
})
|
||||
|
||||
cmp.setup.filetype("toml", {
|
||||
sources = cmp.config.sources({
|
||||
{ name = "crates" },
|
||||
}),
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline("/", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp_document_symbol" },
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
-- { name = "buffer" },
|
||||
{ name = "fuzzy_buffer" },
|
||||
{ name = "cmdline_history" },
|
||||
}),
|
||||
})
|
||||
|
||||
cmp.setup.cmdline("?", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp_document_symbol" },
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
{ name = "fuzzy_buffer" },
|
||||
{ name = "cmdline_history" },
|
||||
}),
|
||||
})
|
||||
|
||||
cmp.setup.cmdline("@", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "fuzzy_buffer" },
|
||||
{ name = "cmdline_history" },
|
||||
}),
|
||||
})
|
||||
|
||||
@ -174,7 +212,7 @@ cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "cmdline" },
|
||||
{ name = "cmdline_history" },
|
||||
}),
|
||||
})
|
||||
|
@ -273,21 +273,38 @@ return packer.startup({
|
||||
"hrsh7th/nvim-cmp",
|
||||
requires = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/cmp-emoji",
|
||||
"hrsh7th/vim-vsnip",
|
||||
"hrsh7th/cmp-nvim-lsp-document-symbol",
|
||||
"hrsh7th/cmp-calc",
|
||||
"petertriho/cmp-git",
|
||||
"davidsierradz/cmp-conventionalcommits",
|
||||
"uga-rosa/cmp-dictionary",
|
||||
"tamago324/cmp-zsh",
|
||||
"dmitmel/cmp-cmdline-history",
|
||||
"David-Kunz/cmp-npm",
|
||||
},
|
||||
config = function()
|
||||
require("plugins.configs._cmp")
|
||||
end,
|
||||
})
|
||||
|
||||
use({ "romgrk/fzy-lua-native", run = "make" })
|
||||
use({
|
||||
"tzachar/cmp-fuzzy-buffer",
|
||||
requires = { "hrsh7th/nvim-cmp", "tzachar/fuzzy.nvim" },
|
||||
})
|
||||
use({ "tzachar/cmp-fuzzy-path", requires = { "hrsh7th/nvim-cmp", "tzachar/fuzzy.nvim" } })
|
||||
use({
|
||||
"saecki/crates.nvim",
|
||||
event = { "BufRead Cargo.toml" },
|
||||
requires = { { "nvim-lua/plenary.nvim" } },
|
||||
config = function()
|
||||
require("crates").setup()
|
||||
end,
|
||||
})
|
||||
|
||||
-- Show code outline
|
||||
use({
|
||||
"simrat39/symbols-outline.nvim",
|
||||
|
713741
.dict/primary_dict
713741
.dict/primary_dict
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user