summaryrefslogtreecommitdiff
path: root/lua/plugins
diff options
context:
space:
mode:
authorlistout <listout@protonmail.com>2022-09-10 13:52:15 +0530
committerlistout <listout@protonmail.com>2022-09-10 13:52:15 +0530
commita5cd2ad2a3b9b36f92c148cc72280c48dea8c894 (patch)
treea06d3c49eebefa22a2f3ec9da2434f82324422e4 /lua/plugins
parent5a25cff140799e5a21623e72b6fde26a1c63e581 (diff)
nvim: cmp: use icons (dependent on font)
Signed-off-by: listout <listout@protonmail.com>
Diffstat (limited to 'lua/plugins')
-rw-r--r--lua/plugins/cmp.lua46
1 files changed, 46 insertions, 0 deletions
diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua
index a72ab05..6c09612 100644
--- a/lua/plugins/cmp.lua
+++ b/lua/plugins/cmp.lua
@@ -1,9 +1,55 @@
-- luasnip setup
local luasnip = require 'luasnip'
+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 = ""
+}
+
-- nvim-cmp setup
local cmp = require 'cmp'
cmp.setup {
+ formatting = {
+ format = function(entry, vim_item)
+ local label = vim_item.abbr
+ local truncated_label = vim.fn.strcharpart(label, 0, 50)
+ if truncated_label ~= label then
+ vim_item.abbr = truncated_label .. '...'
+ end
+ vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind)
+ vim_item.menu = ({
+ buffer = "[Buffer]",
+ nvim_lsp = "[LSP]",
+ luasnip = "[LuaSnip]",
+ nvim_lua = "[Lua]",
+ latex_symbols = "[LaTeX]",
+ })[entry.source.name]
+ return vim_item
+ end
+ },
view = {
entries = "custom",
},