feat: added cmp colors, scheme fixex, cmp formatter
added nvim-cmp fancy formatter with colored symbols. removed lsp info in statusline. tweaked color scheme a little.
This commit is contained in:
parent
c8a503374a
commit
fab8fa8493
3 changed files with 70 additions and 18 deletions
|
@ -68,8 +68,8 @@ end
|
|||
-- @field set_colors function to easily apply color scheme
|
||||
local PALETTE = {
|
||||
--|| DARK NORMAL BRIGHT ( x11 codes ) -- TODO map dark variants
|
||||
black = COLOR("#19161A", "#252A2B", "#444444", nil, 235, 238),
|
||||
gray = COLOR("#333333", "#808080", "#A8A499", nil, 244, nil),
|
||||
black = COLOR("#19161A", "#252A2B", "#333333", nil, 235, 238),
|
||||
gray = COLOR("#444444", "#808080", "#A8A499", nil, 244, nil),
|
||||
white = COLOR("#ADA9A1", "#D4D2CF", "#E8E1D3", nil, 252, 15 ),
|
||||
azure = COLOR("#5D748C", "#81A1C1", "#A6B4C2", nil, nil, nil),
|
||||
blue = COLOR("#323F61", "#48589C", "#5B6EA3", nil, 67, 4 ),
|
||||
|
@ -89,9 +89,9 @@ function PALETTE:set_syntax_colors()
|
|||
-- FG BG ATTR
|
||||
vim.api.nvim_set_hl(0, "Whitespace", HIGHLIGHT(self.black.normal, nil, nil)) -- set color for whitespace
|
||||
vim.api.nvim_set_hl(0, "Comment", HIGHLIGHT(self.gray.normal, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "Constant", HIGHLIGHT(self.purple.dark, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "Constant", HIGHLIGHT(self.purple.bright, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "String", HIGHLIGHT(self.purple.normal, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "Boolean", HIGHLIGHT(self.purple.bright, nil, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "Boolean", HIGHLIGHT(self.purple.dark, nil, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "Function", HIGHLIGHT(self.azure.normal, nil, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "Identifier", HIGHLIGHT(self.blue.normal, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "Statement", HIGHLIGHT(self.red.bright, nil, nil))
|
||||
|
@ -108,28 +108,28 @@ function PALETTE:set_treesitter_colors()
|
|||
-- comment
|
||||
vim.api.nvim_set_hl(0, "TSComment", HIGHLIGHT(self.gray.normal, nil, nil))
|
||||
-- constant
|
||||
vim.api.nvim_set_hl(0, "TSConstant", HIGHLIGHT(self.purple.dark, nil, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "TSConstant", HIGHLIGHT(self.purple.bright, nil, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "TSFloat", HIGHLIGHT(self.purple.bright, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "TSNumber", HIGHLIGHT(self.purple.bright, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "TSCharacter", HIGHLIGHT(self.purple.bright, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "TSLiteral", HIGHLIGHT(self.purple.dark, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "TSConstBuiltin", HIGHLIGHT(self.purple.dark, nil, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "TSConstBuiltin", HIGHLIGHT(self.purple.normal, nil, {bold=true}))
|
||||
-- string
|
||||
vim.api.nvim_set_hl(0, "TSString", HIGHLIGHT(self.purple.normal, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "TSStringRegex", HIGHLIGHT(self.orange.dark, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "TSStringEscape", HIGHLIGHT(self.gray.normal, nil, nil))
|
||||
-- boolean
|
||||
vim.api.nvim_set_hl(0, "TSBoolean", HIGHLIGHT(self.purple.bright, nil, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "TSBoolean", HIGHLIGHT(self.purple.dark, nil, {bold=true}))
|
||||
-- function
|
||||
vim.api.nvim_set_hl(0, "TSFunction", HIGHLIGHT(self.azure.normal, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "TSFuncBuiltin", HIGHLIGHT(self.azure.normal, nil, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "TSMethod", HIGHLIGHT(self.azure.dark, nil, nil))
|
||||
-- identifier
|
||||
vim.api.nvim_set_hl(0, "TSParameter", HIGHLIGHT(self.azure.bright, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "TSParameterReference", HIGHLIGHT(self.azure.bright, nil, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "TSAttribute", HIGHLIGHT(self.blue.normal, nil, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "TSField", HIGHLIGHT(self.blue.bright, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "TSProperty", HIGHLIGHT(self.blue.bright, nil, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "TSParameter", HIGHLIGHT(self.blue.dark, nil, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "TSParameterReference", HIGHLIGHT(self.blue.dark, nil, nil))
|
||||
-- statement
|
||||
vim.api.nvim_set_hl(0, "TSConditional", HIGHLIGHT(self.red.normal, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "TSKeyword", HIGHLIGHT(self.red.bright, nil, nil))
|
||||
|
@ -137,17 +137,17 @@ function PALETTE:set_treesitter_colors()
|
|||
vim.api.nvim_set_hl(0, "TSKeywordOperator", HIGHLIGHT(self.red.dark, nil, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "TSOperator", HIGHLIGHT(self.red.dark, nil, nil))
|
||||
-- preproc
|
||||
vim.api.nvim_set_hl(0, "TSAnnotation", HIGHLIGHT(self.pink.normal, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "TSAnnotation", HIGHLIGHT(self.pink.normal, nil, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "TSConstMacro", HIGHLIGHT(self.pink.dark, nil, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "TSFuncMacro", HIGHLIGHT(self.pink.dark, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "TSFuncMacro", HIGHLIGHT(self.pink.normal, nil, nil))
|
||||
-- include
|
||||
vim.api.nvim_set_hl(0, "TSInclude", HIGHLIGHT(self.cyan.dark, nil, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "TSNamespace", HIGHLIGHT(self.cyan.dark, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "TSCurrentScope", HIGHLIGHT(self.cyan.normal, nil, nil))
|
||||
-- type
|
||||
vim.api.nvim_set_hl(0, "TSType", HIGHLIGHT(self.orange.normal, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "TSTypeBuiltin", HIGHLIGHT(self.orange.bright, nil, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "TSConstructor", HIGHLIGHT(self.orange.dark, nil, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "TSTypeBuiltin", HIGHLIGHT(self.orange.dark, nil, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "TSConstructor", HIGHLIGHT(self.orange.normal, nil, {bold=true}))
|
||||
-- special
|
||||
vim.api.nvim_set_hl(0, "TSLabel", HIGHLIGHT(self.yellow.bright, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "TSTag", HIGHLIGHT(self.yellow.normal, nil, nil))
|
||||
|
@ -176,10 +176,9 @@ function PALETTE:set_ui_colors()
|
|||
-- FG BG ATTR
|
||||
vim.api.nvim_set_hl(0, "NonText", HIGHLIGHT(self.black.normal, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "Visual", HIGHLIGHT(nil, self.black.bright, nil))
|
||||
vim.api.nvim_set_hl(0, "Search", HIGHLIGHT(self.white.normal, self.none.normal, {bold=true, underline=true}))
|
||||
vim.api.nvim_set_hl(0, "Search", HIGHLIGHT(self.yellow.bright, self.gray.dark, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "Folded", HIGHLIGHT(self.cyan.normal, self.black.normal, nil))
|
||||
vim.api.nvim_set_hl(0, "FoldColumn", HIGHLIGHT(self.cyan.normal, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "Pmenu", HIGHLIGHT(nil, self.black.normal, nil)) -- Balloon color
|
||||
vim.api.nvim_set_hl(0, "VertSplit", HIGHLIGHT(self.black.normal, self.black.normal, nil)) -- Split divider color
|
||||
vim.api.nvim_set_hl(0, "SignColumn", HIGHLIGHT(nil, nil, nil)) -- Gutter color
|
||||
vim.api.nvim_set_hl(0, "CursorLine", HIGHLIGHT(nil, nil, nil)) -- Line number color
|
||||
|
@ -187,6 +186,11 @@ function PALETTE:set_ui_colors()
|
|||
vim.api.nvim_set_hl(0, "CursorLineNr", HIGHLIGHT(self.yellow.normal, self.black.normal, {bold=true})) -- CursorLine color (in number column)
|
||||
vim.api.nvim_set_hl(0, "LineNr", HIGHLIGHT(self.black.bright, nil, nil)) -- Number column color
|
||||
|
||||
vim.api.nvim_set_hl(0, "Pmenu", HIGHLIGHT(nil, self.black.normal, nil)) -- Balloon color
|
||||
vim.api.nvim_set_hl(0, "PmenuSel", HIGHLIGHT(nil, self.gray.dark, nil)) -- Balloon color
|
||||
-- vim.api.nvim_set_hl(0, "PmenuSbar", HIGHLIGHT(nil, self.black.normal, nil)) -- Balloon color
|
||||
-- vim.api.nvim_set_hl(0, "PmenuThumb", HIGHLIGHT(nil, self.black.normal, nil)) -- Balloon color
|
||||
|
||||
vim.api.nvim_set_hl(0, "Question", HIGHLIGHT(self.cyan.normal, nil, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "MoreMsg", HIGHLIGHT(self.black.bright, nil, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "Error", HIGHLIGHT(self.red.normal, nil, {underline=true}))
|
||||
|
@ -233,7 +237,7 @@ end
|
|||
function PALETTE:set_statusline_colors()
|
||||
-- FG BG ATTR
|
||||
vim.api.nvim_set_hl(0, "StatusLine", HIGHLIGHT(self.gray.normal, self.black.normal, nil))
|
||||
vim.api.nvim_set_hl(0, "StatusLineBlock", HIGHLIGHT(self.gray.normal, self.black.bright, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "StatusLineBlock", HIGHLIGHT(self.gray.normal, self.gray.dark, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "NormalMode", HIGHLIGHT(self.black.normal, self.red.normal, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "InsertMode", HIGHLIGHT(self.black.normal, self.pink.normal, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "VisualMode", HIGHLIGHT(self.black.normal, self.azure.normal, {bold=true}))
|
||||
|
@ -246,6 +250,31 @@ function PALETTE:set_gitsigns_colors()
|
|||
vim.api.nvim_set_hl(0, "GitSignsDelete", HIGHLIGHT(self.red.bright, nil, nil))
|
||||
end
|
||||
|
||||
function PALETTE:set_cmp_colors()
|
||||
-- FG BG ATTR
|
||||
-- vim.api.nvim_set_hl(0, "CmpItemMenu", HIGHLIGHT(nil, self.black.bright, nil))
|
||||
vim.api.nvim_set_hl(0, "CmpItemAbbr", HIGHLIGHT(self.white.dark, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "CmpItemAbbrDeprecated", HIGHLIGHT(self.white.dark, nil, {strikethrough=true}))
|
||||
vim.api.nvim_set_hl(0, "CmpItemAbbrMatch", HIGHLIGHT(self.white.normal, nil, {bold=true}))
|
||||
vim.api.nvim_set_hl(0, "CmpItemAbbrMatchFuzzy", HIGHLIGHT(self.white.normal, nil, nil))
|
||||
vim.api.nvim_set_hl(0, "CmpItemKind", HIGHLIGHT(self.white.bright, self.gray.normal, nil))
|
||||
vim.api.nvim_set_hl(0, "CmpItemKindVariable", HIGHLIGHT(self.white.bright, self.pink.normal, nil))
|
||||
vim.api.nvim_set_hl(0, "CmpItemKindInterface", HIGHLIGHT(self.white.bright, self.pink.bright, nil))
|
||||
vim.api.nvim_set_hl(0, "CmpItemKindText", HIGHLIGHT(self.white.bright, self.gray.dark, nil))
|
||||
vim.api.nvim_set_hl(0, "CmpItemKindFunction", HIGHLIGHT(self.white.bright, self.azure.normal, nil))
|
||||
vim.api.nvim_set_hl(0, "CmpItemKindMethod", HIGHLIGHT(self.white.bright, self.azure.dark, nil))
|
||||
vim.api.nvim_set_hl(0, "CmpItemKindKeyword", HIGHLIGHT(self.white.bright, self.red.dark, nil))
|
||||
vim.api.nvim_set_hl(0, "CmpItemKindProperty", HIGHLIGHT(self.white.bright, self.blue.dark, nil))
|
||||
vim.api.nvim_set_hl(0, "CmpItemKindField", HIGHLIGHT(self.white.bright, self.blue.normal, nil))
|
||||
vim.api.nvim_set_hl(0, "CmpItemKindModule", HIGHLIGHT(self.white.bright, self.cyan.normal, nil))
|
||||
vim.api.nvim_set_hl(0, "CmpItemKindClass", HIGHLIGHT(self.white.bright, self.orange.dark, nil))
|
||||
vim.api.nvim_set_hl(0, "CmpItemKindStruct", HIGHLIGHT(self.white.bright, self.orange.normal, nil))
|
||||
vim.api.nvim_set_hl(0, "CmpItemKindEnum", HIGHLIGHT(self.white.bright, self.orange.bright, nil))
|
||||
vim.api.nvim_set_hl(0, "CmpItemKindEnumMember", HIGHLIGHT(self.white.bright, self.purple.normal, nil))
|
||||
vim.api.nvim_set_hl(0, "CmpItemKindConstant", HIGHLIGHT(self.white.bright, self.purple.dark, nil))
|
||||
vim.api.nvim_set_hl(0, "CmpItemKindValue", HIGHLIGHT(self.white.bright, self.green.normal, nil))
|
||||
end
|
||||
|
||||
function PALETTE:set_telescope_colors()
|
||||
-- FG BG ATTR
|
||||
vim.api.nvim_set_hl(0, "TelescopeBorder", HIGHLIGHT(self.black.bright, nil, nil));
|
||||
|
@ -305,6 +334,7 @@ function PALETTE:set_colors()
|
|||
self:set_treesitter_colors()
|
||||
self:set_gitsigns_colors()
|
||||
self:set_telescope_colors()
|
||||
self:set_cmp_colors()
|
||||
self:set_dap_colors()
|
||||
end
|
||||
|
||||
|
|
|
@ -98,6 +98,7 @@ local init_fn = function(use)
|
|||
'hrsh7th/cmp-buffer', -- complete based on buffer
|
||||
'rcarriga/cmp-dap', -- complete in debugger
|
||||
'saadparwaiz1/cmp_luasnip', -- complete with snippets
|
||||
'onsails/lspkind.nvim', -- fancy icons and formatting
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -172,10 +173,17 @@ local init_fn = function(use)
|
|||
-- TODO this part is messy, can I make it cleaner?
|
||||
-- TODO can I put these setup steps inside their respective config callback?
|
||||
-- TODO can I make them also load their highlight groups?
|
||||
|
||||
-- TODO can I make nvim-cmp configuration smaller?
|
||||
|
||||
local cmp = require('cmp')
|
||||
cmp.setup({
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
local kind = require("lspkind").cmp_format({ mode = "symbol" })(entry, vim_item)
|
||||
kind.kind = " " .. kind.kind .. " "
|
||||
return kind
|
||||
end,
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args) require('luasnip').lsp_expand(args.body) end,
|
||||
},
|
||||
|
@ -189,12 +197,26 @@ local init_fn = function(use)
|
|||
}),
|
||||
})
|
||||
cmp.setup.filetype({ "dap-repl", "dapui_watches" }, {
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
local kind = require("lspkind").cmp_format({ mode = "symbol" })(entry, vim_item)
|
||||
kind.kind = " " .. kind.kind .. " "
|
||||
return kind
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({ ['<Tab>'] = cmp.mapping.confirm({ select = true }) }),
|
||||
sources = {
|
||||
{ name = 'dap' },
|
||||
},
|
||||
})
|
||||
cmp.setup.cmdline('/', {
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
local kind = require("lspkind").cmp_format({ mode = "symbol" })(entry, vim_item)
|
||||
kind.kind = " " .. kind.kind .. " "
|
||||
return kind
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp_document_symbol' },
|
||||
|
|
|
@ -119,7 +119,7 @@ function BARCYCLE:statusline()
|
|||
self:git(),
|
||||
"%r%h%w%m %<%F ", -- file flags (RO, HELP, PREVIEW, MODIFY), file path
|
||||
"%=", -- change alignment
|
||||
self:lsp(),
|
||||
-- self:lsp(),
|
||||
"%{&fileencoding?&fileencoding:&encoding}",
|
||||
"%{&fileformat}",
|
||||
"%#StatusLineBlock# %3l:%-3c %3p%%", -- cursor coordinates: line (formatted), column (formatted), percentage (formatted)
|
||||
|
|
Loading…
Reference in a new issue