diff --git a/nvim/lua/plugins/lsp/cmp.lua b/nvim/lua/plugins/lsp/cmp.lua index c928aca..bbff4ca 100755 --- a/nvim/lua/plugins/lsp/cmp.lua +++ b/nvim/lua/plugins/lsp/cmp.lua @@ -1,128 +1,131 @@ return { - -- competion - "hrsh7th/nvim-cmp", - event = { "InsertEnter", "LspAttach" }, - dependencies = { - { "hrsh7th/cmp-buffer" }, -- source for text in buffer - { "hrsh7th/cmp-path" }, -- source for file system paths - { "L3MON4D3/LuaSnip" }, -- snippet engine - { "saadparwaiz1/cmp_luasnip" }, -- for autocompletion - { "rafamadriz/friendly-snippets" }, -- useful snippets - { "onsails/lspkind.nvim" }, -- icons for cmp - }, - config = function() - local cmp = require("cmp") - local lspkind = require("lspkind") - local luasnip = require("luasnip") + -- competion + "hrsh7th/nvim-cmp", + event = { "InsertEnter", "LspAttach" }, + dependencies = { + { "hrsh7th/cmp-buffer" }, -- source for text in buffer + { "hrsh7th/cmp-path" }, -- source for file system paths + { "L3MON4D3/LuaSnip" }, -- snippet engine + { "saadparwaiz1/cmp_luasnip" }, -- for autocompletion + { "rafamadriz/friendly-snippets" }, -- useful snippets + { "onsails/lspkind.nvim" }, -- icons for cmp + }, + config = function() + local cmp = require("cmp") + local lspkind = require("lspkind") + local luasnip = require("luasnip") - -- loads vscode style snippets from installed plugins (e.g. friendly-snippets) - require("luasnip.loaders.from_vscode").lazy_load() - require("luasnip.loaders.from_vscode").load({ paths = { "~/.config/nvim/snippets" } }) - luasnip.setup({}) + -- loads vscode style snippets from installed plugins (e.g. friendly-snippets) + require("luasnip.loaders.from_vscode").lazy_load() + require("luasnip.loaders.from_vscode").load({ paths = { "~/.config/nvim/snippets" } }) + luasnip.setup({}) - -- luasnip.filetype_extend("htmldjango", { "html" }) + -- luasnip.filetype_extend("htmldjango", { "html" }) - cmp.setup({ - completion = { - completeopt = "menu,menuone,preview,noselect", - }, + cmp.setup({ + completion = { + completeopt = "menu,menuone,preview,noselect", + }, - window = { - documentation = cmp.config.window.bordered(), - completion = cmp.config.window.bordered({ - winhighlight = "Normal:CmpPmenu,CursorLine:PmenuSel,Search:None", - }), - }, + window = { + documentation = cmp.config.window.bordered({ + border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, + }), + completion = cmp.config.window.bordered({ + border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, + winhighlight = "Normal:CmpPmenu,CursorLine:PmenuSel,Search:None", + }), + }, - snippet = { -- configure how nvim-cmp interacts with snippet engine - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, + snippet = { -- configure how nvim-cmp interacts with snippet engine + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.select_next_item({ behavior = cmp.ConfirmBehavior.Select }), -- next suggestion - [""] = cmp.mapping.select_prev_item({ behavior = cmp.ConfirmBehavior.Select }), -- prev suggestion - [""] = cmp.mapping.scroll_docs(4, { behavior = cmp.ConfirmBehavior.Select }), -- docs forward - [""] = cmp.mapping.scroll_docs(-4, { behavior = cmp.ConfirmBehavior.Select }), -- docs back - [""] = cmp.mapping.complete(), -- show completion suggestions - [""] = cmp.mapping.abort(), -- close completion window - [""] = cmp.mapping.confirm({ select = false }), -- autocomplete if selected - -- Mapping for Tab key - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true }) - else - -- Otherwise, fallback (insert a tab character) - require("neotab").tabout() - -- fallback() - end - end, { "i", "s" }), + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_next_item({ behavior = cmp.ConfirmBehavior.Select }), -- next suggestion + [""] = cmp.mapping.select_prev_item({ behavior = cmp.ConfirmBehavior.Select }), -- prev suggestion + [""] = cmp.mapping.scroll_docs(4, { behavior = cmp.ConfirmBehavior.Select }), -- docs forward + [""] = cmp.mapping.scroll_docs(-4, { behavior = cmp.ConfirmBehavior.Select }), -- docs back + [""] = cmp.mapping.complete(), -- show completion suggestions + [""] = cmp.mapping.abort(), -- close completion window + [""] = cmp.mapping.confirm({ select = false }), -- autocomplete if selected + -- Mapping for Tab key + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true }) + else + -- Otherwise, fallback (insert a tab character) + require("neotab").tabout() + -- fallback() + end + end, { "i", "s" }), - -- Mapping for jumping in snippets - [""] = cmp.mapping(function(fallback) - if require("luasnip").jumpable() then - -- Jump backwards if inside a snippet - require("luasnip").jump() - else - -- Otherwise, fallback (insert a tab character) - fallback() - end - end, { "i", "s" }), + -- Mapping for jumping in snippets + [""] = cmp.mapping(function(fallback) + if require("luasnip").jumpable() then + -- Jump backwards if inside a snippet + require("luasnip").jump() + else + -- Otherwise, fallback (insert a tab character) + fallback() + end + end, { "i", "s" }), - -- Mapping for jumping backwards in snippets - [""] = cmp.mapping(function(fallback) - if require("luasnip").jumpable() then - -- Jump backwards if inside a snippet - require("luasnip").jump() - else - -- Otherwise, fallback (insert a tab character) - fallback() - end - end, { "i", "s" }), - }), + -- Mapping for jumping backwards in snippets + [""] = cmp.mapping(function(fallback) + if require("luasnip").jumpable() then + -- Jump backwards if inside a snippet + require("luasnip").jump() + else + -- Otherwise, fallback (insert a tab character) + fallback() + end + end, { "i", "s" }), + }), - -- sources for autocompletion - sources = cmp.config.sources({ - { name = "nvim_lsp" }, -- lsp - { name = "luasnip" }, -- snippets - { name = "buffer" }, -- text within current buffer - { name = "path" }, -- file system paths - }), + -- sources for autocompletion + sources = cmp.config.sources({ + { name = "nvim_lsp" }, -- lsp + { name = "luasnip" }, -- snippets + { name = "buffer" }, -- text within current buffer + { name = "path" }, -- file system paths + }), - formatting = { - fields = { "kind", "abbr", "menu" }, - format = lspkind.cmp_format({ - mode = "symbol", -- show only symbol annotations - maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) - -- can also be a function to dynamically calculate max width such as - -- maxwidth = function() return math.floor(0.45 * vim.o.columns) end, - ellipsis_char = "…", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) - show_labelDetails = true, -- show labelDetails in menu. Disabled by default + formatting = { + fields = { "kind", "abbr", "menu" }, + format = lspkind.cmp_format({ + mode = "symbol", -- show only symbol annotations + maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) + -- can also be a function to dynamically calculate max width such as + -- maxwidth = function() return math.floor(0.45 * vim.o.columns) end, + ellipsis_char = "…", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) + show_labelDetails = true, -- show labelDetails in menu. Disabled by default - -- The function below will be called before any actual modifications from lspkind - -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30)) - before = function(entry, vim_item) - return vim_item - end, - }), - }, - }) + -- The function below will be called before any actual modifications from lspkind + -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30)) + before = function(entry, vim_item) + return vim_item + end, + }), + }, + }) - local opts = { silent = true } - opts.desc = "next snippet placeholder" - vim.keymap.set({ "i", "s" }, "", function() - luasnip.jump(1) - end, opts) + local opts = { silent = true } + opts.desc = "next snippet placeholder" + vim.keymap.set({ "i", "s" }, "", function() + luasnip.jump(1) + end, opts) - opts.desc = "previous snippet placeholder" - vim.keymap.set({ "i", "s" }, "", function() - luasnip.jump(-1) - end, opts) + opts.desc = "previous snippet placeholder" + vim.keymap.set({ "i", "s" }, "", function() + luasnip.jump(-1) + end, opts) - opts.desc = "LuaSnip unlink" - vim.keymap.set({ "i", "n" }, "", function() - luasnip.unlink_current() - end, opts) - end, + opts.desc = "LuaSnip unlink" + vim.keymap.set({ "i", "n" }, "", function() + luasnip.unlink_current() + end, opts) + end, } diff --git a/nvim/lua/plugins/style/colors.lua b/nvim/lua/plugins/style/colors.lua index 047f3c2..6d5ef64 100755 --- a/nvim/lua/plugins/style/colors.lua +++ b/nvim/lua/plugins/style/colors.lua @@ -1,137 +1,137 @@ return { - -- color theme - "EdenEast/nightfox.nvim", - lazy = false, - priority = 1000, - config = function() - local Shade = require("nightfox.lib.shade") - require("nightfox").setup({ - options = { - transparent = true, - styles = { - comments = "italic", - functions = "italic", - keywords = "italic", - types = "italic", - }, - }, - palettes = { - all = { - black = Shade.new("#404944", 0.15, -0.15), - gray = Shade.new("#505050", 0.15, -0.15), - white = Shade.new("#dee4df", 0.15, -0.15), - red = Shade.new("#ff6060", 0.15, -0.15), - darkred = Shade.new("#AA3030", 0.15, -0.15), - strongred = Shade.new("#bb0000", 0.15, -0.15), - orange = Shade.new("#ce8c14", 0.15, -0.15), - green = Shade.new("#a3d397", 0.10, -0.15), - darkgreen = Shade.new("#005602", 0.10, -0.15), - darkyellow = Shade.new("#dfd100", 0.10, -0.15), - yellow = Shade.new("#e3c46d", 0.15, -0.15), - darkblue = Shade.new("#1010cc", 0.15, -0.15), - blue = Shade.new("#7070dd", 0.15, -0.15), - magenta = Shade.new("#C02490", 0.30, -0.15), - pink = Shade.new("#ff82c2", 0.15, -0.15), - purple = Shade.new("#761464", 0.15, -0.15), - turquoise = Shade.new("#3fffb0", 0.15, -0.15), - cyan = Shade.new("#7ac9ff", 0.15, -0.15), - lightblue = Shade.new("#add8e6", 0.15, -0.15), - softblue = Shade.new("#10aaff", 0.15, -0.15), - brown = Shade.new("#664010", 0.15, -0.15), + -- color theme + "EdenEast/nightfox.nvim", + lazy = false, + priority = 1000, + config = function() + local Shade = require("nightfox.lib.shade") + require("nightfox").setup({ + options = { + transparent = true, + styles = { + comments = "italic", + functions = "italic", + keywords = "italic", + types = "italic", + }, + }, + palettes = { + all = { + black = Shade.new("#404944", 0.15, -0.15), + gray = Shade.new("#505050", 0.15, -0.15), + white = Shade.new("#dee4df", 0.15, -0.15), + red = Shade.new("#ff6060", 0.15, -0.15), + darkred = Shade.new("#AA3030", 0.15, -0.15), + strongred = Shade.new("#bb0000", 0.15, -0.15), + orange = Shade.new("#ce8c14", 0.15, -0.15), + green = Shade.new("#a3d397", 0.10, -0.15), + darkgreen = Shade.new("#005602", 0.10, -0.15), + darkyellow = Shade.new("#dfd100", 0.10, -0.15), + yellow = Shade.new("#e3c46d", 0.15, -0.15), + darkblue = Shade.new("#1010cc", 0.15, -0.15), + blue = Shade.new("#7070dd", 0.15, -0.15), + magenta = Shade.new("#C02490", 0.30, -0.15), + pink = Shade.new("#ff82c2", 0.15, -0.15), + purple = Shade.new("#761464", 0.15, -0.15), + turquoise = Shade.new("#3fffb0", 0.15, -0.15), + cyan = Shade.new("#7ac9ff", 0.15, -0.15), + lightblue = Shade.new("#add8e6", 0.15, -0.15), + softblue = Shade.new("#10aaff", 0.15, -0.15), + brown = Shade.new("#664010", 0.15, -0.15), - bg0 = "#0f1512", -- Dark bg (status line and float) - bg1 = "#0f1512", -- Default bg - bg2 = "#1b211e", -- Lighter bg (colorcolm folds) - bg3 = "#252b28", -- Lighter bg (cursor line) - bg4 = "#303633", -- Conceal, border fg + bg0 = "#0f1512", -- Dark bg (status line and float) + bg1 = "#0f1512", -- Default bg + bg2 = "#1b211e", -- Lighter bg (colorcolm folds) + bg3 = "#252b28", -- Lighter bg (cursor line) + bg4 = "#303633", -- Conceal, border fg - fg0 = "#dee4df", -- Lighter fg - fg1 = "#dee4df", -- Default fg - fg2 = "#dee4df", -- Darker fg (status line) - fg3 = "#89938d", -- Darker fg (line numbers, fold colums) + fg0 = "#dee4df", -- Lighter fg + fg1 = "#dee4df", -- Default fg + fg2 = "#dee4df", -- Darker fg (status line) + fg3 = "#89938d", -- Darker fg (line numbers, fold colums) - sel0 = "#404944", -- Popup bg, visual selection - sel1 = "#00513b", -- Popup sel bg, search bg + sel0 = "#404944", -- Popup bg, visual selection + sel1 = "#00513b", -- Popup sel bg, search bg - comment = "#89938d", - }, - }, - specs = { - carbonfox = { - syntax = { - comment = "comment", - bracket = "darkyellow", - builtin0 = "turquoise", - builtin1 = "cyan", - builtin2 = "lightblue", - conditional = "darkblue", - const = "gray", - dep = "darkred", - field = "green", - func = "pink", - ident = "darkgreen", - keyword = "blue", - number = "yellow", - operator = "white", - preproc = "strongred", - regex = "purple", - statement = "magenta", - string = "softblue", - type = "red", - variable = "orange", - }, - diag = { - error = "darkred", - warn = "yellow", - info = "softblue", - hint = "fg3", - ok = "darkgreen", - }, - diag_bg = { - error = "red", - warn = "#a16b00", - info = "cyan", - hint = "bg3", - ok = "green", - }, - diff = { - add = "darkgreen", - delete = "darkred", - changed = "softblue", - text = "fg0", - }, - git = { - add = "darkgreen", - removed = "darkred", - changed = "softblue", - conflict = "orange", - ignored = "gray", - }, - }, - }, - groups = { - all = { - Cursor = { fg = "palette.white", bg = "palette.lightblue" }, -- character under the cursor - WinSeparator = { fg = "palette.bg2" }, -- the column separating vertically split windows - EndOfBuffer = { link = "WinSeparator" }, -- filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|. - CursorLine = { bg = "palette.bg1" }, - CursorLineNr = { fg = "palette.cyan", style = "bold" }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. - Search = { fg = "palette.softblue", bg = "#00513b" }, -- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out. - IncSearch = { fg = "palette.softblue", bg = "#1a6b51" }, -- 'incsearch' highlighting; also used for the text replaced with ":s///c" - ModeMsg = { fg = "palette.fg3", style = "bold" }, -- 'showmode' message (e.g., "-- INSERT --") + comment = "#89938d", + }, + }, + specs = { + carbonfox = { + syntax = { + comment = "comment", + bracket = "darkyellow", + builtin0 = "turquoise", + builtin1 = "cyan", + builtin2 = "lightblue", + conditional = "darkblue", + const = "gray", + dep = "darkred", + field = "green", + func = "pink", + ident = "darkgreen", + keyword = "blue", + number = "yellow", + operator = "white", + preproc = "strongred", + regex = "purple", + statement = "magenta", + string = "softblue", + type = "red", + variable = "orange", + }, + diag = { + error = "darkred", + warn = "yellow", + info = "softblue", + hint = "fg3", + ok = "darkgreen", + }, + diag_bg = { + error = "red", + warn = "#a16b00", + info = "cyan", + hint = "bg3", + ok = "green", + }, + diff = { + add = "darkgreen", + delete = "darkred", + changed = "softblue", + text = "fg0", + }, + git = { + add = "darkgreen", + removed = "darkred", + changed = "softblue", + conflict = "orange", + ignored = "gray", + }, + }, + }, + groups = { + all = { + Cursor = { fg = "palette.white", bg = "palette.lightblue" }, -- character under the cursor + WinSeparator = { fg = "palette.bg2" }, -- the column separating vertically split windows + EndOfBuffer = { link = "WinSeparator" }, -- filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|. + CursorLine = { bg = "palette.bg1" }, + CursorLineNr = { fg = "palette.cyan", style = "bold" }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. + Search = { fg = "palette.softblue", bg = "#00513b" }, -- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out. + IncSearch = { fg = "palette.softblue", bg = "#1a6b51" }, -- 'incsearch' highlighting; also used for the text replaced with ":s///c" + ModeMsg = { fg = "palette.fg3", style = "bold" }, -- 'showmode' message (e.g., "-- INSERT --") - SnacksDashboardNormal = { fg = "palette.green" }, - SnacksDashboardDesc = { fg = "palette.softblue" }, - SnacksDashboardFile = { fg = "palette.softblue" }, - SnacksDashboardIcon = { fg = "palette.orange" }, - SnacksDashboardHeader = { fg = "palette.darkred" }, - SnacksDashboardTitle = { fg = "palette.turquoise" }, - SnacksIndentScope = { fg = "palette.lightblue" } - }, - }, - }) - if not vim.g.vscode then - vim.cmd([[colorscheme carbonfox]]) - end - end, + SnacksDashboardNormal = { fg = "palette.green" }, + SnacksDashboardDesc = { fg = "palette.softblue" }, + SnacksDashboardFile = { fg = "palette.softblue" }, + SnacksDashboardIcon = { fg = "palette.orange" }, + SnacksDashboardHeader = { fg = "palette.darkred" }, + SnacksDashboardTitle = { fg = "palette.turquoise" }, + SnacksIndentScope = { fg = "palette.lightblue" }, + }, + }, + }) + if not vim.g.vscode then + vim.cmd([[colorscheme carbonfox]]) + end + end, } diff --git a/nvim/lua/plugins/style/dressing.lua b/nvim/lua/plugins/style/dressing.lua deleted file mode 100755 index 689baae..0000000 --- a/nvim/lua/plugins/style/dressing.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - -- prettier prompts - "stevearc/dressing.nvim", - event = "VeryLazy", -}