comments and better cmp scoring

This commit is contained in:
Christian Nieves
2023-11-19 18:53:07 -06:00
parent 2ef4eb8c41
commit 1c0fa0e214
7 changed files with 57 additions and 26 deletions

View File

@ -34,7 +34,6 @@ return {
},
{ "simrat39/rust-tools.nvim", ft = "rust" },
"RRethy/vim-illuminate",
{
"rafcamlet/nvim-luapad",
config = function()
@ -53,6 +52,7 @@ return {
"kosayoda/nvim-lightbulb",
"ntpeters/vim-better-whitespace",
"junegunn/fzf.vim",
"AndrewRadev/tagalong.vim",
"tversteeg/registers.nvim",
"jremmen/vim-ripgrep",
{ "andymass/vim-matchup", event = "VimEnter" },

View File

@ -54,6 +54,7 @@ return {
vim.opt.completeopt = { "menu", "menuone", "noselect" }
local cmp = require("cmp")
local compare = cmp.config.compare
local conditionalSources = {}
@ -94,9 +95,22 @@ return {
{ name = "luasnip", priority = 8 },
{ name = "nvim_lsp", priority = 7 },
{ name = "spell" },
{ name = "treesitter", priority = 6 },
{ name = "treesitter" },
{ name = "buffer" },
}, conditionalSources)),
sorting = {
comparators = {
compare.score, -- based on : score = score + ((#sources - (source_index - 1)) * sorting.priority_weight)
compare.offset,
--compare.order,
--compare.sort_text,
-- compare.exact,
-- compare.kind,
-- compare.length,
},
},
formatting = {
format = lspkind.cmp_format({
menu = {

View File

@ -1,6 +1,13 @@
return {
"numToStr/Comment.nvim",
lazy = false,
keys = {
{ "<leader>c<space>", mode = "n", desc = "Comment toggle current line" },
{ "gc", mode = { "n", "o" }, desc = "Comment toggle linewise" },
{ "gc", mode = "x", desc = "Comment toggle linewise (visual)" },
{ "gbc", mode = "n", desc = "Comment toggle current block" },
{ "gb", mode = { "n", "o" }, desc = "Comment toggle blockwise" },
{ "gb", mode = "x", desc = "Comment toggle blockwise (visual)" },
},
config = function()
local ft = require("Comment.ft")
ft.gd = "# %s"