Compare commits
No commits in common. "w" and "main" have entirely different histories.
@ -1,72 +1,67 @@
|
||||
{
|
||||
"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": "451168851e8e2466bc97ee3e026c3dcb9141ce07" },
|
||||
"LazyVim": { "branch": "main", "commit": "42840b2ffbfa9dd3c15e0ce7d1bec36d772a3ead" },
|
||||
"blink-cmp-copilot": { "branch": "main", "commit": "439cff78780c033aa23cf061d7315314b347e3c1" },
|
||||
"blink-copilot": { "branch": "main", "commit": "5d35fd07fcc148be20442da1bdd2407e03263d7d" },
|
||||
"blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" },
|
||||
"bookmarks.nvim": { "branch": "main", "commit": "0540d52ba64d0ec7677ec1ef14b3624c95a2aaba" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
|
||||
"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" },
|
||||
"catppuccin": { "branch": "main", "commit": "af58927c55c9f3272c940ff02b3cee94a1249f26" },
|
||||
"codecompanion.nvim": { "branch": "main", "commit": "946e18627271e008635d53f96a56af459ebb40da" },
|
||||
"conform.nvim": { "branch": "master", "commit": "fbcb4fa7f34bfea9be702ffff481a8e336ebf6ed" },
|
||||
"copilot.lua": { "branch": "master", "commit": "30b98a4c25d6152c14084020f703b6d56e1f1122" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
||||
"flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
|
||||
"fzf-lua": { "branch": "main", "commit": "bde73a6886b607246095aa59f396de5e0d036890" },
|
||||
"flash.nvim": { "branch": "main", "commit": "2febce67ff9cf7638d2569d17c41af02c38401eb" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"fzf-lua": { "branch": "main", "commit": "d45ce947b9e2b30dc564e9ea11a2e30f7a7b686d" },
|
||||
"gp.nvim": { "branch": "main", "commit": "c37f154b97690c4925fef4e35ffdbf2c844b5f4e" },
|
||||
"grug-far.nvim": { "branch": "main", "commit": "dc4684e163971bb1f5bfb93fbd4bb3e892bf9b15" },
|
||||
"harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" },
|
||||
"grug-far.nvim": { "branch": "main", "commit": "3e72397465f774b01aa38e4fe8e6eecf23d766d9" },
|
||||
"harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" },
|
||||
"kanagawa.nvim": { "branch": "master", "commit": "aef7f5cec0a40dbe7f3304214850c472e2264b10" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "ff2cbcba459b637ec3fd165a2be59b7bbaeedf0d" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "e28ce52fc7ff79fcb76f0e79ee6fb6182fca90b9" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "3946f0122255bc377d14a59b27b609fb3ab25768" },
|
||||
"luarocks.nvim": { "branch": "main", "commit": "1db9093915eb16ba2473cfb8d343ace5ee04130a" },
|
||||
"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": "5b9076dae1bfbe47ba4a14bc8b967cde0ab5d77e" },
|
||||
"mini.indentscope": { "branch": "main", "commit": "065c7713fb4cd0124fe1462f15f27feeb8b04406" },
|
||||
"mini.keymap": { "branch": "main", "commit": "9a1ee970f05b113b3ce9ee6f330fe862706b7e49" },
|
||||
"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" },
|
||||
"markview.nvim": { "branch": "main", "commit": "c93ea99d96b4bfda5b7c7d0dfca9c26edf6e78f0" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "2304ff65ecc8cb2afc2484de3e2ed9a407edf0b9" },
|
||||
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
|
||||
"mini.ai": { "branch": "main", "commit": "11c57180bc9084089206e211ac7aa598bedc9673" },
|
||||
"mini.comment": { "branch": "main", "commit": "c40bc46e72f41d3db265f6d86deb3dc259c0985d" },
|
||||
"mini.diff": { "branch": "main", "commit": "a2df2a9a485328c20252b7cadb11feb717020e45" },
|
||||
"mini.hues": { "branch": "main", "commit": "f1fa8ad34788eada276f0b8a41d96a15622933de" },
|
||||
"mini.icons": { "branch": "main", "commit": "284798619aed9f4c1ac1b9417b9a5e3b4b85ef3a" },
|
||||
"mini.indentscope": { "branch": "main", "commit": "e9fa0714fc753e1e737940577904e553ee340903" },
|
||||
"mini.keymap": { "branch": "main", "commit": "2aa0a66d6cbf15c9cea331d976ac4d4b9f01621e" },
|
||||
"mini.move": { "branch": "main", "commit": "f33406ae7d95b931c6a0d3ba11e50983fe800afb" },
|
||||
"mini.pairs": { "branch": "main", "commit": "b9aada8c0e59f2b938e98fbf4eae0799eba96ad9" },
|
||||
"mini.surround": { "branch": "main", "commit": "444e155147e2b5159dd28a65f9736254c16cb817" },
|
||||
"neo-tree.nvim": { "branch": "main", "commit": "20244beec28b9d79ffb75fe1b1606f4dd8d476fc" },
|
||||
"nightfox.nvim": { "branch": "main", "commit": "ba47d4b4c5ec308718641ba7402c143836f35aa9" },
|
||||
"noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" },
|
||||
"noice.nvim": { "branch": "main", "commit": "db248375c12c5322fbb9b505c1dc6f08e4527684" },
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-lint": { "branch": "master", "commit": "4b03656c09c1561f89b6aa0665c15d292ba9499d" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "1a6d69206749a646ef28bfb39460610b14baff40" },
|
||||
"nvim-navic": { "branch": "master", "commit": "f5eba192f39b453675d115351808bd51276d9de5" },
|
||||
"nvim-lint": { "branch": "master", "commit": "9da1fb942dd0668d5182f9c8dee801b9c190e2bb" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "ac98db2f9f06a56498ec890a96928774eae412c3" },
|
||||
"nvim-navic": { "branch": "master", "commit": "099b4c8cdc3e9ea026ea6b2a0d315e2d28362242" },
|
||||
"nvim-parinfer": { "branch": "master", "commit": "3968e669d9f02589aa311d33cb475b16b27c5fbb" },
|
||||
"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-spider": { "branch": "main", "commit": "a7705d7233ac3c47f7a1e80172bbeaa11f1c722f" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "71bf1665f804d46f7e4b24ad7ffc11f6ea5b271a" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "41847d3dafb5004464708a3db06b14f12bde548a" },
|
||||
"nvim-treesitter-textobjects": { "branch": "main", "commit": "1b2d85d3de6114c4bcea89ffb2cd1ce9e3a19931" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" },
|
||||
"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" },
|
||||
"outline.nvim": { "branch": "main", "commit": "6b62f73a6bf317531d15a7ae1b724e85485d8148" },
|
||||
"overseer.nvim": { "branch": "master", "commit": "9334595f850a301ef8bd1d19fc46dca688f677b3" },
|
||||
"oxocarbon.nvim": { "branch": "main", "commit": "9f85f6090322f39b11ae04a343d4eb9d12a86897" },
|
||||
"persistence.nvim": { "branch": "main", "commit": "51eef57272742b773468949f6bd0503ec3f83874" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"snacks.nvim": { "branch": "main", "commit": "ad9ede6a9cddf16cedbd31b8932d6dcdee9b716e" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "5255aa27c422de944791318024167ad5d40aad20" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
|
||||
"snacks.nvim": { "branch": "main", "commit": "d6e34b158d892cd774b36503cbd3a9e62c7951e3" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "19d461ddd543e938eb22505fb03fa878800270b6" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" },
|
||||
"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": "784188e0a7363e762e53140f39124d786aec0832" },
|
||||
"zen-mode.nvim": { "branch": "main", "commit": "8564ce6d29ec7554eb9df578efa882d33b3c23a7" }
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "e63c42a42b11cd6225f009dd949b9ee0fccc15ef" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "c098362fe603d3922095e7db595961e020bdf2d0" },
|
||||
"ts-comments.nvim": { "branch": "main", "commit": "217ab9cc137fceb6659b53790bd25e608219abe1" },
|
||||
"vscode.nvim": { "branch": "main", "commit": "cb9df0873c10a21d05362455ae3bb355eadcef6b" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "b4177e3eaf15fe5eb8357ebac2286d488be1ed00" },
|
||||
"yanky.nvim": { "branch": "main", "commit": "04775cc6e10ef038c397c407bc17f00a2f52b378" },
|
||||
"zen-mode.nvim": { "branch": "main", "commit": "438a59c33763d79e34ceb394e012c3bfd6aa1084" }
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
{
|
||||
"extras": [
|
||||
|
||||
],
|
||||
"install_version": 7,
|
||||
"news": {
|
||||
|
||||
@ -143,225 +143,6 @@ end
|
||||
-- Keybind for inserting TODO comment
|
||||
vim.api.nvim_set_keymap("n", "<leader>t", "<cmd>lua insert_todo_comment()<CR>", { noremap = true, silent = true })
|
||||
|
||||
local function git_output(args)
|
||||
local output = vim.fn.system(args)
|
||||
if vim.v.shell_error ~= 0 then
|
||||
return nil
|
||||
end
|
||||
return vim.split(output, "\n", { trimempty = true })
|
||||
end
|
||||
|
||||
local function branch_todos_base()
|
||||
if vim.g.branch_todos_base then
|
||||
return vim.g.branch_todos_base
|
||||
end
|
||||
|
||||
for _, ref in ipairs({ "origin/main", "origin/master", "main", "master" }) do
|
||||
if git_output({ "git", "rev-parse", "--verify", ref }) then
|
||||
return ref
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function branch_todos_entries()
|
||||
local base = branch_todos_base()
|
||||
if not base then
|
||||
return { "No git base found. Set vim.g.branch_todos_base." }
|
||||
end
|
||||
|
||||
local merge_base = git_output({ "git", "merge-base", base, "HEAD" })
|
||||
if not merge_base or not merge_base[1] then
|
||||
return { "Could not find merge-base against " .. base .. "." }
|
||||
end
|
||||
|
||||
local lines = git_output({ "git", "diff", "--unified=0", merge_base[1] })
|
||||
if not lines then
|
||||
return { "Could not read git diff against " .. base .. "." }
|
||||
end
|
||||
|
||||
local added_lines = {}
|
||||
local file
|
||||
local new_line
|
||||
local todo_keywords = { "TODO", "FIXME", "HACK", "XXX", "BUG", "BUGS" }
|
||||
|
||||
for _, line in ipairs(lines) do
|
||||
local diff_file = line:match("^%+%+%+ b/(.+)$")
|
||||
if diff_file then
|
||||
file = diff_file
|
||||
new_line = nil
|
||||
else
|
||||
local hunk_start = line:match("^@@ %-%d+,?%d* %+(%d+),?%d* @@")
|
||||
if hunk_start then
|
||||
new_line = tonumber(hunk_start)
|
||||
elseif new_line and line:sub(1, 1) == "+" and not line:match("^%+%+%+") then
|
||||
local text = line:sub(2)
|
||||
if file then
|
||||
table.insert(added_lines, { file = file, line = new_line, text = text })
|
||||
end
|
||||
new_line = new_line + 1
|
||||
elseif new_line and line:sub(1, 1) ~= "-" then
|
||||
new_line = new_line + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function has_todo_keyword(text)
|
||||
local upper_text = text:upper()
|
||||
for _, keyword in ipairs(todo_keywords) do
|
||||
local start = 1
|
||||
while true do
|
||||
local match_start, match_end = upper_text:find(keyword, start, true)
|
||||
if not match_start then
|
||||
break
|
||||
end
|
||||
|
||||
local before = match_start > 1 and upper_text:sub(match_start - 1, match_start - 1) or ""
|
||||
local after = match_end < #upper_text and upper_text:sub(match_end + 1, match_end + 1) or ""
|
||||
if not before:match("[%w_]") and not after:match("[%w_]") then
|
||||
return true
|
||||
end
|
||||
|
||||
start = match_end + 1
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function list_depth_delta(text)
|
||||
local _, opens = text:gsub("%[", "")
|
||||
local _, closes = text:gsub("%]", "")
|
||||
return opens - closes
|
||||
end
|
||||
|
||||
local entries = {}
|
||||
local index = 1
|
||||
while index <= #added_lines do
|
||||
local item = added_lines[index]
|
||||
if has_todo_keyword(item.text) then
|
||||
table.insert(entries, string.format("%s:%d", item.file, item.line))
|
||||
table.insert(entries, item.text)
|
||||
|
||||
if item.text:lower():match('todo:%s*"""') and not item.text:match('""".*"""') then
|
||||
index = index + 1
|
||||
while index <= #added_lines do
|
||||
local next_item = added_lines[index]
|
||||
if next_item.file ~= item.file then
|
||||
break
|
||||
end
|
||||
table.insert(entries, next_item.text)
|
||||
if next_item.text:find('"""', 1, true) then
|
||||
break
|
||||
end
|
||||
index = index + 1
|
||||
end
|
||||
elseif item.text:match("[=:]%s*%[") and list_depth_delta(item.text) > 0 then
|
||||
local depth = list_depth_delta(item.text)
|
||||
index = index + 1
|
||||
while index <= #added_lines do
|
||||
local next_item = added_lines[index]
|
||||
if next_item.file ~= item.file then
|
||||
break
|
||||
end
|
||||
|
||||
table.insert(entries, next_item.text)
|
||||
depth = depth + list_depth_delta(next_item.text)
|
||||
if depth <= 0 then
|
||||
break
|
||||
end
|
||||
|
||||
index = index + 1
|
||||
end
|
||||
elseif item.text:match("^%s*#") then
|
||||
index = index + 1
|
||||
while index <= #added_lines do
|
||||
local next_item = added_lines[index]
|
||||
if next_item.file ~= item.file or not next_item.text:match("^%s*#") then
|
||||
break
|
||||
end
|
||||
table.insert(entries, next_item.text)
|
||||
index = index + 1
|
||||
end
|
||||
index = index - 1
|
||||
end
|
||||
|
||||
table.insert(entries, "")
|
||||
end
|
||||
|
||||
index = index + 1
|
||||
end
|
||||
|
||||
if #entries == 0 then
|
||||
return { "No TODOs added on this branch against " .. base .. "." }
|
||||
end
|
||||
|
||||
return entries
|
||||
end
|
||||
|
||||
local function jump_to_branch_todo()
|
||||
local line = vim.api.nvim_get_current_line()
|
||||
local file, linenum = line:match("([^:%s]+):(%d+)")
|
||||
if not file then
|
||||
local cursor = vim.api.nvim_win_get_cursor(0)
|
||||
for row = cursor[1] - 1, 1, -1 do
|
||||
local previous_line = vim.api.nvim_buf_get_lines(0, row - 1, row, false)[1] or ""
|
||||
file, linenum = previous_line:match("([^:%s]+):(%d+)")
|
||||
if file then
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if file and linenum then
|
||||
local current_win = vim.api.nvim_get_current_win()
|
||||
vim.cmd("wincmd h")
|
||||
if current_win == vim.api.nvim_get_current_win() then
|
||||
vim.api.nvim_set_current_win(current_win)
|
||||
end
|
||||
|
||||
vim.cmd("edit " .. vim.fn.fnameescape(file))
|
||||
vim.api.nvim_win_set_cursor(0, { tonumber(linenum), 0 })
|
||||
if vim.api.nvim_win_is_valid(current_win) and current_win ~= vim.api.nvim_get_current_win() then
|
||||
vim.api.nvim_set_current_win(current_win)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function refresh_branch_todos(buf)
|
||||
local cursor = vim.api.nvim_win_get_cursor(0)
|
||||
vim.bo[buf].modifiable = true
|
||||
vim.api.nvim_buf_set_lines(buf, 0, -1, false, branch_todos_entries())
|
||||
vim.bo[buf].modifiable = false
|
||||
|
||||
local line_count = vim.api.nvim_buf_line_count(buf)
|
||||
vim.api.nvim_win_set_cursor(0, { math.min(cursor[1], line_count), cursor[2] })
|
||||
end
|
||||
|
||||
local function open_branch_todos()
|
||||
local name = "branch-todos"
|
||||
local buf = vim.fn.bufnr(name)
|
||||
if buf == -1 then
|
||||
buf = vim.api.nvim_create_buf(true, false)
|
||||
vim.api.nvim_buf_set_name(buf, name)
|
||||
end
|
||||
|
||||
vim.api.nvim_set_current_buf(buf)
|
||||
vim.bo[buf].buftype = "nofile"
|
||||
vim.bo[buf].bufhidden = "hide"
|
||||
vim.bo[buf].swapfile = false
|
||||
vim.bo[buf].filetype = "branch-todos"
|
||||
|
||||
refresh_branch_todos(buf)
|
||||
|
||||
vim.keymap.set("n", "<CR>", jump_to_branch_todo, { buffer = buf, desc = "Jump to branch TODO" })
|
||||
vim.keymap.set("n", "r", function()
|
||||
refresh_branch_todos(buf)
|
||||
end, { buffer = buf, desc = "Refresh branch TODOs" })
|
||||
vim.keymap.set("n", "q", "<cmd>bdelete<CR>", { buffer = buf, desc = "Close branch TODOs" })
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command("BranchTodos", open_branch_todos, {})
|
||||
vim.keymap.set("n", "<leader>xb", open_branch_todos, { desc = "Branch TODOs" })
|
||||
|
||||
-- floating NOTES
|
||||
function open_notes()
|
||||
local notes_file = vim.env.HOME .. "/git/notes/todo.md" -- Path to your notes file
|
||||
@ -445,7 +226,6 @@ function choose_timer()
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
vim.api.nvim_set_keymap("n", "<leader>T", "<cmd>lua choose_timer()<CR>", { noremap = true, silent = true })
|
||||
|
||||
-- Remap arrow keys to hjkl in Normal and Visual modes
|
||||
@ -458,15 +238,3 @@ vim.keymap.set({ "n", "v" }, "<C-Up>", "k", { noremap = true, silent = true })
|
||||
vim.keymap.set({ "n", "v" }, "<C-Down>", "j", { noremap = true, silent = true })
|
||||
vim.keymap.set({ "n", "v" }, "<C-Left>", "h", { noremap = true, silent = true })
|
||||
vim.keymap.set({ "n", "v" }, "<C-Right>", "l", { noremap = true, silent = true })
|
||||
|
||||
-- map leader u v c to CsvViewEnable display_mode=border with description `CSV View (commas)`
|
||||
vim.keymap.set("n", "<leader>uvc", "<cmd>CsvViewEnable display_mode=border<CR>", { 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",
|
||||
"<leader>uvt",
|
||||
"<cmd>CsvViewEnable delimiter=\\t display_mode=border<CR>",
|
||||
{ desc = "CSV View (tabs)" }
|
||||
)
|
||||
-- map leader u v d to CsvViewDisable with description `CSV View Disable`
|
||||
vim.keymap.set("n", "<leader>uvd", "<cmd>CsvViewDisable<CR>", { desc = "CSV View Disable" })
|
||||
|
||||
@ -3,8 +3,6 @@
|
||||
-- Add any additional options here
|
||||
|
||||
vim.opt.laststatus = 3
|
||||
|
||||
vim.g.maplocalleader = ","
|
||||
vim.diagnostic.config({ virtual_text = true })
|
||||
vim.opt.completeopt = { "menu", "menuone", "noinsert", "noselect", "popup" }
|
||||
|
||||
vim.opt.scrolloff = 20
|
||||
|
||||
@ -38,193 +38,4 @@ return {
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
"coder/claudecode.nvim",
|
||||
dependencies = { "folke/snacks.nvim" },
|
||||
config = true,
|
||||
keys = {
|
||||
{ "<leader>a", nil, desc = "AI/Claude Code" },
|
||||
{ "<leader>ac", "<cmd>ClaudeCode<cr>", desc = "Toggle Claude" },
|
||||
{ "<leader>af", "<cmd>ClaudeCodeFocus<cr>", desc = "Focus Claude" },
|
||||
{ "<leader>ar", "<cmd>ClaudeCode --resume<cr>", desc = "Resume Claude" },
|
||||
{ "<leader>aC", "<cmd>ClaudeCode --continue<cr>", desc = "Continue Claude" },
|
||||
{ "<leader>am", "<cmd>ClaudeCodeSelectModel<cr>", desc = "Select Claude model" },
|
||||
{ "<leader>ab", "<cmd>ClaudeCodeAdd %<cr>", desc = "Add current buffer" },
|
||||
{ "<leader>as", "<cmd>ClaudeCodeSend<cr>", mode = "v", desc = "Send to Claude" },
|
||||
{
|
||||
"<leader>as",
|
||||
"<cmd>ClaudeCodeTreeAdd<cr>",
|
||||
desc = "Add file",
|
||||
ft = { "NvimTree", "neo-tree", "oil", "minifiles", "netrw" },
|
||||
},
|
||||
-- Diff management
|
||||
{ "<leader>aa", "<cmd>ClaudeCodeDiffAccept<cr>", desc = "Accept diff" },
|
||||
{ "<leader>ad", "<cmd>ClaudeCodeDiffDeny<cr>", 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 = "<custom path to cursor rules>"
|
||||
|
||||
--- A list of folders where you have your own SKILL.md
|
||||
--- Expected format:
|
||||
--- /path/to/dir/<skill_name>/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", "<leader>9v", function()
|
||||
_99.visual()
|
||||
end)
|
||||
|
||||
--- if you have a request you dont want to make any changes, just cancel it
|
||||
vim.keymap.set("n", "<leader>9x", function()
|
||||
_99.stop_all_requests()
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<leader>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 = {
|
||||
["<a-a>"] = { "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" }, "<C-a>", function()
|
||||
require("opencode").ask("@this: ", { submit = true })
|
||||
end, { desc = "Ask opencode…" })
|
||||
vim.keymap.set({ "n", "x" }, "<C-x>", function()
|
||||
require("opencode").select()
|
||||
end, { desc = "Execute opencode action…" })
|
||||
vim.keymap.set({ "n", "t" }, "<C-.>", 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", "<S-C-u>", function()
|
||||
require("opencode").command("session.half.page.up")
|
||||
end, { desc = "Scroll opencode up" })
|
||||
vim.keymap.set("n", "<S-C-d>", function()
|
||||
require("opencode").command("session.half.page.down")
|
||||
end, { desc = "Scroll opencode down" })
|
||||
|
||||
-- You may want these if you use the opinionated `<C-a>` and `<C-x>` keymaps above — otherwise consider `<leader>o…` (and remove terminal mode from the `toggle` keymap)
|
||||
vim.keymap.set("n", "+", "<C-a>", { desc = "Increment under cursor", noremap = true })
|
||||
vim.keymap.set("n", "-", "<C-x>", { desc = "Decrement under cursor", noremap = true })
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
@ -5,10 +5,15 @@ return {
|
||||
},
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
enabled = false,
|
||||
dependencies = { "fang2hou/blink-copilot" },
|
||||
opts = {
|
||||
sources = {
|
||||
providers = {
|
||||
copilot = {
|
||||
module = "blink-copilot",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"fang2hou/blink-copilot",
|
||||
enabled = false,
|
||||
},
|
||||
}
|
||||
|
||||
@ -1,42 +1,20 @@
|
||||
-- vim.lsp.config["elixir-ls"] = {
|
||||
-- cmd = { "elixir-ls" },
|
||||
-- filetypes = { "elixir", "eelixir", "heex" },
|
||||
-- root_markers = { "mix.exs", ".git" },
|
||||
-- }
|
||||
-- vim.lsp.enable("elixir-ls")
|
||||
|
||||
-- vim.lsp.config["deno"] = {
|
||||
-- cmd = { "deno", "lsp" },
|
||||
-- filetypes = { "javascript", "typescript" },
|
||||
-- root_markers = { "deno.json" },
|
||||
-- }
|
||||
-- vim.lsp.enable("deno")
|
||||
|
||||
-- vim.lsp.config["R"] = {
|
||||
-- cmd = { "/opt/homebrew/bin/R", "--no-echo", "-e", "languageserver::run()" },
|
||||
-- filetypes = { "r" },
|
||||
-- }
|
||||
-- vim.lsp.enable("R")
|
||||
--
|
||||
vim.lsp.config["uiua"] = {
|
||||
cmd = { "uiua", "lsp" },
|
||||
filetypes = { "uiua", "*.ua" },
|
||||
}
|
||||
vim.lsp.enable("uiua")
|
||||
vim.lsp.config("dexter", {
|
||||
cmd = { "dexter", "lsp" },
|
||||
root_markers = { ".dexter/dexter.db", ".dexter.db", ".git", "mix.exs" },
|
||||
vim.lsp.config["elixir-ls"] = {
|
||||
cmd = { "elixir-ls" },
|
||||
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)
|
||||
},
|
||||
})
|
||||
root_markers = { "mix.exs", ".git" },
|
||||
}
|
||||
vim.lsp.enable("elixir-ls")
|
||||
|
||||
vim.lsp.config["deno"] = {
|
||||
cmd = { "deno", "lsp" },
|
||||
filetypes = { "javascript", "typescript" },
|
||||
root_markers = { "deno.json" },
|
||||
}
|
||||
vim.lsp.enable("deno")
|
||||
|
||||
vim.lsp.enable("dexter")
|
||||
-- CUSTOM LSP's
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
if kx_custom and vim.loop.os_uname().sysname == "Darwin" then
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "elixir", "typescript", "json" },
|
||||
callback = function()
|
||||
vim.lsp.start({
|
||||
@ -45,62 +23,8 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||
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 client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
||||
|
||||
if client:supports_method("textDocument/completion") then
|
||||
client.server_capabilities.completionProvider.triggerCharacters = vim.tbl_keys(
|
||||
vim.tbl_extend(
|
||||
"force",
|
||||
vim.iter(client.server_capabilities.completionProvider.triggerCharacters or {}):fold({}, function(chars, char)
|
||||
chars[char] = true
|
||||
return chars
|
||||
end),
|
||||
vim
|
||||
.iter(vim.split("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.:-", ""))
|
||||
:fold({}, function(chars, char)
|
||||
chars[char] = true
|
||||
return chars
|
||||
end)
|
||||
)
|
||||
)
|
||||
|
||||
vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = true })
|
||||
end
|
||||
|
||||
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,
|
||||
})
|
||||
end
|
||||
if kx_custom and vim.loop.os_uname().sysname == "Linux" then
|
||||
vim.lsp.config["alsp"] = {
|
||||
cmd = { "alsp" },
|
||||
@ -121,146 +45,4 @@ if kx_custom and vim.loop.os_uname().sysname == "Linux" then
|
||||
end,
|
||||
})
|
||||
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 rg = vim.system({ "rg", "-q", "--glob", "*.ex", "use ExOf", root }):wait()
|
||||
if rg.code ~= 0 then
|
||||
return
|
||||
end
|
||||
|
||||
vim.lsp.start({
|
||||
name = "exofx-lsp",
|
||||
cmd_env = { MIX_ENV = "test" },
|
||||
cmd = { "mix", "exofx.lsp" },
|
||||
root_dir = root,
|
||||
cmd_cwd = root,
|
||||
-- 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", "<M-Space>", function()
|
||||
if vim.fn.pumvisible() == 1 then
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<C-e>", true, false, true), "n", false)
|
||||
end
|
||||
|
||||
vim.schedule(function()
|
||||
vim.lsp.completion.get()
|
||||
end)
|
||||
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 {}
|
||||
|
||||
@ -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 },
|
||||
@ -90,14 +90,6 @@ return {
|
||||
-- indent = { enabled = false },
|
||||
},
|
||||
},
|
||||
{
|
||||
"folke/noice.nvim",
|
||||
opts = {
|
||||
popupmenu = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"folke/zen-mode.nvim",
|
||||
keys = {
|
||||
@ -202,14 +194,11 @@ return {
|
||||
{
|
||||
"gpanders/nvim-parinfer",
|
||||
},
|
||||
{
|
||||
"EdenEast/nightfox.nvim",
|
||||
opts = {
|
||||
{ "EdenEast/nightfox.nvim", opts = {
|
||||
colorblind = {
|
||||
enable = true,
|
||||
},
|
||||
}
|
||||
},
|
||||
} },
|
||||
{ "catppuccin/nvim", name = "catppuccin" },
|
||||
{
|
||||
"folke/tokyonight.nvim",
|
||||
@ -316,53 +305,10 @@ return {
|
||||
-- Escape into Normal mode from Terminal mode
|
||||
map_combo("t", "jk", "<BS><BS><C-\\><C-n>")
|
||||
map_combo("t", "kj", "<BS><BS><C-\\><C-n>")
|
||||
-- alt-k alt-j to navigate command line history
|
||||
map_combo("t", "<A-j>", "<Down>")
|
||||
map_combo("t", "<A-k>", "<Up>")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"OXY2DEV/markview.nvim",
|
||||
lazy = false,
|
||||
},
|
||||
{
|
||||
"alanfortlink/blackjack.nvim",
|
||||
opts = {
|
||||
card_style = "large", -- Can be "mini" or "large".
|
||||
suit_style = "black", -- Can be "black" or "white".
|
||||
scores_path = vim.fn.stdpath("data") .. "/blackjack_scores.json",
|
||||
keybindings = {
|
||||
["next"] = "j",
|
||||
["finish"] = "k",
|
||||
["quit"] = "q",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"R-nvim/R.nvim",
|
||||
-- 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 <Tab> and <S-Tab> to move horizontally between fields.
|
||||
-- Use <Enter> and <S-Enter> 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 <S-Tab> and <S-Enter>.
|
||||
jump_next_field_end = { "<Tab>", mode = { "n", "v" } },
|
||||
jump_prev_field_end = { "<S-Tab>", mode = { "n", "v" } },
|
||||
jump_next_row = { "<Enter>", mode = { "n", "v" } },
|
||||
jump_prev_row = { "<S-Enter>", mode = { "n", "v" } },
|
||||
},
|
||||
},
|
||||
cmd = { "CsvViewEnable", "CsvViewDisable", "CsvViewToggle" },
|
||||
},
|
||||
}
|
||||
|
||||
99
proxy.py
99
proxy.py
@ -1,99 +0,0 @@
|
||||
import json
|
||||
import uuid
|
||||
import requests
|
||||
import time
|
||||
import secrets
|
||||
|
||||
from pathlib import Path
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
|
||||
|
||||
def get_copilot_token_from_neovim_vault():
|
||||
"""Read Copilot token from Neovim's vault_state.json."""
|
||||
vault_path = Path.home() / ".local/share/lazyvim/gp/persisted/vault_state.json"
|
||||
|
||||
try:
|
||||
with open(vault_path, 'r') as f:
|
||||
vault = json.load(f)
|
||||
return vault['copilot_bearer']['token']
|
||||
except (FileNotFoundError, KeyError, json.JSONDecodeError) as e:
|
||||
raise Exception(f"Failed to read Copilot token from vault: {e}")
|
||||
|
||||
|
||||
def gen_hex_str(n):
|
||||
return secrets.token_hex(n)
|
||||
|
||||
|
||||
class CopilotOpenAIProxy(BaseHTTPRequestHandler):
|
||||
DEFAULT_HEADERS = {
|
||||
'Editor-Version': "vscode/1.83.1",
|
||||
'Editor-Plugin-Version': "copilot-chat/0.8.0",
|
||||
'Openai-Organization': "github-copilot",
|
||||
'Openai-Intent': "conversation-panel",
|
||||
'Content-Type': "text/event-stream; charset=utf-8",
|
||||
'User-Agent': "GitHubCopilotChat/0.8.0",
|
||||
'Accept': "*/*",
|
||||
'Accept-Encoding': "gzip,deflate,br",
|
||||
}
|
||||
copilot_token = None
|
||||
|
||||
def __init__(self, token):
|
||||
self.copilot_token = token
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
"""Handle a request."""
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def request_id(self):
|
||||
return gen_hex_str(4) + "-" + gen_hex_str(2) + "-" + gen_hex_str(2) + "-" + gen_hex_str(2) + "-" + gen_hex_str(6)
|
||||
|
||||
def session_id(self):
|
||||
return gen_hex_str(4) + "-" + gen_hex_str(2) + "-" + gen_hex_str(2) + "-" + gen_hex_str(2) + "-" + gen_hex_str(12)
|
||||
|
||||
def machine_id(self):
|
||||
return gen_hex_str(32)
|
||||
|
||||
def do_POST(self):
|
||||
if self.path != '/v1/chat/completions':
|
||||
self.send_response(
|
||||
requests.codes.method_not_allowed, "Method Not Allowed")
|
||||
self.end_headers()
|
||||
|
||||
return
|
||||
|
||||
content_length = int(self.headers['Content-Length'])
|
||||
body = self.rfile.read(content_length)
|
||||
copilot_resp = self.copilot_request(body)
|
||||
|
||||
if copilot_resp.status_code != requests.codes.ok:
|
||||
self.send_response(copilot_resp.status_code)
|
||||
self.end_headers()
|
||||
|
||||
return
|
||||
|
||||
self.send_response(requests.codes.ok)
|
||||
self.end_headers()
|
||||
self.wfile.write(copilot_resp.content)
|
||||
print(copilot_resp.content)
|
||||
|
||||
def copilot_request(self, body):
|
||||
url = "https://api.githubcopilot.com/chat/completions"
|
||||
|
||||
headers = self.DEFAULT_HEADERS.copy()
|
||||
headers['Authorization'] = f'Bearer {self.copilot_token}'
|
||||
headers['X-Request-ID'] = self.request_id()
|
||||
headers['Vscode-Sessionid'] = self.session_id()
|
||||
headers['Vscode-Machineid'] = self.machine_id()
|
||||
|
||||
return requests.post(url, headers=headers, data=body)
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
token = get_copilot_token_from_neovim_vault()
|
||||
proxy = CopilotOpenAIProxy(token)
|
||||
|
||||
server_address = ('127.0.0.1', 3040)
|
||||
httpd = HTTPServer(server_address, proxy)
|
||||
print("Proxy running at http://127.0.0.1:3040")
|
||||
httpd.serve_forever()
|
||||
@ -1,24 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# 1. Select a directory using zoxide's interactive selection
|
||||
ZOXIDE_RESULT=$(zoxide query --interactive)
|
||||
|
||||
# 2. Exit if no directory was selected
|
||||
if [ -z "$ZOXIDE_RESULT" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 3. Get the directory name to use as the session name
|
||||
SESSION_NAME=$(basename "$ZOXIDE_RESULT" | tr . _)
|
||||
|
||||
# 4. Check if the session already exists
|
||||
SESSION_EXISTS=$(zellij list-sessions | grep -w "$SESSION_NAME")
|
||||
--cwd "$ZOXIDE_RESULT"
|
||||
# 5. Create or attach to the session
|
||||
if [ -z "$SESSION_EXISTS" ]; then
|
||||
# Create a new session in the selected directory
|
||||
zellij attach --create "$SESSION_NAME"
|
||||
else
|
||||
# Attach to the existing session
|
||||
zellij attach --create "$SESSION_NAME"
|
||||
fi
|
||||
@ -1,31 +0,0 @@
|
||||
local wezterm = require("wezterm")
|
||||
|
||||
local config = {}
|
||||
|
||||
config.color_scheme = "Batman"
|
||||
|
||||
local workspace_switcher = wezterm.plugin.require("https://github.com/MLFlexer/smart_workspace_switcher.wezterm")
|
||||
workspace_switcher.zoxide_path = "/opt/homebrew/bin/zoxide"
|
||||
workspace_switcher.apply_to_config(config)
|
||||
config.leader = { key = "x", mods = "CTRL", timeout_milliseconds = 1000 }
|
||||
config.keys = {
|
||||
-- ...
|
||||
-- your other keybindings
|
||||
{
|
||||
key = "s",
|
||||
mods = "LEADER",
|
||||
action = workspace_switcher.switch_workspace(),
|
||||
},
|
||||
|
||||
{
|
||||
key = "S",
|
||||
mods = "LEADER",
|
||||
action = workspace_switcher.switch_to_prev_workspace(),
|
||||
},
|
||||
{
|
||||
key = "m",
|
||||
mods = "CMD",
|
||||
action = wezterm.action.DisableDefaultAssignment,
|
||||
},
|
||||
}
|
||||
return config
|
||||
Loading…
x
Reference in New Issue
Block a user