diff options
Diffstat (limited to '.config/nvim')
| -rw-r--r-- | .config/nvim/.luarc.json | 3 | ||||
| -rw-r--r-- | .config/nvim/init.lua | 11 | ||||
| -rw-r--r-- | .config/nvim/lazy-lock.json | 45 | ||||
| -rw-r--r-- | .config/nvim/lua/binds.lua | 27 | ||||
| -rw-r--r-- | .config/nvim/lua/dash.lua | 17 | ||||
| -rw-r--r-- | .config/nvim/lua/icons.lua | 12 | ||||
| -rw-r--r-- | .config/nvim/lua/local_plugins/color_converter/lua/color_converter.lua | 14 | ||||
| -rw-r--r-- | .config/nvim/lua/local_plugins/color_converter/lua/ui.lua | 72 | ||||
| -rw-r--r-- | .config/nvim/lua/options.lua | 55 | ||||
| -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 |
15 files changed, 308 insertions, 1057 deletions
diff --git a/.config/nvim/.luarc.json b/.config/nvim/.luarc.json index e69de29..8da96c2 100644 --- a/.config/nvim/.luarc.json +++ b/.config/nvim/.luarc.json @@ -0,0 +1,3 @@ +{ + "workspace.library": ["usr/share/nvim/runtime"] +} diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 91bfca2..8fdca68 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -5,10 +5,15 @@ require "options" require "cmds" require "autocmd" require "binds" +require "diagnostics" require("lazy").setup { spec = "plugins", dev = { - path = vim.fn.stdpath "config" .. "/lua/local_plugins" - } + path = vim.fn.stdpath "config" .. "/lua/local_plugins", + }, + ui = { + border = "rounded", + backdrop = 100, + }, } -vim.cmd[[colo prismite]] +vim.cmd [[colo prismite]] diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 229bff2..9daf3a7 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,35 +1,30 @@ { - "LuaSnip": { "branch": "master", "commit": "fb525166ccc30296fb3457441eb979113de46b00" }, - "alpha-nvim": { "branch": "main", "commit": "a35468cd72645dbd52c0624ceead5f301c566dff" }, + "alpha-nvim": { "branch": "main", "commit": "2b3cbcdd980cae1e022409289245053f62fb50f6" }, "better-escape.nvim": { "branch": "master", "commit": "19a38aab94961016430905ebec30d272a01e9742" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" }, - "cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" }, - "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, - "git-blame.nvim": { "branch": "master", "commit": "8503b199edf9a666fe7b1a989cf14e3c26b2eb03" }, - "indentmini.nvim": { "branch": "main", "commit": "6211f93b0c8161d2a2b4000b9bf0c01c0a115455" }, - "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "leap.nvim": { "branch": "main", "commit": "10c14af4ddfb34dbd7721f0bfb2b4d91f0558907" }, - "lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" }, - "marks.nvim": { "branch": "master", "commit": "f353e8c08c50f39e99a9ed474172df7eddd89b72" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "f54e3c11fc9ebfcfc27e696182b0295b071d0811" }, - "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, + "blink.cmp": { "branch": "main", "commit": "a4ab037eefdb9949896ea8553f918bd6250d62bd" }, + "git-blame.nvim": { "branch": "master", "commit": "54da04264ec5313d602aebea7c5dc90141696ad7" }, + "hardtime.nvim": { "branch": "main", "commit": "6d7664d5bdfaea44c5f50b29f5239fab7b00c273" }, + "indentmini.nvim": { "branch": "main", "commit": "e0f1e381a3949ea6757365fa33f8f1722d3eae90" }, + "lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" }, + "leap.nvim": { "branch": "main", "commit": "aa204264ffaf83650ee676ef68f52e327688b048" }, + "lualine.nvim": { "branch": "master", "commit": "3946f0122255bc377d14a59b27b609fb3ab25768" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "2304ff65ecc8cb2afc2484de3e2ed9a407edf0b9" }, + "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, "mini.colors": { "branch": "main", "commit": "ef76867adda63d6010acdc8732a816c8527d276b" }, - "mini.comment": { "branch": "main", "commit": "51c173dffa17dc14c81169deaeea430bd394ab51" }, - "mini.surround": { "branch": "main", "commit": "1a2b59c77a0c4713a5bd8972da322f842f4821b1" }, - "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, + "noice.nvim": { "branch": "main", "commit": "38c702be0d8fea81527ee6a73e1e834e72481193" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, "nvim-cokeline": { "branch": "main", "commit": "9fbed130683b7b6f73198c09e35ba4b33f547c08" }, - "nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" }, - "nvim-lspconfig": { "branch": "master", "commit": "314b35335cc84bc2a085c84c69da955ba22da163" }, - "nvim-notify": { "branch": "master", "commit": "b5825cf9ee881dd8e43309c93374ed5b87b7a896" }, - "nvim-tree.lua": { "branch": "master", "commit": "0a06f65bf06157972f20ca1dee03c97a0efcb188" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "51cf7c995ed1eb6642aecf19067ee634fa1b6ba2" }, + "nvim-lspconfig": { "branch": "master", "commit": "ac98db2f9f06a56498ec890a96928774eae412c3" }, + "nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" }, + "nvim-tree.lua": { "branch": "master", "commit": "e397756d2a79d74314ea4cd3efc41300e91c0ff0" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, - "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, - "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, - "sessions.nvim": { "branch": "master", "commit": "f13158483e0b6255c6dfe473145ce4ee3495d844" }, + "nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "snacks.nvim": { "branch": "main", "commit": "b59ef39194d00584445ca9f32a90182b383d32de" }, + "statuscol.nvim": { "branch": "main", "commit": "c46172d0911aa5d49ba5f39f4351d1bb7aa289cc" }, "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, - "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, + "trouble.nvim": { "branch": "main", "commit": "c098362fe603d3922095e7db595961e020bdf2d0" }, "vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" } } diff --git a/.config/nvim/lua/binds.lua b/.config/nvim/lua/binds.lua index 55da905..4bcebb0 100644 --- a/.config/nvim/lua/binds.lua +++ b/.config/nvim/lua/binds.lua @@ -1,11 +1,7 @@ local map = vim.keymap.set -- local color_converter = require "color_converter" --- toggle nvim-tree -map("n", "<Leader>t", "<cmd>NvimTreeToggle<CR>") --- toggle trouble -map("n", "<Leader>e", "<cmd>TroubleToggle<CR>") --- undo +-- redo map("n", "U", "<C-r>") map("c", "<CR>", function() @@ -34,21 +30,6 @@ map("i", "<RIGHT>", "<NOP>") map("n", "<Leader>h", vim.lsp.buf.hover) map("n", "<Leader>gd", vim.lsp.buf.definition) -map("n", "<leader>bp", function() - require('cokeline.mappings').pick("focus") -end, { desc = "Pick a buffer to focus" }) -map("n", "<leader>bq", function() - require('cokeline.mappings').pick("close") -end, { desc = "Pick a buffer to close" }) -map("n", "<Leader>p", function () - require("cokeline.mappings").by_step("switch", -1) -end, { silent = true }) -map("n", "<Leader>n", function () - require("cokeline.mappings").by_step("switch", 1) -end, { silent = true }) - - --- local function setup_lsp_keys(_client, buffer) --- map("<Leader>d", vim.diagnostic.open_float, "Line diagnostics") --- --- end +map("n", "<C-l>", function() + vim.fn.setreg("/", "") +end) diff --git a/.config/nvim/lua/dash.lua b/.config/nvim/lua/dash.lua index fd9f03c..9079104 100644 --- a/.config/nvim/lua/dash.lua +++ b/.config/nvim/lua/dash.lua @@ -1,5 +1,5 @@ -local lazy = require "lazy" local alpha = require "alpha" +local lazy = require "lazy" vim.api.nvim_create_autocmd("ColorScheme", { callback = function() @@ -21,7 +21,6 @@ vim.api.nvim_create_autocmd("ColorScheme", { end, }) - return { layout = { { @@ -125,10 +124,12 @@ return { val = { { type = "text", - val = function() return lazy.stats().loaded .. " plugin" .. (lazy.stats().loaded == 1 and "" or "s") .. " loaded" end, + val = function() + return lazy.stats().loaded .. " plugin" .. (lazy.stats().loaded == 1 and "" or "s") .. " loaded" + end, opts = { position = "center", - } + }, }, { type = "text", @@ -137,10 +138,10 @@ return { position = "center", hl = { { "Comment", 0, 27 }, - { "DashEmphasis", 27, 35 } - } - } - } + { "DashEmphasis", 27, 35 }, + }, + }, + }, }, }, }, diff --git a/.config/nvim/lua/icons.lua b/.config/nvim/lua/icons.lua index e058e29..784b2ea 100644 --- a/.config/nvim/lua/icons.lua +++ b/.config/nvim/lua/icons.lua @@ -1,9 +1,13 @@ return { diagnostics = { - Error = " ", - Warn = " ", - Hint = " ", - Info = " ", + -- Error = " ", + -- Warn = " ", + -- Hint = " ", + -- Info = " ", + Error = "e", + Warn = "w", + Hint = "h", + Info = "i", }, kinds = { Array = " ", diff --git a/.config/nvim/lua/local_plugins/color_converter/lua/color_converter.lua b/.config/nvim/lua/local_plugins/color_converter/lua/color_converter.lua index ff8aa70..e2265f0 100644 --- a/.config/nvim/lua/local_plugins/color_converter/lua/color_converter.lua +++ b/.config/nvim/lua/local_plugins/color_converter/lua/color_converter.lua @@ -1,14 +1,10 @@ local menu = require "ui" return { - setup = function () - vim.api.nvim_create_user_command( - "ColorConverter", - function() - menu:mount() - end, - {} - ) + setup = function() + vim.api.nvim_create_user_command("ColorConverter", function() + menu:mount() + end, {}) end, - config = function(opt) end + config = function(opt) end, } diff --git a/.config/nvim/lua/local_plugins/color_converter/lua/ui.lua b/.config/nvim/lua/local_plugins/color_converter/lua/ui.lua index a2bf115..ddd9a85 100644 --- a/.config/nvim/lua/local_plugins/color_converter/lua/ui.lua +++ b/.config/nvim/lua/local_plugins/color_converter/lua/ui.lua @@ -1,47 +1,47 @@ +local Menu = require "nui.menu" local mcolors = require "mini.colors" -local Menu = require("nui.menu") local event = require("nui.utils.autocmd").event local popup_options = { - relative = "cursor", - position = { - row = 2, - col = 1, - }, - border = { - style = "rounded", - text = { - top = "[Choose Item]", - top_align = "center", + relative = "cursor", + position = { + row = 2, + col = 1, + }, + border = { + style = "rounded", + text = { + top = "[Choose Item]", + top_align = "center", + }, }, - }, } local menu = Menu(popup_options, { - lines = { - Menu.separator("Group One"), - Menu.item("Item 1"), - Menu.item("Item 2"), - Menu.separator("Group Two", { - char = "-", - text_align = "right", - }), - Menu.item("Item 3"), - Menu.item("Item 4"), - }, - -- max_width = 20, - keymap = { - focus_next = { "j", "<Down>", "<Tab>" }, - focus_prev = { "k", "<Up>", "<S-Tab>" }, - close = { "<Esc>", "<C-c>" }, - submit = { "<CR>", "<Space>" }, - }, - on_close = function() - print("CLOSED") - end, - on_submit = function(item) - print("SUBMITTED", vim.inspect(item)) - end, + lines = { + Menu.separator "Group One", + Menu.item "Item 1", + Menu.item "Item 2", + Menu.separator("Group Two", { + char = "-", + text_align = "right", + }), + Menu.item "Item 3", + Menu.item "Item 4", + }, + -- max_width = 20, + keymap = { + focus_next = { "j", "<Down>", "<Tab>" }, + focus_prev = { "k", "<Up>", "<S-Tab>" }, + close = { "<Esc>", "<C-c>" }, + submit = { "<CR>", "<Space>" }, + }, + on_close = function() + print "CLOSED" + end, + on_submit = function(item) + print("SUBMITTED", vim.inspect(item)) + end, }) return menu diff --git a/.config/nvim/lua/options.lua b/.config/nvim/lua/options.lua index 6153825..19e2b4c 100644 --- a/.config/nvim/lua/options.lua +++ b/.config/nvim/lua/options.lua @@ -1,28 +1,39 @@ -local o = vim.o local opt = vim.opt -o.smarttab = true -o.exrc = true -o.clipboard = "unnamedplus" -o.termguicolors = true -o.list = true -o.autochdir = true -o.wrap = false -o.number = true -o.relativenumber = true -o.expandtab = true -o.tabstop = 4 -o.smartindent = true -o.shiftwidth = 4 -o.sidescroll = 5 -o.timeout= false -o.scrolloff = 4 -o.sidescrolloff = 4 -o.sidescroll = 1 -o.cursorline = true -o.mouse = "" -o.fillchars = 'eob: ' +opt.smarttab = true +opt.exrc = true +opt.clipboard = "unnamedplus" +opt.termguicolors = true +opt.list = true +opt.autochdir = true +opt.wrap = false +opt.number = true +opt.relativenumber = true +opt.expandtab = true +opt.tabstop = 4 +opt.smartindent = true +opt.shiftwidth = 4 +opt.sidescroll = 5 +opt.timeout = false +opt.scrolloff = 4 +opt.sidescrolloff = 4 +opt.sidescroll = 1 +opt.cursorline = true +opt.mouse = "" +opt.ignorecase = true +opt.smartcase = true +opt.foldtext = "" +opt.foldlevel = 99 +opt.foldcolumn = "auto:1" vim.g.mapleader = " " vim.g.maplocalleader = vim.g.mapleader opt.listchars = { space = "⋅", tab = "--", precedes = "…", extends = "…" } +opt.fillchars = { + -- foldopen = "-", + -- foldclose = "+", + fold = " ", + foldsep = " ", + diff = "╱", + eob = " ", +} 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", -} |
