From 41682275d321b6b79ee4c07f25e819875519466e Mon Sep 17 00:00:00 2001 From: joe Date: Mon, 25 Aug 2025 18:13:21 +0200 Subject: cool --- .config/nvim/lua/plugins/gruvbox.lua | 38 ++++ .config/nvim/lua/plugins/lspkind.lua | 102 +++++++++++ .config/nvim/lua/plugins/lualine.lua | 298 ++++++++++++++++++++++++++++++++ .config/nvim/lua/plugins/rainbow.lua | 28 +++ .config/nvim/lua/plugins/telescope.lua | 25 +++ .config/nvim/lua/plugins/treesitter.lua | 53 ++++++ .config/nvim/lua/plugins/trouble.lua | 27 +++ 7 files changed, 571 insertions(+) create mode 100644 .config/nvim/lua/plugins/gruvbox.lua create mode 100644 .config/nvim/lua/plugins/lspkind.lua create mode 100644 .config/nvim/lua/plugins/lualine.lua create mode 100644 .config/nvim/lua/plugins/rainbow.lua create mode 100644 .config/nvim/lua/plugins/telescope.lua create mode 100644 .config/nvim/lua/plugins/treesitter.lua create mode 100644 .config/nvim/lua/plugins/trouble.lua (limited to '.config/nvim/lua/plugins') diff --git a/.config/nvim/lua/plugins/gruvbox.lua b/.config/nvim/lua/plugins/gruvbox.lua new file mode 100644 index 0000000..bf99776 --- /dev/null +++ b/.config/nvim/lua/plugins/gruvbox.lua @@ -0,0 +1,38 @@ +return { + { + 'ellisonleao/gruvbox.nvim', + lazy = false, + priority = 1000, + opts = { + terminal_colors = false, + undercurl = true, + underline = true, + bold = false, + italic = { + strings = false, + emphasis = true, + comments = true, + operators = false, + folds = true, + }, + strikethrough = true, + invert_selection = false, + invert_signs = false, + invert_tabline = false, + invert_intend_guides = false, + inverse = true, -- invert background for search, diffs, statuslines and errors + contrast = "hard", -- can be "hard", "soft" or empty string + palette_overrides = {}, + overrides = { + ["@punctuation.delimiter"] = { fg = "#928374" }, + String = { fg = "#8ec07c" }, + }, + dim_inactive = false, + transparent_mode = true, + }, + config = function(_, opts) + require('gruvbox').setup(opts) + vim.cmd([[colorscheme gruvbox]]) + end + } +} diff --git a/.config/nvim/lua/plugins/lspkind.lua b/.config/nvim/lua/plugins/lspkind.lua new file mode 100644 index 0000000..b1fc6d1 --- /dev/null +++ b/.config/nvim/lua/plugins/lspkind.lua @@ -0,0 +1,102 @@ +return { + { + 'onsails/lspkind.nvim', + config = function() + require('lspkind').setup({ + mode = 'symbol_text', + preset = 'codicons', + symbol_map = { + 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 = "", + }, + }) + end + }, + { + "hrsh7th/nvim-cmp", + dependencies = { + "onsails/lspkind.nvim", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "L3MON4D3/LuaSnip", + }, + event = "InsertEnter", + config = function() + local cmp = require('cmp') + local lspkind = require('lspkind') + + cmp.setup({ + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, + formatting = { + format = lspkind.cmp_format({ + mode = 'symbol_text', + maxwidth = { + menu = 50, + abbr = 50, + }, + ellipsis_char = '...', + show_labelDetails = true, + before = function(entry, vim_item) + -- Add source name to menu + vim_item.menu = ({ + nvim_lsp = "[LSP]", + luasnip = "[LuaSnip]", + buffer = "[Buffer]", + path = "[Path]", + })[entry.source.name] + return vim_item + end + }) + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.select_next_item(cmp_select), + [''] = cmp.mapping.select_prev_item(cmp_select), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + }, { + { name = 'buffer' }, + { name = 'path' }, + }), + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + }) + end, + }, +} diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..4c2c6d3 --- /dev/null +++ b/.config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,298 @@ +return { + { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + local colors = { + bg = '#202328', + fg = '#a89984', + yellow = '#ecbe7b', + cyan = '#008080', + darkblue = '#081633', + green = '#98be65', + orange = '#ff8800', + violet = '#a9a1e1', + magenta = '#c678dd', + blue = '#51afef', + red = '#ec5f67', + } + + local conditions = { + buffer_not_empty = function() + return vim.fn.empty(vim.fn.expand('%:t')) ~= 1 + end, + hide_in_width = function() + return vim.fn.winwidth(0) > 80 + end, + check_git_workspace = function() + local filepath = vim.fn.expand('%:p:h') + local gitdir = vim.fn.finddir('.git', filepath .. ';') + return gitdir and #gitdir > 0 and #gitdir < #filepath + end, + } + + local config = { + options = { + -- Disable sections and component separators + component_separators = '', + section_separators = '', + theme = { + -- We are going to use lualine_c an lualine_x as left and + -- right section. Both are highlighted by c theme . So we + -- are just setting default looks o statusline + normal = { c = { fg = colors.fg, bg = colors.bg } }, + inactive = { c = { fg = colors.fg, bg = colors.bg } }, + }, + }, + sections = { + -- these are to remove the defaults + lualine_a = {}, + lualine_b = {}, + lualine_y = {}, + lualine_z = {}, + -- These will be filled later + lualine_c = {}, + lualine_x = {}, + }, + inactive_sections = { + -- these are to remove the defaults + lualine_a = {}, + lualine_b = {}, + lualine_y = {}, + lualine_z = {}, + lualine_c = {}, + lualine_x = {}, + }, + } + + -- Inserts a component in lualine_c at left section + local function ins_left(component) + table.insert(config.sections.lualine_c, component) + end + + -- Inserts a component in lualine_x at right section + local function ins_right(component) + table.insert(config.sections.lualine_x, component) + end + + ins_left { + function() + return '▊' + end, + -- color = { fg = colors.green }, -- Sets highlighting of component + color = function() + -- auto change color according to neovims mode + local mode_color = { + n = colors.green, + i = colors.blue, + v = colors.magenta, + [''] = colors.magenta, + V = colors.magenta, + c = colors.yellow, + no = colors.red, + s = colors.orange, + S = colors.orange, + [''] = colors.orange, + ic = colors.yellow, + R = colors.red, + Rv = colors.violet, + cv = colors.red, + ce = colors.red, + r = colors.cyan, + rm = colors.cyan, + ['r?'] = colors.cyan, + ['!'] = colors.red, + t = colors.red, + } + return { fg = mode_color[vim.fn.mode()] } + end, + padding = { left = 0, right = 1 }, -- We don't need space before this + } + + ins_left { + -- mode component + function() + return '' + end, + color = function() + -- auto change color according to neovims mode + local mode_color = { + n = colors.green, + i = colors.blue, + v = colors.magenta, + [''] = colors.magenta, + V = colors.magenta, + c = colors.yellow, + no = colors.red, + s = colors.orange, + S = colors.orange, + [''] = colors.orange, + ic = colors.yellow, + R = colors.red, + Rv = colors.violet, + cv = colors.red, + ce = colors.red, + r = colors.cyan, + rm = colors.cyan, + ['r?'] = colors.cyan, + ['!'] = colors.red, + t = colors.red, + } + return { fg = mode_color[vim.fn.mode()] } + end, + padding = { right = 1 }, + } + + ins_left { + 'buffers', + show_filename_only = false, + hide_filename_extension = false, + show_modified_status = true, + icons_enabled = true, + symbols = { + modified = ' ●', -- Text to show when the buffer is modified + alternate_file = '', -- Text to show to identify the alternate file + directory = '', -- Text to show when the buffer is a directory + }, + buffers_color = { + -- Same values as the general color option can be used here. + active = function() + -- auto change color according to neovims mode + local mode_color = { + n = colors.green, + i = colors.blue, + v = colors.magenta, + [''] = colors.magenta, + V = colors.magenta, + c = colors.yellow, + no = colors.red, + s = colors.orange, + S = colors.orange, + [''] = colors.orange, + ic = colors.yellow, + R = colors.red, + Rv = colors.violet, + cv = colors.red, + ce = colors.red, + r = colors.cyan, + rm = colors.cyan, + ['r?'] = colors.cyan, + ['!'] = colors.red, + t = colors.red, + } + return { fg = mode_color[vim.fn.mode()], gui = 'bold' } + end, + }, + } + + ins_left { + 'diagnostics', + sources = { 'nvim_diagnostic' }, + symbols = { error = ' ', warn = ' ', info = ' ' }, + diagnostics_color = { + color_error = { fg = colors.red }, + color_warn = { fg = colors.yellow }, + color_info = { fg = colors.cyan }, + }, + } + + -- Insert mid section. You can make any number of sections in neovim :) + -- for lualine it's any number greater then 2 + -- ins_left { + -- function() + -- return '%=' + -- end, + -- } + + ins_right { + 'filetype', + icons_enabled = true, -- I think icons are cool but Eviline doesn't have them. sigh + color = { fg = colors.blue }, + } + + ins_right { + -- Lsp server name . + function() + local msg = 'no lsp' + local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') + local clients = vim.lsp.get_clients() + if next(clients) == nil then + icon = '' + return '' + end + for _, client in ipairs(clients) do + local filetypes = client.config.filetypes + if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then + return client.name + end + end + return msg + end, + icon = ' ', + color = { fg = colors.cyan }, + } + + ins_right { + 'branch', + icon = '', + color = { fg = colors.violet, gui = 'bold' }, + } + + ins_right { + -- filesize component + 'filesize', + cond = conditions.buffer_not_empty, + } + + ins_right { + 'diff', + -- Is it me or the symbol for modified us really weird + symbols = { added = ' ', modified = '󰝤 ', removed = ' ' }, + diff_color = { + added = { fg = colors.green }, + modified = { fg = colors.orange }, + removed = { fg = colors.red }, + }, + cond = conditions.hide_in_width, + } + + ins_right { 'location' } + + ins_right { + function() + return '▊' + end, + -- color = { fg = colors.green }, + color = function() + -- auto change color according to neovims mode + local mode_color = { + n = colors.green, + i = colors.blue, + v = colors.magenta, + [''] = colors.magenta, + V = colors.magenta, + c = colors.yellow, + no = colors.red, + s = colors.orange, + S = colors.orange, + [''] = colors.orange, + ic = colors.yellow, + R = colors.red, + Rv = colors.violet, + cv = colors.red, + ce = colors.red, + r = colors.cyan, + rm = colors.cyan, + ['r?'] = colors.cyan, + ['!'] = colors.red, + t = colors.red, + } + return { fg = mode_color[vim.fn.mode()] } + end, + padding = { left = 1 }, + } + + require('lualine').setup(config) + end + } +} diff --git a/.config/nvim/lua/plugins/rainbow.lua b/.config/nvim/lua/plugins/rainbow.lua new file mode 100644 index 0000000..740b712 --- /dev/null +++ b/.config/nvim/lua/plugins/rainbow.lua @@ -0,0 +1,28 @@ +return { + { + 'HiPhish/rainbow-delimiters.nvim', + config = function() + local rainbow_delimiters = require('rainbow-delimiters') + + vim.g.rainbow_delimiters = { + strategy = { + [''] = rainbow_delimiters.strategy['global'], + vim = rainbow_delimiters.strategy['local'], + }, + query = { + [''] = 'rainbow-delimiters', + lua = 'rainbow-blocks', + }, + highlight = { + 'RainbowDelimiterOrange', + 'RainbowDelimiterRed', + 'RainbowDelimiterYellow', + 'RainbowDelimiterBlue', + 'RainbowDelimiterGreen', + 'RainbowDelimiterViolet', + 'RainbowDelimiterCyan', + }, + } + end + } +} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..ca80e16 --- /dev/null +++ b/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,25 @@ +return { + { + 'nvim-telescope/telescope.nvim', + branch = '0.1.x', + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function() + local tele = require('telescope') + + tele.setup { + defaults = { + mappings = { + i = { + [''] = false, + [''] = require('telescope.actions').delete_buffer, + [""] = require('telescope.actions').move_selection_next, + [""] = require('telescope.actions').move_selection_previous, + }, + }, + }, + } + + pcall(tele.load_extension, 'fzf') + end, + }, +} diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..5387ac6 --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,53 @@ +return { + { + 'nvim-treesitter/nvim-treesitter', + branch = 'master', + lazy = false, + build = ':TSUpdate', + config = function() + require('nvim-treesitter.configs').setup { + -- A list of parser names, or "all" (the five listed parsers should always be installed) + ensure_installed = { + 'c', + 'cpp', + 'lua', + 'vim', + 'vimdoc', + 'query', + 'go', + 'perl', + 'rust', + 'yaml', + 'regex', + 'markdown', + 'markdown_inline', + 'terraform', + 'comment', + }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + highlight = { + enable = true, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, + incremental_selection = { + enable = true, + }, + indent = { + enable = true, + }, + } + end + } +} diff --git a/.config/nvim/lua/plugins/trouble.lua b/.config/nvim/lua/plugins/trouble.lua new file mode 100644 index 0000000..11c23a3 --- /dev/null +++ b/.config/nvim/lua/plugins/trouble.lua @@ -0,0 +1,27 @@ +return { + { + 'folke/trouble.nvim', + requires = { + {'nvim-tree/nvim-web-devicons'}, + }, + config = function() + require('trouble').setup { + -- icons = true, + } + + -- Diagnostic signs + -- https://github.com/folke/trouble.nvim/issues/52 + local signs = { + Error = " ", + Warn = " ", + Hint = " ", + Info = " " + } + + for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, {text = icon, texthl = hl, numhl = hl}) + end + end + } +} -- cgit v1.2.3