diff options
Diffstat (limited to '.config/nvim/lua/plugins')
| -rw-r--r-- | .config/nvim/lua/plugins/coding.lua | 150 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/colorscheme.lua | 48 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/editor.lua | 24 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/lsp.lua | 406 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/ui.lua | 477 | ||||
| -rw-r--r-- | .config/nvim/lua/plugins/utils.lua | 4 |
6 files changed, 182 insertions, 927 deletions
diff --git a/.config/nvim/lua/plugins/coding.lua b/.config/nvim/lua/plugins/coding.lua deleted file mode 100644 index fd636fa..0000000 --- a/.config/nvim/lua/plugins/coding.lua +++ /dev/null @@ -1,150 +0,0 @@ -return { - -- { "echasnovski/mini.move", config = true }, - { "echasnovski/mini.comment", config = true }, - { "max397574/better-escape.nvim", config = true }, - { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - config = function() - local configs = require "nvim-treesitter.configs" - configs.setup { - ensure_installed = { - "lua", - "c", - "vim", - "vimdoc", - "query", - "rust", - "fish", - "json", - "javascript", - "latex", - "markdown", - "markdown_inline", - "zig", - "typescript", - "toml", - "svelte", - "comment", - "html", - "typst", - "ron" - }, - highlight = { enable = true }, - indent = { enable = true }, - } - end, - }, - { - "ggandor/leap.nvim", - config = function() - local leap = require "leap" - leap.add_default_mappings() - leap.opts.highlight_unlabeled_phase_one_targets = true - end, - dependencies = { - "tpope/vim-repeat", - }, - }, - { - "hrsh7th/nvim-cmp", - opts = function() - vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true }) - local cmp = require "cmp" - local defaults = require "cmp.config.default"() - return { - enabled = function() - local context = require "cmp.config.context" - if vim.api.nvim_get_mode().mode == "c" then - return true - else - return not context.in_treesitter_capture "comment" and not context.in_syntax_group "Comment" - end - end, - - completion = { - completeopt = "menu,menuone,noinsert", - }, - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - mapping = cmp.mapping.preset.insert { - ["<C-j>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert }, - ["<C-k>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert }, - ["<C-b>"] = cmp.mapping.scroll_docs(-4), - ["<C-f>"] = cmp.mapping.scroll_docs(4), - ["<S-CR>"] = cmp.mapping.abort(), - ["<CR>"] = cmp.mapping.confirm { select = false }, - }, - sources = cmp.config.sources { - { name = "nvim_lsp" }, - { name = "path" }, - }, - formatting = { - format = function(_, item) - local icons = require("icons").kinds - if icons[item.kind] then - item.kind = icons[item.kind] .. item.kind - end - return item - end, - }, - experimental = { - ghost_text = { - hl_group = "CmpGhostText", - }, - }, - sorting = defaults.sorting, - } - end, - dependencies = { - { "L3MON4D3/LuaSnip", build = "make install_jsregexp" }, - "hrsh7th/cmp-path", - "saadparwaiz1/cmp_luasnip", - }, - disabled = true - }, - { - "NvChad/nvim-colorizer.lua", - opts = { - user_default_options = { RGB = true, RRGGBB = true, RRGGBBAA = true, always_update = true, names = false }, - }, - }, - { - "echasnovski/mini.surround", - version = false, - opts = { - mappings = { - add = "\\a", -- Add surrounding in Normal and Visual modes - delete = "\\d", -- Delete surrounding - find = "\\f", -- Find surrounding (to the right) - find_left = "\\F", -- Find surrounding (to the left) - highlight = "\\h", -- Highlight surrounding - replace = "\\r", -- Replace surrounding - update_n_lines = "\\n", -- Update `n_lines` - } - } - }, - { - "color_converter", - dev = true, - dependencies = { - { 'echasnovski/mini.colors', version = '*' }, - "MunifTanjim/nui.nvim", - }, - -- lazy = false, - cmd = "ColorConverter", - config = true - }, - -- { - -- "m4xshen/hardtime.nvim", - -- config = true, - -- disabled = true - -- } -} diff --git a/.config/nvim/lua/plugins/colorscheme.lua b/.config/nvim/lua/plugins/colorscheme.lua index e0f2a96..100d92a 100644 --- a/.config/nvim/lua/plugins/colorscheme.lua +++ b/.config/nvim/lua/plugins/colorscheme.lua @@ -1,53 +1,7 @@ return { - -- { - -- "folke/tokyonight.nvim", - -- lazy = false, - -- priority = 1000, - -- config = function() - -- vim.cmd [[colorscheme tokyonight-night]] - -- end, - -- }, - -- { - -- "chadcat7/prism", - -- config = function() - -- require("prism"):setup { - -- customSchemes = { - -- { - -- name = "prismite", - -- background = "#1b2026", - -- foreground = "#d9dfe4", - -- cursorline = "#1f242b", - -- comment = "#434754", - -- darker = "#161b22", - -- cursor = "#fdc267", - -- black = "#1b2026", -- useful when background is transparent - -- color0 = "#1f242b", - -- color1 = "#df625d", - -- color2 = "#91d89a", - -- color3 = "#fdc267", - -- color4 = "#8ec6ff", - -- color5 = "#f2b9c1", - -- color6 = "#77e2e3", - -- color7 = "#d9dfe4", - -- color8 = "#373D41", - -- color9 = "#f1726b", - -- color10 = "#a1e9aa", - -- color11 = "#ffd79d", - -- color12 = "#add6ff", - -- color13 = "#ffcbd2", - -- color14 = "#88f3f3", - -- color15 = "#d9dfe4", - -- }, - -- }, - -- currentTheme = "prismite", - -- reset = true, - -- reload = { "lualine" }, - -- } - -- end, - -- enabled = false - -- }, { dir = "/home/delta/Documents/RealProjects/lua/prismite.nvim", + -- "https://git.twoexem.com/prismite.nvim", lazy = false, priority = 1000, config = function() diff --git a/.config/nvim/lua/plugins/editor.lua b/.config/nvim/lua/plugins/editor.lua deleted file mode 100644 index 47fe8b4..0000000 --- a/.config/nvim/lua/plugins/editor.lua +++ /dev/null @@ -1,24 +0,0 @@ -return { - -- { "Saecki/crates.nvim", config = true }, - { - "nvim-telescope/telescope.nvim", - config = true, - dependencies = { "nvim-lua/plenary.nvim" }, - }, - { - "natecraddock/sessions.nvim", - config = true - }, - { - "f-person/git-blame.nvim", - event = "VeryLazy", - opts = { - date_format = "%r" - }, - }, - { - "chentoast/marks.nvim", - -- event = "VeryLazy", - config = true - } -} diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua index 1063c5d..a438f3a 100644 --- a/.config/nvim/lua/plugins/lsp.lua +++ b/.config/nvim/lua/plugins/lsp.lua @@ -1,254 +1,210 @@ -local icons = require("icons") +local icons = require "icons" -- this is horrible and it should be redone someday -- but that day is not today +local _supports_method = {} + return { - { - "neovim/nvim-lspconfig", - -- enabled = false, - event = { "BufReadPre", "BufNewFile" }, - dependencies = { - { "williamboman/mason.nvim", config = true, lazy = false }, - { "mason-org/mason-lspconfig.nvim", opts = { automatic_enable = false } }, - "hrsh7th/cmp-nvim-lsp", - }, - opts = { - diagnostics = { - }, - servers = { - lua_ls = { - settings = { - Lua = { - -- workspace = { - -- checkThirdParty = false, - -- library = { - -- vim.env.VIMRUNTIME, - -- }, - -- }, - completion = { - showWord = "Disable", - displayContext = 8, - }, - hint = { - enable = true, - }, - diagnostics = { "trailing-space" }, + "neovim/nvim-lspconfig", + -- enabled = false, + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + { "williamboman/mason.nvim", config = true, lazy = false }, + { "mason-org/mason-lspconfig.nvim", opts = { automatic_enable = false } }, + -- "hrsh7th/cmp-nvim-lsp", + "saghen/blink.cmp", + }, + opts = { + diagnostics = {}, + servers = { + lua_ls = { + settings = { + Lua = { + workspace = { + checkThirdParty = false, + }, + completion = { + showWord = "Disable", + displayContext = 8, + }, + hint = { + enable = true, }, + diagnostics = { "trailing-space" }, }, }, - rust_analyzer = { settings = { completion = { fullFunctionSignatures = true } } }, - ts_ls = {}, }, - setup = {} + rust_analyzer = { settings = { completion = { fullFunctionSignatures = true } } }, + ts_ls = {}, }, - config = function(_, opts) - local function on_attach(fn) - vim.api.nvim_create_autocmd("LspAttach", { - callback = function(args) - local buffer = args.buf - local client = vim.lsp.get_client_by_id(args.data.client_id) - fn(client, buffer) - end, - }) + setup = {}, + inlay_hints = { + exclude = {}, + }, + }, + config = function(_, opts) + ---@param client vim.lsp.Client + local function _check_methods(client, buffer) + -- don't trigger on invalid buffers + if not vim.api.nvim_buf_is_valid(buffer) then + return end - - ---@param method string - ---@param fn fun(client:vim.lsp.Client, buffer) - local function on_supports_method(method, fn) - -- cache[method] = cache[method] or setmetatable({}, { __mode = "k" }) - return vim.api.nvim_create_autocmd("User", { - pattern = "LspSupportsMethod", - callback = function(args) - local client = vim.lsp.get_client_by_id(args.data.client_id) - local buffer = args.data.buffer ---@type number - if client and method == args.data.method then - return fn(client, buffer) - end - end, - }) + -- don't trigger on non-listed buffers + if not vim.bo[buffer].buflisted then + return end - - -- function _check_methods(client, buffer) - -- if - -- -- don't trigger on invalid buffers - -- not vim.api.nvim_buf_is_valid(buffer) or - -- -- don't trigger on non-listed buffers - -- vim.bo[buffer].buflisted or - -- -- don't trigger on nofile buffers - -- vim.bo[buffer].buftype == "nofile" - -- then - -- return - -- end - -- for method, clients in pairs(M._supports_method) do - -- clients[client] = clients[client] or {} - -- if not clients[client][buffer] then - -- if client.supports_method and client.supports_method(method, { bufnr = buffer }) then - -- clients[client][buffer] = true - -- vim.api.nvim_exec_autocmds("User", { - -- pattern = "LspSupportsMethod", - -- data = { client_id = client.id, buffer = buffer, method = method }, - -- }) - -- end - -- end - -- end - -- end - - on_supports_method("textDocument/inlayHint", function(client, buffer) - if - vim.api.nvim_buf_is_valid(buffer) - and vim.bo[buffer].buftype == "" - and not vim.tbl_contains(opts.inlay_hints.exclude, vim.bo[buffer].filetype) - then - vim.lsp.inlay_hint.enable(true, { bufnr = buffer }) + -- don't trigger on nofile buffers + if vim.bo[buffer].buftype == "nofile" then + return + end + for method, clients in pairs(_supports_method) do + clients[client] = clients[client] or {} + if not clients[client][buffer] then + if client.supports_method and client.supports_method(method, { bufnr = buffer }) then + clients[client][buffer] = true + vim.api.nvim_exec_autocmds("User", { + pattern = "LspSupportsMethod", + data = { client_id = client.id, buffer = buffer, method = method }, + }) + end end - end) + end + end - vim.diagnostic.config({ - underline = true, - update_in_insert = false, - virtual_text = { - spacing = 4, - source = "if_many", - prefix = function(diagnostic) - for name, icon in pairs(icons.diagnostics) do - if diagnostic.severity == vim.diagnostic.severity[name:upper()] then - return icon - end - end + ---@param on_attach fun(client:vim.lsp.Client, buffer) + ---@param name? string + local function on_attach(_on_attach, name) + return vim.api.nvim_create_autocmd("LspAttach", { + callback = function(args) + local buffer = args.buf ---@type number + local client = vim.lsp.get_client_by_id(args.data.client_id) + if client and (not name or client.name == name) then + return _on_attach(client, buffer) end + end, + }) + end - }, - severity_sort = true, + ---@param method string + ---@param fn fun(client:vim.lsp.Client, buffer) + local function on_supports_method(method, fn) + _supports_method[method] = _supports_method[method] or setmetatable({}, { __mode = "k" }) + return vim.api.nvim_create_autocmd("User", { + pattern = "LspSupportsMethod", + callback = function(args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + local buffer = args.data.buffer ---@type number + if client and method == args.data.method then + return fn(client, buffer) + end + end, }) + end - local servers = opts.servers - local cmp_nvim_lsp = require "cmp_nvim_lsp" - local capabilities = vim.tbl_deep_extend( - "force", - {}, - vim.lsp.protocol.make_client_capabilities(), - cmp_nvim_lsp.default_capabilities() - ) + ---@param fn fun(client:vim.lsp.Client, buffer):boolean? + ---@param opts? {group?: integer} + local function on_dynamic_capability(fn, opts) + return vim.api.nvim_create_autocmd("User", { + pattern = "LspDynamicCapability", + group = opts and opts.group or nil, + callback = function(args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + local buffer = args.data.buffer ---@type number + if client then + return fn(client, buffer) + end + end, + }) + end - local function setup(server) - local server_opts = vim.tbl_deep_extend("force", { - capabilities = vim.deepcopy(capabilities), - }, servers[server] or {}) + local register_capability = vim.lsp.handlers["client/registerCapability"] + vim.lsp.handlers["client/registerCapability"] = function(err, res, ctx) + ---@diagnostic disable-next-line: no-unknown + local ret = register_capability(err, res, ctx) + local client = vim.lsp.get_client_by_id(ctx.client_id) + if client then + for buffer in pairs(client.attached_buffers) do + vim.api.nvim_exec_autocmds("User", { + pattern = "LspDynamicCapability", + data = { client_id = client.id, buffer = buffer }, + }) + end + end + return ret + end + on_attach(_check_methods) + on_dynamic_capability(_check_methods) - if opts.setup[server] then - if opts.setup[server](server, server_opts) then - return - end - elseif opts.setup["*"] then - if opts.setup["*"](server, server_opts) then - return + -- on_supports_method("textDocument/inlayHint", function(client, buffer) + -- if + -- vim.api.nvim_buf_is_valid(buffer) + -- and vim.bo[buffer].buftype == "" + -- and not vim.tbl_contains(opts.inlay_hints.exclude, vim.bo[buffer].filetype) + -- then + -- vim.lsp.inlay_hint.enable(true, { bufnr = buffer }) + -- end + -- end) + + vim.diagnostic.config { + underline = true, + update_in_insert = false, + virtual_text = { + spacing = 4, + source = "if_many", + prefix = function(diagnostic) + for name, icon in pairs(icons.diagnostics) do + if diagnostic.severity == vim.diagnostic.severity[name:upper()] then + return "[" .. icon .. "]" + end end + end, + }, + severity_sort = true, + } + + local servers = opts.servers + local blink_cmp = require "blink.cmp" + local capabilities = vim.tbl_deep_extend( + "force", + {}, + vim.lsp.protocol.make_client_capabilities(), + blink_cmp.get_lsp_capabilities({}, false) + ) + + local function setup(server) + local server_opts = vim.tbl_deep_extend("force", { + capabilities = vim.deepcopy(capabilities), + }, servers[server] or {}) + + if opts.setup[server] then + if opts.setup[server](server, server_opts) then + return + end + elseif opts.setup["*"] then + if opts.setup["*"](server, server_opts) then + return end - require("lspconfig")[server].setup(server_opts) end + vim.lsp.config(server, server_opts) + vim.lsp.enable(server) + end - local mlsp = require "mason-lspconfig" - local all_mslp_servers = require("mason-lspconfig").get_mappings().lspconfig_to_package + local mlsp = require "mason-lspconfig" + local all_mslp_servers = require("mason-lspconfig").get_mappings().lspconfig_to_package - local ensure_installed = {} - for server, server_opts in pairs(servers) do - if server_opts then - server_opts = server_opts == true and {} or server_opts - if server_opts.mason == false or not vim.tbl_contains(all_mslp_servers, server) then - setup(server) - else - ensure_installed[#ensure_installed + 1] = server - end + local ensure_installed = {} + for server, server_opts in pairs(servers) do + if server_opts then + server_opts = server_opts == true and {} or server_opts + if server_opts.mason == false or not vim.tbl_contains(all_mslp_servers, server) then + setup(server) + else + ensure_installed[#ensure_installed + 1] = server end end + end - -- mlsp.setup { ensure_installed = ensure_installed, handlers = { setup } } - mlsp.setup { ensure_installed = ensure_installed } - end, - -- config = function(_, opts) - -- local cache = {} - -- - -- - -- - -- - -- on_attach(function(client, buffer) - -- -- TODO: add keybinds - -- end) - -- - -- local register_capability = vim.lsp.handlers["client/registerCapability"] - -- - -- vim.lsp.handlers["client/registerCapability"] = function(err, res, ctx) - -- local ret = register_capability(err, res, ctx) - -- local client_id = ctx.client_id - -- local client = vim.lsp.get_client_by_id(client_id) - -- local buffer = vim.api.nvim_get_current_buf() - -- -- TODO: add keybinds - -- return ret - -- end - -- - -- for name, icon in pairs(require("icons").diagnostics) do - -- name = "DiagnosticSign" .. name - -- vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" }) - -- end - -- - -- local inlay_hint = vim.lsp.buf.inlay_hint or vim.lsp.inlay_hint - -- - -- - -- if type(opts.diagnostics.virtual_text) == "table" and opts.diagnostics.virtual_text.prefix == "icons" then - -- opts.diagnostics.virtual_text.prefix = vim.fn.has "nvim-0.10.0" == 0 and "●" - -- end - -- --- ) - -- - -- local servers = opts.servers - -- local has_cmp, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") - -- local capabilities = vim.tbl_deep_extend( - -- "force", - -- {}, - -- vim.lsp.protocol.make_client_capabilities(), - -- has_cmp and cmp_nvim_lsp.default_capabilities() or {}, - -- opts.capabilities or {} - -- ) - -- - -- local function setup(server) - -- local server_opts = vim.tbl_deep_extend("force", { - -- capabilities = vim.deepcopy(capabilities), - -- }, servers[server] or {}) - -- - -- if opts.setup[server] then - -- if opts.setup[server](server, server_opts) then - -- return - -- end - -- elseif opts.setup["*"] then - -- if opts.setup["*"](server, server_opts) then - -- return - -- end - -- end - -- require("lspconfig")[server].setup(server_opts) - -- end - -- - -- local have_mason, mlsp = pcall(require, "mason-lspconfig") - -- local all_mslp_servers = {} - -- if have_mason then - -- all_mslp_servers = vim.tbl_keys(require("mason-lspconfig.mappings.server").lspconfig_to_package) - -- end - -- - -- local ensure_installed = {} - -- for server, server_opts in pairs(servers) do - -- if server_opts then - -- server_opts = server_opts == true and {} or server_opts - -- if server_opts.mason == false or not vim.tbl_contains(all_mslp_servers, server) then - -- setup(server) - -- else - -- ensure_installed[#ensure_installed + 1] = server - -- end - -- end - -- end - -- - -- if have_mason then - -- mlsp.setup { ensure_installed = ensure_installed, handlers = { setup } } - -- end - -- end, - }, + mlsp.setup { ensure_installed = ensure_installed } + end, } diff --git a/.config/nvim/lua/plugins/ui.lua b/.config/nvim/lua/plugins/ui.lua deleted file mode 100644 index e79ee3a..0000000 --- a/.config/nvim/lua/plugins/ui.lua +++ /dev/null @@ -1,477 +0,0 @@ -local leap_active = false -vim.api.nvim_create_autocmd("User", { - pattern = "LeapEnter", - callback = function() - leap_active = true - end, -}) - -vim.api.nvim_create_autocmd("User", { - pattern = "LeapLeave", - callback = function() - leap_active = false - end, -}) - -local nvim_tree_root = nil - -return { - { - "willothy/nvim-cokeline", - - config = function() - local hl = require("cokeline.hlgroups") - local is_picking_focus = require('cokeline.mappings').is_picking_focus - local is_picking_close = require('cokeline.mappings').is_picking_close - - local function has_diagnostics(buffer) - return buffer.diagnostics.errors > 0 or buffer.diagnostics.warnings > 0 or buffer.diagnostics.infos > 0 or buffer.diagnostics.hints > 0 - end - - require("cokeline").setup { - show_if_buffers_are_at_least = 0, - components = { - { - text = function(buffer) - return buffer.is_first and (require "cokeline.sidebar".get_width("left") == 0 and "" or "│") or "▎" - end, - fg = function() - return hl.get_hl_attr("WinSeparator", "fg") - end, - }, - { - text = function (buffer) - return (is_picking_focus() or is_picking_close()) and " " .. buffer.pick_letter or "" - end, - fg = function () - return hl.get_hl_attr("PrismiteYellow", "fg") - end - }, - { - text = function(buffer) - return " " .. buffer.devicon.icon - end, - fg = function(buffer) - return buffer.devicon.color - end, - }, - { - text = function(buffer) - return buffer.unique_prefix - end, - fg = function() - return hl.get_hl_attr("Comment", "fg") - end, - italic = true, - }, - { - text = function(buffer) - return buffer.filename - end, - }, - { - ---@param buffer Buffer - text = function(buffer) - return buffer.is_modified and " " or "" - end, - }, - { - text = function(buffer) - return has_diagnostics(buffer) and " [" or "" - end, - fg = function() - return hl.get_hl_attr("WinSeparator", "fg") - end, - }, - { - text = function(buffer) - local errors = buffer.diagnostics.errors - return errors > 0 and errors or "" - end, - fg = function () - return hl.get_hl_attr("DiagnosticError", "fg") - - end - }, - { - text = function (buffer) - local bd = buffer.diagnostics - return (bd.errors > 0 and (bd.warnings > 0 or bd.infos > 0 or bd.hints > 0)) and "|" or "" - end, - fg = function() - return hl.get_hl_attr("WinSeparator", "fg") - end, - }, - { - text = function(buffer) - local warnings = buffer.diagnostics.warnings - return warnings > 0 and warnings or "" - end, - fg = function () - return hl.get_hl_attr("DiagnosticWarn", "fg") - end - }, - { - text = function (buffer) - local bd = buffer.diagnostics - return (bd.warnings > 0 and (bd.infos > 0 or bd.hints > 0)) and "|" or "" - end, - fg = function() - return hl.get_hl_attr("WinSeparator", "fg") - end, - }, - { - text = function(buffer) - local infos = buffer.diagnostics.infos - return infos > 0 and infos or "" - end, - fg = function () - return hl.get_hl_attr("DiagnosticInfo", "fg") - end - }, - { - text = function (buffer) - local bd = buffer.diagnostics - return (bd.infos > 0 and bd.hints > 0) and "|" or "" - end, - fg = function() - return hl.get_hl_attr("WinSeparator", "fg") - end, - }, - { - text = function(buffer) - local hints = buffer.diagnostics.hints - return hints > 0 and hints or "" - end, - fg = function () - return hl.get_hl_attr("DiagnosticHint", "fg") - end - }, - { - text = function(buffer) - return has_diagnostics(buffer) and "]" or "" - end, - fg = function() - return hl.get_hl_attr("WinSeparator", "fg") - end, - }, - { - text = " " - } - }, - buffers = { - delete_on_right_click = false - }, - mappings = { - disable_mouse = true - }, - sidebar = { - components = { - { - text = function() - local width = require("cokeline.sidebar").get_width("left") - if #nvim_tree_root > width then - return nvim_tree_root:sub(1, width - 2) .. "…" - else - return nvim_tree_root - end - end, - bg = function() - return hl.get_hl_attr("TabLineSel", "bg") - end, - }, - { - text = function() - return string.rep( - " ", - math.max(0, require("cokeline.sidebar").get_width("left") - #nvim_tree_root) - ) - end, - bg = function() - return hl.get_hl_attr("TabLineSel", "bg") - end - }, - } - } - } - end, - dependencies = { "nvim-tree/nvim-web-devicons", "nvim-lua/plenary.nvim" }, - }, - { - "folke/trouble.nvim", - opts = {}, - dependencies = { "nvim-tree/nvim-web-devicons" }, - }, - { - "nvimdev/indentmini.nvim", - config = true, - opts = { - char = "▏" - } - }, - { - "folke/noice.nvim", - event = "VeryLazy", - opts = { - cmdline = { - format = { - cmdline = { icon = ":" }, - }, - }, - lsp = { - override = { - ["vim.lsp.util.convert_input_to_markdown_lines"] = true, - ["vim.lsp.util.stylize_markdown"] = true, - ["cmp.entry.get_documentation"] = true, - }, - }, - presets = { - command_palette = true, - long_message_to_split = true, - inc_rename = false, - lsp_doc_border = true, - }, - messages = { - view_search = false, - }, - routes = { - { - filter = { - event = "msg_show", - kind = "", - find = "Already at newest change", - }, - view = "mini", - }, - { - filter = { - event = "msg_show", - kind = "", - find = "Already at oldest change", - }, - view = "mini", - }, - { - filter = { - event = "msg_show", - kind = "", - find = "E486: Pattern not found:" - }, - view = "mini" - }, - -- normal search - { - filter = { - event = "msg_show", - kind = "", - find = "E486: Pattern not found:" - }, - view = "mini" - }, - -- failed search - { - filter = { - event = "msg_show", - kind = "", - find = "E486: Pattern not found:" - }, - view = "mini" - }, - -- undo - { - filter = { - event = "msg_show", - kind = "", - find = "%d+ .+ line.?; before #%d+", - }, - view = "mini", - }, - { - filter = { - event = "msg_show", - kind = "", - find = "%d+ .+ line.?; before #%d+", - }, - view = "mini", - }, - -- redo - { - filter = { - event = "msg_show", - kind = "", - find = "%d+ change; after #%d+", - }, - view = "mini" - }, - }, - }, - dependencies = { - "MunifTanjim/nui.nvim", - "rcarriga/nvim-notify", - }, - }, - { - "nvim-lualine/lualine.nvim", - event = "VeryLazy", - opts = { - options = { - section_separators = { left = "", right = "" }, - component_separators = { left = "", right = "" }, - fmt = function(str) - return vim.trim(str) - end, - globalstatus = true, - disabled_filetypes = { "NvimTree" }, - }, - sections = { - lualine_a = { - "mode", - { - function() - return "[L]" - end, - cond = function () - return leap_active - end - }, - { - function() - local reg = vim.fn.reg_recording() - if reg == "" then return "" end -- not recording - return "[@" .. reg .. "]" - end - } - }, - lualine_b = { "filename" }, - lualine_c = { "diagnostics", "diff" }, - lualine_x = { - { - function () - local noice_loaded, noice = pcall(require, "noice") - if noice_loaded then - return noice.api.status.command.get() - else - return "" - end - end, - cond = function() - local noice_loaded, noice = pcall(require, "noice") - if noice_loaded then - return noice.api.status.command.has() - else - return false - end - end - } - }, - lualine_y = { "filetype" }, - lualine_z = { "searchcount", "progress", "location" }, - }, - }, - dependencies = { - "nvim-tree/nvim-web-devicons", - }, - }, - { "stevearc/dressing.nvim", config = true }, - { - "nvim-tree/nvim-tree.lua", - opts = { - sort_by = "case_sensitive", - view = { - width = 30, - }, - renderer = { - root_folder_label = function() return ".." end, - indent_markers = { - enable = true, - }, - icons = { - show = { - folder_arrow = false, - }, - glyphs = { - git = { - unstaged = "-", - staged = "+", - unmerged = "", - renamed = "", - untracked = "", - deleted = "", - ignored = "", - }, - }, - }, - }, - filters = { - git_ignored = false, - custom = { - "^.git$", - }, - }, - }, - config = function(_, opts) - local api = require("nvim-tree.api") - local Event = api.events.Event - - api.events.subscribe(Event.Ready, function() - nvim_tree_root = api.tree.get_nodes().absolute_path - end) - - api.events.subscribe(Event.TreeRendered, function() - nvim_tree_root = api.tree.get_nodes().absolute_path - end) - - require("nvim-tree").setup(vim.tbl_extend("force", opts, { - -- on_attach = function () - -- local function opts(desc) - -- return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } - -- end - -- - -- local function edit_or_open() - -- local node = api.tree.get_node_under_cursor() - -- - -- if node.nodes ~= nil then - -- -- expand or collapse folder - -- api.node.open.edit() - -- else - -- -- open file - -- api.node.open.edit() - -- -- Close the tree if file was opened - -- api.tree.close() - -- end - -- end - -- - -- -- open as vsplit on current node - -- local function vsplit_preview() - -- local node = api.tree.get_node_under_cursor() - -- - -- if node.nodes ~= nil then - -- -- expand or collapse folder - -- api.node.open.edit() - -- else - -- -- open file as vsplit - -- api.node.open.vertical() - -- end - -- - -- -- Finally refocus on tree if it was lost - -- api.tree.focus() - -- end - -- - -- vim.keymap.set("n", "l", edit_or_open, opts("Edit Or Open")) - -- vim.keymap.set("n", "h", api.tree.close, opts("Close")) - -- end - -- - })) - end, - dependencies = { - "nvim-tree/nvim-web-devicons", - }, - }, - { - "goolord/alpha-nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - config = function() - require("alpha").setup(require "dash") - end, - }, -} diff --git a/.config/nvim/lua/plugins/utils.lua b/.config/nvim/lua/plugins/utils.lua deleted file mode 100644 index 3c16433..0000000 --- a/.config/nvim/lua/plugins/utils.lua +++ /dev/null @@ -1,4 +0,0 @@ -return { - { 'echasnovski/mini.colors', version = '*' }, - "MunifTanjim/nui.nvim", -} |
