Semantic highlighting, satellite scrollbar, nicer cmp

This commit is contained in:
Natty 2024-01-18 22:01:21 +01:00
parent 0e2b808aa1
commit 1263ea6a42
Signed by: natty
GPG Key ID: BF6CB659ADEE60EC
2 changed files with 188 additions and 3 deletions

View File

@ -1,7 +1,12 @@
return {
n = {
["<C-h>"] = {"db", desc = "Ctrl+Backspace to delete a word backwards"},
["<C-Del>"] = {"dw", desc = "Ctrl+Delete to delete a word forwards"}
["<C-Del>"] = {"dw", desc = "Ctrl+Delete to delete a word forwards"},
["<leader><F2>"] = {":Neotree close<CR>:UndotreeToggle<CR>", desc = "Toggle undo tree"},
["<leader><Left>"] = {"<C-W>h", desc = "Go to the window left"},
["<leader><Right>"] = {"<C-W>l", desc = "Go to the window right"},
["<leader><Up>"] = {"<C-W>k", desc = "Go to the window up"},
["<leader><Down>"] = {"<C-W>j", desc = "Go to the window down"}
},
i = {
["\b"] = {"<C-O>db", desc = "Ctrl+Backspace to delete a word backwards"},

View File

@ -1,8 +1,188 @@
return {
return {{
"mbbill/undotree",
name = "undotree",
lazy = false,
}, {
"lewis6991/satellite.nvim",
name = "satellite",
lazy = false,
config = function()
require("satellite").setup {
current_only = false,
winblend = 50,
zindex = 40,
excluded_filetypes = {},
width = 2,
handlers = {
cursor = {
enable = true,
overlap = true,
-- Supports any number of symbols
symbols = { '', '', '', '' }
-- symbols = { '⎻', '⎼' }
-- Highlights:
-- - SatelliteCursor (default links to NonText
},
search = {
enable = true,
-- Highlights:
-- - SatelliteSearch (default links to Search)
-- - SatelliteSearchCurrent (default links to SearchCurrent)
},
diagnostic = {
enable = true,
signs = {'-', '=', ''},
min_severity = vim.diagnostic.severity.HINT,
-- Highlights:
-- - SatelliteDiagnosticError (default links to DiaSatelliteEnablegnosticError)
-- - SatelliteDiagnosticWarn (default links to DiagnosticWarn)
-- - SatelliteDiagnosticInfo (default links to DiagnosticInfo)
-- - SatelliteDiagnosticHint (default links to DiagnosticHint)
},
gitsigns = {
enable = true,
signs = { -- can only be a single character (multibyte is okay)
add = "",
change = "",
delete = "-",
},
-- Highlights:
-- SatelliteGitSignsAdd (default links to GitSignsAdd)
-- SatelliteGitSignsChange (default links to GitSignsChange)
-- SatelliteGitSignsDelete (default links to GitSignsDelete)
},
marks = {
enable = true,
show_builtins = false, -- shows the builtin marks like [ ] < >
key = 'm'
-- Highlights:
-- SatelliteMark (default links to Normal)
},
quickfix = {
signs = { '-', '=', '' },
-- Highlights:
-- SatelliteQuickfix (default links to WarningMsg)
}
},
}
end,
}, {
"catppuccin/nvim",
name = "catppuccin",
config = function()
require("catppuccin").setup {
flavour = "mocha",
-- Colors adapted from https://github.com/one-dark/jetbrains-one-dark-theme
-- Catppuccin colors: https://github.com/catppuccin/catppuccin/blob/main/docs/style-guide.md
-- Catppuccin Neovim config: https://github.com/catppuccin/nvim/#configuration
color_overrides = {
mocha = {
text = "#BBBBBB",
base = "#282c34",
crust = "#21252b",
mauve = "#D55FDE",
blue = "#61AFEF",
teal = "#2BBAC5",
red = "#EF596F",
green = "#89CA78",
peach = "#D19A66",
yellow = "#E5C07B",
sapphire = "#009191",
maroon = "#f9c89a"
}
},
integrations = {
cmp = true,
neotree = true,
mason = true,
},
custom_highlights = function(C)
-- :Telescope highlights for a general list
-- Rust-analyzer tokens: https://rust-analyzer.github.io/manual.html#semantic-syntax-highlighting
-- @lsp.mod.* for modifiers
-- @lsp.modtype.* for types with modifiers
-- @lsp.type.* for token types
return {
Error = { fg = C.red, italic = true, underline = true },
["@lsp.type.interface"] = { fg = C.yellow },
["@function.builtin"] = { fg = C.blue },
["@lsp.typemod.method.builtIn"] = { fg = C.blue },
["@lsp.mod.mutable"] = { underline = true },
["@lsp.mod.consuming"] = { bold = true },
["@lsp.type.lifetime"] = { fg = C.teal },
["@variable.builtin"] = { fg = C.mauve },
["StorageClass"] = { fg = C.mauve },
["@constructor.lua"] = { fg = C.overlay2 },
["@preproc"] = { fg = C.maroon },
["@debug"] = { fg = C.maroon },
["@field"] = { fg = C.red },
["@property"] = { fg = C.red },
["@lsp.type.formatSpecifier"] = { fg = C.teal },
["@lsp.type.escapeSequence"] = { fg = C.teal },
PreProc = { fg = C.maroon },
Special = { fg = C.teal },
["@namespace"] = { fg = C.overlay2 },
["@define"] = { fg = C.maroon },
["@string.escape"] = { fg = C.teal },
Operator = { fg = C.text },
CmpItemKindSnippet = { fg = C.base, bg = C.green },
CmpItemKindKeyword = { fg = C.base, bg = C.mauve },
CmpItemKindText = { fg = C.base, bg = C.teal },
CmpItemKindMethod = { fg = C.base, bg = C.blue },
CmpItemKindConstructor = { fg = C.base, bg = C.blue },
CmpItemKindFunction = { fg = C.base, bg = C.blue },
CmpItemKindFolder = { fg = C.base, bg = C.blue },
CmpItemKindModule = { fg = C.base, bg = C.blue },
CmpItemKindConstant = { fg = C.base, bg = C.peach },
CmpItemKindField = { fg = C.base, bg = C.red },
CmpItemKindProperty = { fg = C.base, bg = C.red },
CmpItemKindEnum = { fg = C.base, bg = C.peach },
CmpItemKindUnit = { fg = C.base, bg = C.peach },
CmpItemKindClass = { fg = C.base, bg = C.yellow },
CmpItemKindVariable = { fg = C.base, bg = C.flamingo },
CmpItemKindFile = { fg = C.base, bg = C.blue },
CmpItemKindInterface = { fg = C.base, bg = C.yellow },
CmpItemKindColor = { fg = C.base, bg = C.red },
CmpItemKindReference = { fg = C.base, bg = C.red },
CmpItemKindEnumMember = { fg = C.base, bg = C.red },
CmpItemKindStruct = { fg = C.base, bg = C.blue },
CmpItemKindValue = { fg = C.base, bg = C.peach },
CmpItemKindEvent = { fg = C.base, bg = C.blue },
CmpItemKindOperator = { fg = C.base, bg = C.blue },
CmpItemKindTypeParameter = { fg = C.base, bg = C.blue },
CmpItemKindCopilot = { fg = C.base, bg = C.teal },
}
end,
}
end,
}
}, {
"hrsh7th/nvim-cmp",
-- override the options table that is used in the `require("cmp").setup()` call
opts = function(_, opts)
-- opts parameter is the default options table
-- the function is lazy loaded so cmp is able to be required
local lspkind = require("lspkind")
-- modify the sources part of the options table
-- Make the cmp prompt pretty
-- How to customize: https://docs.astronvim.com/recipes/cmp/
-- From: https://github.com/johnallen3d/dotfiles/blob/46300be412aba524743f8e3d47fff4df3deb2857/dot_config/nvim/lua/config/plugins/cmp.lua
opts.formatting = {
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
local kind = lspkind.cmp_format({
mode = "symbol_text",
maxwidth = 50,
})(entry, vim_item)
local strings = vim.split(kind.kind, "%s", { trimempty = true })
kind.kind = " " .. strings[1] .. " "
kind.menu = " (" .. strings[2] .. ")"
return kind
end,
}
-- return the new table to be used
return opts
end,
}}