Skip to content

Commit

Permalink
refac(ui): icons (#307)
Browse files Browse the repository at this point in the history
* refac(diagnostics): use custom icons

* refac(cmp): use custom icons

* refac(lsp): remove lsp.protocol.CompletionItemKind

* chore(lazy): update lazy-lock.json
  • Loading branch information
n3wborn authored Oct 27, 2023
1 parent ee9ff8f commit 9657bd9
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 111 deletions.
4 changes: 2 additions & 2 deletions lazy-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"cmp-rg": { "branch": "master", "commit": "677a7874ee8f1afc648c2e7d63a97bc21a7663c5" },
"cmp-under-comparator": { "branch": "master", "commit": "6857f10272c3cfe930cece2afa2406e1385bfef8" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"conform.nvim": { "branch": "master", "commit": "278bcd8bf2017e187e963b515017341fdd87fe2f" },
"conform.nvim": { "branch": "master", "commit": "4653408d5c270168e31ffd0585d1cf2de27fc827" },
"friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" },
"git-conflict.nvim": { "branch": "main", "commit": "896261933afe2fddf6fb043d9cd4d88301b151a9" },
"gitsigns.nvim": { "branch": "main", "commit": "af0f583cd35286dd6f0e3ed52622728703237e50" },
Expand All @@ -34,7 +34,7 @@
"nvim-navbuddy": { "branch": "master", "commit": "f137a3466a6cd1965cdcc5398daff54e66eebbe5" },
"nvim-navic": { "branch": "master", "commit": "0ffa7ffe6588f3417e680439872f5049e38a24db" },
"nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" },
"nvim-treesitter": { "branch": "master", "commit": "107e61afb7129d637ea6c3c68b97a22194b0bf16" },
"nvim-treesitter": { "branch": "master", "commit": "3954741f2652fbcef9d6877d0e3a4d91d44b1632" },
"nvim-treesitter-refactor": { "branch": "master", "commit": "65ad2eca822dfaec2a3603119ec3cc8826a7859e" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "e69a504baf2951d52e1f1fbb05145d43f236cbf1" },
"nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" },
Expand Down
76 changes: 36 additions & 40 deletions lua/custom/icons.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
local M = {}

M.icons = {
return {
diagnostics = {
Error = '',
Warn = '',
Expand All @@ -13,42 +11,40 @@ M.icons = {
removed = '',
},
kinds = {
Array = '',
Boolean = '',
Class = '',
Color = '',
Constant = '',
Constructor = '',
Copilot = '',
Enum = '',
EnumMember = '',
Event = '',
Field = '',
File = '',
Folder = '',
Function = '',
Interface = '',
Key = '',
Keyword = '',
Method = '',
Module = '',
Namespace = '',
Null = '',
Number = '',
Object = '',
Operator = '',
Package = '',
Property = '',
Reference = '',
Snippet = '',
String = '',
Struct = '',
Text = '',
TypeParameter = '',
Unit = '',
Value = '',
Variable = '',
Array = ' ',
Boolean = ' ',
Class = ' ',
Color = ' ',
Constant = ' ',
Constructor = ' ',
Copilot = ' ',
Enum = ' ',
EnumMember = ' ',
Event = ' ',
Field = ' ',
File = ' ',
Folder = ' ',
Function = ' ',
Interface = ' ',
Key = ' ',
Keyword = ' ',
Method = ' ',
Module = ' ',
Namespace = ' ',
Null = ' ',
Number = ' ',
Object = ' ',
Operator = ' ',
Package = ' ',
Property = ' ',
Reference = ' ',
Snippet = ' ',
String = ' ',
Struct = ' ',
Text = ' ',
TypeParameter = ' ',
Unit = ' ',
Value = ' ',
Variable = ' ',
},
}

return M
5 changes: 2 additions & 3 deletions lua/lsp/diagnostics.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
local M = {}

M.signs = { Error = '', Warn = '', Hint = '', Info = '' }

function M.setup()
vim.diagnostic.config({ virtual_text = false, float = _G.global.float_border_opts })
local signs = require('custom.icons').diagnostics

for type, icon in pairs(M.signs) do
for type, icon in pairs(signs) do
local hl = 'DiagnosticSign' .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = '' })
end
Expand Down
37 changes: 1 addition & 36 deletions lua/plugins/cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,42 +20,7 @@ return {
local cmp_buffer = require('cmp_buffer')
local compare = require('cmp.config.compare')
local luasnip = require('luasnip')
local icons = {
Array = '',
Boolean = '',
Class = '',
Color = '',
Constant = '',
Constructor = '',
Enum = '',
EnumMember = '',
Event = '',
Field = '',
File = '',
Folder = '',
Function = '',
Interface = '',
Key = '',
Keyword = '',
Method = '',
Module = '',
Namespace = '',
Null = '',
Number = '',
Object = '',
Operator = '',
Package = '',
Property = '',
Reference = '',
Snippet = '',
String = '',
Struct = '',
Text = '',
TypeParameter = '',
Unit = '',
Value = '',
Variable = '',
}
local icons = require('custom.icons').kinds

luasnip.config.setup({})

Expand Down
30 changes: 0 additions & 30 deletions lua/plugins/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,39 +84,9 @@ return {
config = function()
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local u = require('utils')
local lsp = vim.lsp

require('lsp.diagnostics').setup()

-- lsp comp items
lsp.protocol.CompletionItemKind = {
Text = ' [text]',
Method = ' [method]',
Function = ' [function]',
Constructor = ' [constructor]',
Field = 'ﰠ [field]',
Variable = ' [variable]',
Class = ' [class]',
Interface = ' [interface]',
Module = ' [module]',
Property = ' [property]',
Unit = ' [unit]',
Value = ' [value]',
Enum = ' [enum]',
Keyword = ' [key]',
Snippet = ' [snippet]',
Color = ' [color]',
File = ' [file]',
Reference = ' [reference]',
Folder = ' [folder]',
EnumMember = ' [enum member]',
Constant = ' [constant]',
Struct = ' [struct]',
Event = '⌘ [event]',
Operator = ' [operator]',
TypeParameter = ' [type]',
}

--- on_attach
local on_attach = function(client, bufnr)
require('illuminate').on_attach(client)
Expand Down

0 comments on commit 9657bd9

Please sign in to comment.