From 656898074e2686d6e365ac208fac77198450739e Mon Sep 17 00:00:00 2001 From: Kacper Marzecki Date: Sun, 2 Aug 2026 00:39:29 +0200 Subject: [PATCH] safety --- nvim/lazy-lock.json | 78 +++++++------- nvim/lua/config/keymaps.lua | 23 +++- nvim/lua/plugins/ai.lua | 189 +++++++++++++++++++++++++++++++++ nvim/lua/plugins/lsp.lua | 198 +++++++++++++++++++++++++++++++++-- nvim/lua/plugins/plugins.lua | 85 +++++++++------ 5 files changed, 491 insertions(+), 82 deletions(-) diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 071a118..a19dd2b 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,68 +1,72 @@ { - "LazyVim": { "branch": "main", "commit": "28db03f958d58dfff3c647ce28fdc1cb88ac158d" }, - "R.nvim": { "branch": "main", "commit": "daaf4fdb74b36c3b692b7d06acf5238acf8ff8be" }, + "99": { "branch": "master", "commit": "0172d3caae2d8b967c9d47aa7557295f1481e5df" }, + "LazyVim": { "branch": "main", "commit": "fca0af57cc3851b14f96a795a9c9bfafc5096dd1" }, + "R.nvim": { "branch": "main", "commit": "c37d1cfd46fe0c5ab7e5384154adf985c537cbcc" }, "blackjack.nvim": { "branch": "main", "commit": "cf59e79de25b87a3ef68b92b3277c50d4b345a92" }, "blink-copilot": { "branch": "main", "commit": "7ad8209b2f880a2840c94cdcd80ab4dc511d4f39" }, - "blink.cmp": { "branch": "main", "commit": "b19413d214068f316c78978b08264ed1c41830ec" }, + "blink.cmp": { "branch": "main", "commit": "451168851e8e2466bc97ee3e026c3dcb9141ce07" }, "bookmarks.nvim": { "branch": "main", "commit": "0540d52ba64d0ec7677ec1ef14b3624c95a2aaba" }, "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, - "catppuccin": { "branch": "main", "commit": "6efc53e42cfc97700f19043105bf73ba83c4ae7d" }, - "codecompanion.nvim": { "branch": "main", "commit": "b6fcc25ced5628d3d960e6e4bc287ce8fc9a1710" }, - "conform.nvim": { "branch": "master", "commit": "8314f4c9e205e7f30b62147069729f9a1227d8bf" }, - "copilot.lua": { "branch": "master", "commit": "e78d1ffebdf6ccb6fd8be4e6898030c1cf5f9b64" }, + "catppuccin": { "branch": "main", "commit": "a7788416689dbefea659d9e9415c87926b0ba5d8" }, + "claudecode.nvim": { "branch": "main", "commit": "432121f0f5b9bda041030d1e9e83b7ba3a93dd8f" }, + "codecompanion.nvim": { "branch": "main", "commit": "e010179d64538ce1fd88310d08b4697b356b17c8" }, + "conform.nvim": { "branch": "master", "commit": "086a40dc7ed8242c03be9f47fbcee68699cc2395" }, + "copilot.lua": { "branch": "master", "commit": "538f15c4eaad8661389a4a0d1ace2d6e079fac29" }, + "csvview.nvim": { "branch": "main", "commit": "5c22774c3ecc7f8883af5d143b366e45b1f0875d" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" }, - "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "fzf-lua": { "branch": "main", "commit": "a03d68e40eea835a1cdbd9f93049708dab3621e6" }, + "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, + "fzf-lua": { "branch": "main", "commit": "bde73a6886b607246095aa59f396de5e0d036890" }, "gp.nvim": { "branch": "main", "commit": "c37f154b97690c4925fef4e35ffdbf2c844b5f4e" }, - "grug-far.nvim": { "branch": "main", "commit": "794f03c97afc7f4b03fb6ec5111be507df1850cf" }, + "grug-far.nvim": { "branch": "main", "commit": "dc4684e163971bb1f5bfb93fbd4bb3e892bf9b15" }, "harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" }, "kanagawa.nvim": { "branch": "master", "commit": "aef7f5cec0a40dbe7f3304214850c472e2264b10" }, "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, - "lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" }, + "lazydev.nvim": { "branch": "main", "commit": "ff2cbcba459b637ec3fd165a2be59b7bbaeedf0d" }, "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, "luarocks.nvim": { "branch": "main", "commit": "1db9093915eb16ba2473cfb8d343ace5ee04130a" }, - "markview.nvim": { "branch": "main", "commit": "18fc148c83925919d94f3fc8e5c74f2d108b9b44" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "4cfe411526a7a99c18281135e8b4765ae6330d15" }, - "mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" }, - "mini.ai": { "branch": "main", "commit": "bfb26d9072670c3aaefab0f53024b2f3729c8083" }, - "mini.comment": { "branch": "main", "commit": "a0c721115faff8d05505c0a12dab410084d9e536" }, - "mini.diff": { "branch": "main", "commit": "6010e588e9ed14724880f244d7fa3df8f0be3f46" }, + "markview.nvim": { "branch": "main", "commit": "1861f959599ae03cfd59f56222a542035b0cd947" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "38499e0bda64bc0f3ec6e7f03f8e13dd11c0fa00" }, + "mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" }, + "mini.ai": { "branch": "main", "commit": "4b0a6207341d895b6cfe9bcb1e4d3e8607bfe4f4" }, + "mini.comment": { "branch": "main", "commit": "597d32ed2c9fbfbf9a250bec7c6b9035f71214f5" }, + "mini.diff": { "branch": "main", "commit": "ff3cd5e76e812fa18bde0f8126d6f3bb62008c79" }, "mini.hues": { "branch": "main", "commit": "8fb10472cc40a1aad428a82a90270c0e87981fe7" }, - "mini.icons": { "branch": "main", "commit": "efc85e42262cd0c9e1fdbf806c25cb0be6de115c" }, - "mini.indentscope": { "branch": "main", "commit": "0308f949f31769e509696af5d5f91cebb2159c69" }, + "mini.icons": { "branch": "main", "commit": "5b9076dae1bfbe47ba4a14bc8b967cde0ab5d77e" }, + "mini.indentscope": { "branch": "main", "commit": "065c7713fb4cd0124fe1462f15f27feeb8b04406" }, "mini.keymap": { "branch": "main", "commit": "9a1ee970f05b113b3ce9ee6f330fe862706b7e49" }, - "mini.move": { "branch": "main", "commit": "4d214202d71e0a4066b6288176bbe88f268f9777" }, - "mini.pairs": { "branch": "main", "commit": "d5a29b6254dad07757832db505ea5aeab9aad43a" }, - "mini.surround": { "branch": "main", "commit": "cc7b9d0a056b5fa6915ffac1cb91f29bf7c96f69" }, - "neo-tree.nvim": { "branch": "main", "commit": "38c8e49bf6731a27eb612834ec88c606532b7fea" }, + "mini.move": { "branch": "main", "commit": "b8ba0b77e91b5f0fe8e014e03f7f59799dec1d96" }, + "mini.pairs": { "branch": "main", "commit": "b7fde3719340946feb75017ef9d75edebdeb0566" }, + "mini.surround": { "branch": "main", "commit": "d205d1741d1fcc1f3117b4e839bf00f74ad72fa2" }, + "neo-tree.nvim": { "branch": "main", "commit": "427056e28925bfca383d0c8f6a87e37e7fb8842d" }, "nightfox.nvim": { "branch": "main", "commit": "ba47d4b4c5ec308718641ba7402c143836f35aa9" }, "noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, - "nvim-lint": { "branch": "master", "commit": "1e6b2ac034d1a7588d11b0b8e862a7ad89368376" }, - "nvim-lspconfig": { "branch": "master", "commit": "0b38bc74487e73489624d61396af7805af9cc75f" }, + "nvim-lint": { "branch": "master", "commit": "4b03656c09c1561f89b6aa0665c15d292ba9499d" }, + "nvim-lspconfig": { "branch": "master", "commit": "1a6d69206749a646ef28bfb39460610b14baff40" }, "nvim-navic": { "branch": "master", "commit": "f5eba192f39b453675d115351808bd51276d9de5" }, "nvim-parinfer": { "branch": "master", "commit": "3968e669d9f02589aa311d33cb475b16b27c5fbb" }, - "nvim-spider": { "branch": "main", "commit": "a31ce0c5e2f748909e0d7397ff20e052c98ca91b" }, - "nvim-treesitter": { "branch": "main", "commit": "99dfc5acefd7728cec4ad0d0a6a9720f2c2896ff" }, - "nvim-treesitter-context": { "branch": "master", "commit": "64dd4cf3f6fd0ab17622c5ce15c91fc539c3f24a" }, - "nvim-treesitter-textobjects": { "branch": "main", "commit": "28a3494c075ef0f353314f627546537e43c09592" }, - "nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" }, + "nvim-spider": { "branch": "main", "commit": "4bca4dbc53f01b37385146b37ab5ce55bdc083fc" }, + "nvim-treesitter": { "branch": "main", "commit": "6620ae1c44dfa8623b22d0cbf873a9e8d073b849" }, + "nvim-treesitter-context": { "branch": "master", "commit": "adf4b6b0420b7be6c717ef0ac7993183d6c201b1" }, + "nvim-treesitter-textobjects": { "branch": "main", "commit": "93d60a475f0b08a8eceb99255863977d3a25f310" }, + "nvim-ts-autotag": { "branch": "main", "commit": "8e1c0a389f20bf7f5b0dd0e00306c1247bda2595" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, - "outline.nvim": { "branch": "main", "commit": "1967ef50036b0b1eac4977aeede55915a741afe0" }, - "overseer.nvim": { "branch": "master", "commit": "3cde0d84bdae56cd119cbf835f764fa30cec384c" }, - "oxocarbon.nvim": { "branch": "main", "commit": "9f85f6090322f39b11ae04a343d4eb9d12a86897" }, + "opencode.nvim": { "branch": "main", "commit": "eb1be3208251a61d4a61fdd5870301003012ce50" }, + "outline.nvim": { "branch": "main", "commit": "ead1820d49c8e79ce89cab1c2c318981b695c9d2" }, + "overseer.nvim": { "branch": "master", "commit": "a2194447f4c5a1baf95139c5c7b539fa7b0d012f" }, + "oxocarbon.nvim": { "branch": "main", "commit": "a7ba74849a00546a311f8c146320b433900393e7" }, "persistence.nvim": { "branch": "main", "commit": "b20b2a7887bd39c1a356980b45e03250f3dce49c" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, - "snacks.nvim": { "branch": "main", "commit": "fe7cfe9800a182274d0f868a74b7263b8c0c020b" }, - "telescope.nvim": { "branch": "master", "commit": "3333a52ff548ba0a68af6d8da1e54f9cd96e9179" }, + "snacks.nvim": { "branch": "main", "commit": "ad9ede6a9cddf16cedbd31b8932d6dcdee9b716e" }, + "telescope.nvim": { "branch": "master", "commit": "5255aa27c422de944791318024167ad5d40aad20" }, "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, "toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, - "tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" }, + "tokyonight.nvim": { "branch": "main", "commit": "cdc07ac78467a233fd62c493de29a17e0cf2b2b6" }, "trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" }, "ts-comments.nvim": { "branch": "main", "commit": "123a9fb12e7229342f807ec9e6de478b1102b041" }, "vscode.nvim": { "branch": "main", "commit": "aa1102a7e15195c9cca22730b09224a7f7745ba8" }, "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }, - "yanky.nvim": { "branch": "main", "commit": "04fc42b94305d94948c9c197f679336668af3292" }, + "yanky.nvim": { "branch": "main", "commit": "784188e0a7363e762e53140f39124d786aec0832" }, "zen-mode.nvim": { "branch": "main", "commit": "8564ce6d29ec7554eb9df578efa882d33b3c23a7" } } diff --git a/nvim/lua/config/keymaps.lua b/nvim/lua/config/keymaps.lua index ad3247e..876cb7f 100644 --- a/nvim/lua/config/keymaps.lua +++ b/nvim/lua/config/keymaps.lua @@ -68,9 +68,9 @@ local function command(cmd) end require("which-key").add({ - { "gvf", diffOpenFileHistory, desc = "Open DiffView on Files" }, + { "gvf", diffOpenFileHistory, desc = "Open DiffView on Files" }, { "gvt", command("DiffviewToggleFiles"), desc = "toggle diffviewfiles" }, - { "gvc", command("DiffviewClose"), desc = "Open DiffView on Files" }, + { "gvc", command("DiffviewClose"), desc = "Open DiffView on Files" }, { "gvh", function() @@ -157,9 +157,9 @@ function open_notes() vim.fn.bufload(buf) -- Configure floating window size and position - local width = math.floor(vim.o.columns * 0.8) -- 80% of the screen width - local height = math.floor(vim.o.lines * 0.8) -- 80% of the screen height - local row = math.floor((vim.o.lines - height) / 2) -- Center the window vertically + local width = math.floor(vim.o.columns * 0.8) -- 80% of the screen width + local height = math.floor(vim.o.lines * 0.8) -- 80% of the screen height + local row = math.floor((vim.o.lines - height) / 2) -- Center the window vertically local col = math.floor((vim.o.columns - width) / 2) -- Center the window horizontally -- Create the window @@ -226,6 +226,7 @@ function choose_timer() }, }) end + vim.api.nvim_set_keymap("n", "T", "lua choose_timer()", { noremap = true, silent = true }) -- Remap arrow keys to hjkl in Normal and Visual modes @@ -242,3 +243,15 @@ vim.keymap.set({ "n", "v" }, "", "l", { noremap = true, silent = true } -- ctrl-n p to navigate lsp suggestions, next and previous vim.keymap.set("i", "", "lua cmp.mapping.select_next_item()", { noremap = true, silent = true }) vim.keymap.set("i", "", "lua cmp.mapping.select_previous_item()", { noremap = true, silent = true }) + +-- map leader u v c to CsvViewEnable display_mode=border with description `CSV View (commas)` +vim.keymap.set("n", "uvc", "CsvViewEnable display_mode=border", { desc = "CSV View (commas)" }) +-- map leader u v t to CsvViewEnable delimiter=\t display_mode=border with description `CSV View (tabs)` +vim.keymap.set( + "n", + "uvt", + "CsvViewEnable delimiter=\\t display_mode=border", + { desc = "CSV View (tabs)" } +) +-- map leader u v d to CsvViewDisable with description `CSV View Disable` +vim.keymap.set("n", "uvd", "CsvViewDisable", { desc = "CSV View Disable" }) diff --git a/nvim/lua/plugins/ai.lua b/nvim/lua/plugins/ai.lua index 6cc2dd5..d399132 100644 --- a/nvim/lua/plugins/ai.lua +++ b/nvim/lua/plugins/ai.lua @@ -38,4 +38,193 @@ return { } end, }, + { + "coder/claudecode.nvim", + dependencies = { "folke/snacks.nvim" }, + config = true, + keys = { + { "a", nil, desc = "AI/Claude Code" }, + { "ac", "ClaudeCode", desc = "Toggle Claude" }, + { "af", "ClaudeCodeFocus", desc = "Focus Claude" }, + { "ar", "ClaudeCode --resume", desc = "Resume Claude" }, + { "aC", "ClaudeCode --continue", desc = "Continue Claude" }, + { "am", "ClaudeCodeSelectModel", desc = "Select Claude model" }, + { "ab", "ClaudeCodeAdd %", desc = "Add current buffer" }, + { "as", "ClaudeCodeSend", mode = "v", desc = "Send to Claude" }, + { + "as", + "ClaudeCodeTreeAdd", + desc = "Add file", + ft = { "NvimTree", "neo-tree", "oil", "minifiles", "netrw" }, + }, + -- Diff management + { "aa", "ClaudeCodeDiffAccept", desc = "Accept diff" }, + { "ad", "ClaudeCodeDiffDeny", desc = "Deny diff" }, + }, + }, + { + "ThePrimeagen/99", + config = function() + local _99 = require("99") + + -- For logging that is to a file if you wish to trace through requests + -- for reporting bugs, i would not rely on this, but instead the provided + -- logging mechanisms within 99. This is for more debugging purposes + local cwd = vim.uv.cwd() + local basename = vim.fs.basename(cwd) + _99.setup({ + provider = _99.Providers.ClaudeCodeProvider, -- default: OpenCodeProvider + logger = { + level = _99.DEBUG, + path = "/tmp/" .. basename .. ".99.debug", + print_on_error = true, + }, + -- When setting this to something that is not inside the CWD tools + -- such as claude code or opencode will have permission issues + -- and generation will fail refer to tool documentation to resolve + -- https://opencode.ai/docs/permissions/#external-directories + -- https://code.claude.com/docs/en/permissions#read-and-edit + tmp_dir = "./tmp", + + --- Completions: #rules and @files in the prompt buffer + completion = { + -- I am going to disable these until i understand the + -- problem better. Inside of cursor rules there is also + -- application rules, which means i need to apply these + -- differently + -- cursor_rules = "" + + --- A list of folders where you have your own SKILL.md + --- Expected format: + --- /path/to/dir//SKILL.md + --- + --- Example: + --- Input Path: + --- "scratch/custom_rules/" + --- + --- Output Rules: + --- {path = "scratch/custom_rules/vim/SKILL.md", name = "vim"}, + --- ... the other rules in that dir ... + --- + custom_rules = { + -- "scratch/custom_rules/", + }, + + --- Configure @file completion (all fields optional, sensible defaults) + files = { + -- enabled = true, + -- max_file_size = 102400, -- bytes, skip files larger than this + -- max_files = 5000, -- cap on total discovered files + -- exclude = { ".env", ".env.*", "node_modules", ".git", ... }, + }, + --- File Discovery: + --- - In git repos: Uses `git ls-files` which automatically respects .gitignore + --- - Non-git repos: Falls back to filesystem scanning with manual excludes + --- - Both methods apply the configured `exclude` list on top of gitignore + + --- What autocomplete engine to use. Defaults to native (built-in) if not specified. + source = "native", -- "native" (default), "cmp", or "blink" + }, + + --- WARNING: if you change cwd then this is likely broken + --- ill likely fix this in a later change + --- + --- md_files is a list of files to look for and auto add based on the location + --- of the originating request. That means if you are at /foo/bar/baz.lua + --- the system will automagically look for: + --- /foo/bar/AGENT.md + --- /foo/AGENT.md + --- assuming that /foo is project root (based on cwd) + md_files = { + "AGENT.md", + }, + }) + + -- take extra note that i have visual selection only in v mode + -- technically whatever your last visual selection is, will be used + -- so i have this set to visual mode so i dont screw up and use an + -- old visual selection + -- + -- likely ill add a mode check and assert on required visual mode + -- so just prepare for it now + vim.keymap.set("v", "9v", function() + _99.visual() + end) + + --- if you have a request you dont want to make any changes, just cancel it + vim.keymap.set("n", "9x", function() + _99.stop_all_requests() + end) + + vim.keymap.set("n", "9s", function() + _99.search() + end) + end, + }, + { + "nickjvandyke/opencode.nvim", + version = "*", -- Latest stable release + dependencies = { + { + -- `snacks.nvim` integration is recommended, but optional + ---@module "snacks" <- Loads `snacks.nvim` types for configuration intellisense + "folke/snacks.nvim", + optional = true, + opts = { + input = {}, -- Enhances `ask()` + picker = { -- Enhances `select()` + actions = { + opencode_send = function(...) + return require("opencode").snacks_picker_send(...) + end, + }, + win = { + input = { + keys = { + [""] = { "opencode_send", mode = { "n", "i" } }, + }, + }, + }, + }, + }, + }, + }, + config = function() + ---@type opencode.Opts + vim.g.opencode_opts = { + -- Your configuration, if any; goto definition on the type or field for details + } + + vim.o.autoread = true -- Required for `opts.events.reload` + + -- Recommended/example keymaps + vim.keymap.set({ "n", "x" }, "", function() + require("opencode").ask("@this: ", { submit = true }) + end, { desc = "Ask opencode…" }) + vim.keymap.set({ "n", "x" }, "", function() + require("opencode").select() + end, { desc = "Execute opencode action…" }) + vim.keymap.set({ "n", "t" }, "", function() + require("opencode").toggle() + end, { desc = "Toggle opencode" }) + + vim.keymap.set({ "n", "x" }, "go", function() + return require("opencode").operator("@this ") + end, { desc = "Add range to opencode", expr = true }) + vim.keymap.set("n", "goo", function() + return require("opencode").operator("@this ") .. "_" + end, { desc = "Add line to opencode", expr = true }) + + vim.keymap.set("n", "", function() + require("opencode").command("session.half.page.up") + end, { desc = "Scroll opencode up" }) + vim.keymap.set("n", "", function() + require("opencode").command("session.half.page.down") + end, { desc = "Scroll opencode down" }) + + -- You may want these if you use the opinionated `` and `` keymaps above — otherwise consider `o…` (and remove terminal mode from the `toggle` keymap) + vim.keymap.set("n", "+", "", { desc = "Increment under cursor", noremap = true }) + vim.keymap.set("n", "-", "", { desc = "Decrement under cursor", noremap = true }) + end, + }, } diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua index 5668c17..3c681fa 100644 --- a/nvim/lua/plugins/lsp.lua +++ b/nvim/lua/plugins/lsp.lua @@ -23,18 +23,69 @@ vim.lsp.config["uiua"] = { filetypes = { "uiua", "*.ua" }, } vim.lsp.enable("uiua") +vim.lsp.config("dexter", { + cmd = { "dexter", "lsp" }, + root_markers = { ".dexter/dexter.db", ".dexter.db", ".git", "mix.exs" }, + filetypes = { "elixir", "eelixir", "heex" }, + init_options = { + followDelegates = true, -- jump through defdelegate to the target function + -- stdlibPath = "", -- override Elixir stdlib path (auto-detected) + -- debug = false, -- verbose logging to stderr (view with :LspLog) + }, +}) +vim.lsp.enable("dexter") -- CUSTOM LSP's --- vim.api.nvim_create_autocmd("FileType", { --- pattern = { "elixir", "typescript", "json" }, --- callback = function() --- vim.lsp.start({ --- name = "hhn_lsp", --- cmd = { vim.env.HOME .. "/git/hhn_lsp/bin/hhn_lsp" }, --- root_dir = vim.fs.dirname(vim.fs.find({ ".git" }, { upward = true })[1]), --- }) --- end, --- }) +vim.api.nvim_create_autocmd("FileType", { + pattern = { "elixir", "typescript", "json" }, + callback = function() + vim.lsp.start({ + name = "hhn_lsp", + cmd = { vim.env.HOME .. "/git/hhn_lsp/bin/hhn_lsp" }, + root_dir = vim.fs.dirname(vim.fs.find({ ".git" }, { upward = true })[1]), + }) + end, +}) + +--------------------- auto-exec config +local function project_root() + local git_dir = vim.fs.find(".git", { + upward = true, + path = vim.fn.getcwd(), + })[1] + + return git_dir and vim.fs.dirname(git_dir) or vim.fn.getcwd() +end + +local root = project_root() +local pair_ls_config = root .. "/.pair_ls.nvim.lua" + +if vim.uv.fs_stat(pair_ls_config) then + dofile(pair_ls_config) +end + +--------------------- +vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("my.lsp", {}), + + callback = function(args) + local opts = { remap = false } + local client = assert(vim.lsp.get_client_by_id(args.data.client_id)) + local builtin = require("telescope.builtin") + + -- along with your other config + + if client:supports_method("textDocument/formatting") then + -- the most important part + vim.api.nvim_create_autocmd("BufWritePre", { + buffer = args.buf, + callback = function() + vim.lsp.buf.format({ bufnr = args.buf, id = client.id, timeout_ms = 5000 }) + end, + }) + end + end, +}) if kx_custom and vim.loop.os_uname().sysname == "Linux" then vim.lsp.config["alsp"] = { cmd = { "alsp" }, @@ -55,4 +106,131 @@ if kx_custom and vim.loop.os_uname().sysname == "Linux" then end, }) end + +vim.api.nvim_create_autocmd("FileType", { + pattern = "elixir", + callback = function(args) + vim.lsp.start({ + name = "exofx-lsp", + cmd_env = { MIX_ENV = "test" }, + cmd = { "mix", "exofx.lsp" }, + root_dir = vim.fs.root(args.buf, { "mix.exs", ".git" }), + -- capabilities = vim.lsp.protocol.make_client_capabilities(), + }) + end, +}) +local function hover_all_clients() + local bufnr = vim.api.nvim_get_current_buf() + local clients = vim.lsp.get_clients({ + bufnr = bufnr, + method = "textDocument/hover", + }) + + if #clients == 0 then + return + end + + local params = vim.lsp.util.make_position_params(0, clients[1].offset_encoding or "utf-16") + + vim.lsp.buf_request_all(bufnr, "textDocument/hover", params, function(results) + local lines = {} + + for client_id, response in pairs(results) do + local result = response.result + local client = vim.lsp.get_client_by_id(client_id) + + if result and result.contents and client then + local hover_lines = vim.lsp.util.convert_input_to_markdown_lines(result.contents) + hover_lines = vim.lsp.util.trim_empty_lines(hover_lines) + + if #hover_lines > 0 then + if #lines > 0 then + table.insert(lines, "") + table.insert(lines, "---") + table.insert(lines, "") + end + + table.insert(lines, "**" .. client.name .. "**") + table.insert(lines, "") + vim.list_extend(lines, hover_lines) + end + end + end + + if #lines == 0 then + return + end + + vim.lsp.util.open_floating_preview(lines, "markdown", { + border = "rounded", + focus_id = "hover-all-clients", + }) + end) +end + +vim.api.nvim_create_autocmd({ "LspAttach", "BufEnter" }, { + callback = function(args) + vim.schedule(function() + vim.keymap.set("n", "K", hover_all_clients, { + buffer = args.buf, + desc = "Hover all LSP clients", + }) + end) + end, +}) +vim.keymap.set("i", "", function() + local cmp = require("blink.cmp") + cmp.reload() + cmp.show() + print("asd") +end, { desc = "Force LSP completion" }) +-- vim.api.nvim_create_autocmd("FileType", { +-- pattern = "elixir", +-- callback = function(args) +-- local root = vim.fs.root(args.buf, { "mix.exs", ".git" }) +-- if not root then +-- return +-- end +-- +-- vim.lsp.start({ +-- name = "exoflua-lsp", +-- cmd = { +-- "env", +-- "EXOFLUA_LUA_LANGUAGE_SERVER=/opt/homebrew/bin/lua-language-server", +-- "mix", +-- "exoflua.lsp", +-- "--profile", +-- "nvim", +-- }, +-- cmd_cwd = root, +-- root_dir = root, +-- capabilities = vim.lsp.protocol.make_client_capabilities(), +-- }) +-- end, +-- }) +-- +-- vim.api.nvim_create_autocmd("FileType", { +-- pattern = "elixir", +-- callback = function(args) +-- local root = vim.fs.root(args.buf, { "mix.exs", ".git" }) +-- if not root then +-- return +-- end +-- +-- local cmd = root .. "/bin/exofc-lsp" +-- if vim.fn.executable(cmd) ~= 1 then +-- return +-- end +-- +-- vim.lsp.start({ +-- name = "exofc-lsp", +-- cmd = { cmd }, +-- cmd_cwd = root, +-- root_dir = root, +-- capabilities = vim.lsp.protocol.make_client_capabilities(), +-- }, { +-- bufnr = args.buf, +-- }) +-- end, +-- }) return {} diff --git a/nvim/lua/plugins/plugins.lua b/nvim/lua/plugins/plugins.lua index f6c69e1..aabf01d 100644 --- a/nvim/lua/plugins/plugins.lua +++ b/nvim/lua/plugins/plugins.lua @@ -4,22 +4,22 @@ return { lazy = false, opts = { ensure_installed = { - "bash", - "html", - "javascript", - "json", - "lua", - "markdown", - "markdown_inline", - "python", - "query", - "regex", - "tsx", - "typescript", - "vim", - "yaml", - "heex", - "elixir", + -- "bash", + -- "html", + -- "javascript", + -- "json", + -- "lua", + -- "markdown", + -- "markdown_inline", + -- "python", + -- "query", + -- "regex", + -- "tsx", + -- "typescript", + -- "vim", + -- "yaml", + -- "heex", + -- "elixir", }, highlight = { enable = true }, indent = { enable = true }, @@ -43,7 +43,7 @@ return { opts = { servers = { -- disable to prevent elixir extra to install it automatically - -- elixirls = false, + elixirls = false, }, }, }, @@ -107,7 +107,7 @@ return { -- * a percentage of the width / height of the editor when <= 1 -- * a function that returns the width or the height width = 120, -- width of the Zen window - height = 1, -- height of the Zen window + height = 1, -- height of the Zen window -- by default, no options are changed for the Zen window -- uncomment any of the options below, or add other vim.wo options you want to apply options = { @@ -125,16 +125,16 @@ return { -- comment the lines to not apply the options options = { enabled = true, - ruler = false, -- disables the ruler text in the cmd line area + ruler = false, -- disables the ruler text in the cmd line area showcmd = false, -- disables the command in the last line of the screen -- you may turn on/off statusline in zen mode by setting 'laststatus' -- statusline will be shown only if 'laststatus' == 3 - laststatus = 0, -- turn off the statusline in zen mode + laststatus = 0, -- turn off the statusline in zen mode }, - twilight = { enabled = true }, -- enable to start Twilight when zen mode opens + twilight = { enabled = true }, -- enable to start Twilight when zen mode opens gitsigns = { enabled = false }, -- disables git signs - tmux = { enabled = false }, -- disables the tmux statusline - todo = { enabled = false }, -- if set to "true", todo-comments.nvim highlights will be disabled + tmux = { enabled = false }, -- disables the tmux statusline + todo = { enabled = false }, -- if set to "true", todo-comments.nvim highlights will be disabled -- this will change the font size on kitty when in zen mode -- to make this work, you need to set the following kitty options: -- - allow_remote_control socket-only @@ -194,12 +194,15 @@ return { { "gpanders/nvim-parinfer", }, - { "EdenEast/nightfox.nvim", opts = { - colorblind = { - enable = true, - }, - } }, - { "catppuccin/nvim", name = "catppuccin" }, + { + "EdenEast/nightfox.nvim", + opts = { + colorblind = { + enable = true, + }, + } + }, + { "catppuccin/nvim", name = "catppuccin" }, { "folke/tokyonight.nvim", opts = { @@ -254,7 +257,7 @@ return { }, }, }, - { "akinsho/toggleterm.nvim", version = "*", config = true }, + { "akinsho/toggleterm.nvim", version = "*", config = true }, { "ThePrimeagen/harpoon", branch = "harpoon2", @@ -332,4 +335,26 @@ return { -- Only required if you also set defaults.lazy = true lazy = false, }, + { + "hat0uma/csvview.nvim", + ---@module "csvview" + ---@type CsvView.Options + opts = { + parser = { comments = { "#", "//" } }, + keymaps = { + -- Text objects for selecting fields + textobject_field_inner = { "if", mode = { "o", "x" } }, + textobject_field_outer = { "af", mode = { "o", "x" } }, + -- Excel-like navigation: + -- Use and to move horizontally between fields. + -- Use and to move vertically between rows and place the cursor at the end of the field. + -- Note: In terminals, you may need to enable CSI-u mode to use and . + jump_next_field_end = { "", mode = { "n", "v" } }, + jump_prev_field_end = { "", mode = { "n", "v" } }, + jump_next_row = { "", mode = { "n", "v" } }, + jump_prev_row = { "", mode = { "n", "v" } }, + }, + }, + cmd = { "CsvViewEnable", "CsvViewDisable", "CsvViewToggle" }, + }, }