Compare commits
27 Commits
9bae49fa30
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4f8b345dd | ||
|
|
1aea2cfc68 | ||
|
9fa8ac630c
|
|||
|
3d6e9d215e
|
|||
|
97e81424fa
|
|||
|
|
ab352ba2a9 | ||
|
a8f250f96b
|
|||
|
95089a5a57
|
|||
|
9a7981eaba
|
|||
| 78b8e47080 | |||
|
dfab17ce27
|
|||
|
8a151a6430
|
|||
|
ebbe37bece
|
|||
|
211a543b71
|
|||
|
79556ce727
|
|||
|
cc288092b8
|
|||
|
3038404b0a
|
|||
| ab2e588899 | |||
|
b4789ac055
|
|||
|
e5a4785c0c
|
|||
|
2a2ceff819
|
|||
| 73df9af394 | |||
|
283b2540ee
|
|||
|
c9631baf48
|
|||
| 9c292f0fa8 | |||
| 4ec292dde6 | |||
|
e216dc057c
|
12
init.lua
12
init.lua
@@ -1,12 +1,16 @@
|
||||
require("core.lazy")
|
||||
vim.cmd("colorscheme catppuccin")
|
||||
require("core.keymaps")
|
||||
require("core.lsp-notifications")
|
||||
-- require("core.lsp-notifications")
|
||||
require("utils.extensions")
|
||||
require("utils.telescope_extra").setup()
|
||||
require("utils.git_paste").setup({
|
||||
telescope_key = "<leader>pg",
|
||||
})
|
||||
vim.filetype.add({
|
||||
pattern = { [".*/hypr/.*%.conf"] = "hyprlang" },
|
||||
})
|
||||
require("utils.treesitter.parsers.hyprlang")
|
||||
require("utils.hyprland.lsp")
|
||||
-- vim.notify = function(msg, level, opts)
|
||||
-- print("Notification debug:", msg, level, vim.inspect(opts))
|
||||
-- -- Call original notify
|
||||
-- require("notify")(msg, level, opts)
|
||||
-- end
|
||||
|
||||
@@ -2,62 +2,64 @@
|
||||
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
|
||||
"any-jump.vim": { "branch": "master", "commit": "f95674d9a4251ac02f452d5f1861e4422f4652c7" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
|
||||
"catppuccin": { "branch": "main", "commit": "4bb938bbba41d306db18bf0eb0633a5f28fd7ba0" },
|
||||
"cmp-async-path": { "branch": "main", "commit": "d6d1ffa2075039632a2d71e8fa139818e15ac757" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"catppuccin": { "branch": "main", "commit": "b7bbdf93b42866f166af98d39a2563eedb7cabac" },
|
||||
"cmp-async-path": { "branch": "main", "commit": "0ed1492f59e730c366d261a5ad822fa37e44c325" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
|
||||
"cmp-nvim-lsp-document-symbol": { "branch": "main", "commit": "f94f7ba948e32cd302caba1c2ca3f7c697fb4fcf" },
|
||||
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"codecompanion.nvim": { "branch": "main", "commit": "67a747eeab28456971979c8ee03c648135e8687c" },
|
||||
"codecompanion.nvim": { "branch": "main", "commit": "e55bbf5f6969ab41414d3fd68011366d3b80d024" },
|
||||
"conform.nvim": { "branch": "master", "commit": "372fc521f8421b7830ea6db4d6ea3bae1c77548c" },
|
||||
"copilot-cmp": { "branch": "master", "commit": "15fc12af3d0109fa76b60b5cffa1373697e261d1" },
|
||||
"copilot-lualine": { "branch": "main", "commit": "dc4b8ed0f75bc2557b3158c526624bf04ad233ea" },
|
||||
"copilot.lua": { "branch": "master", "commit": "30321e33b03cb924fdcd6a806a0dc6fa0b0eafb9" },
|
||||
"dashboard-nvim": { "branch": "master", "commit": "000448d837f6e7a47f8f342f29526c4d7e49e9ce" },
|
||||
"copilot-lualine": { "branch": "main", "commit": "6bc29ba1fcf8f0f9ba1f0eacec2f178d9be49333" },
|
||||
"copilot.lua": { "branch": "master", "commit": "a5c390f8d8e85b501b22dcb2f30e0cbbd69d5ff0" },
|
||||
"dashboard-nvim": { "branch": "master", "commit": "591b5b29e2f17b97496ec3179f6ecd08bb8502cc" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "4c40357994f386e72be92a46f41fc1664c84c87d" },
|
||||
"goto-preview": { "branch": "main", "commit": "4751e70a6ebce4fb78327b097cb8fdff55f38f3a" },
|
||||
"image.nvim": { "branch": "master", "commit": "6ffafab2e98b5bda46bf227055aa84b90add8cdc" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "e10626f7fcd51ccd56d7ffc00883ba7e0aa28f78" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "e5e9bf48211a13d9ee6c1077c88327c49c1ab4a0" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "1796c7cedfe7e5dd20096c5d7b8b753d8f8d22eb" },
|
||||
"goto-preview": { "branch": "main", "commit": "d1faf6ea992b5bcaaaf2c682e1aba3131a01143e" },
|
||||
"image.nvim": { "branch": "master", "commit": "4c51d6202628b3b51e368152c053c3fb5c5f76f2" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
|
||||
"lsp_lines.nvim": { "branch": "main", "commit": "a92c755f182b89ea91bd8a6a2227208026f27b4d" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "f4f791f67e70d378a754d02da068231d2352e5bc" },
|
||||
"mini.diff": { "branch": "main", "commit": "bc3a7be30fd45ed4961ea90de1d9d04637cdeae6" },
|
||||
"mini.nvim": { "branch": "main", "commit": "dc1775613f672e6a804577945813353c5c4e6fe5" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "15884cee63a8c205334ab13ab1c891cd4d27101a" },
|
||||
"mcphub.nvim": { "branch": "main", "commit": "81394b54e292a50361aba11198e5fa4ebb97d304" },
|
||||
"mini.diff": { "branch": "main", "commit": "7e268d0241255abaa07b8aa0ddff028f7315fe21" },
|
||||
"mini.nvim": { "branch": "main", "commit": "90ab64f944a5a63a9efebe6735e1f2c6d4db3613" },
|
||||
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "f41624ea1a73f020ddbd33438f74abb95ea17d55" },
|
||||
"nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "68f0e5c3dab23261a945272032ee6700af86227a" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "a49f5a79cdb76e0dc1a98899c8598f4db014c5e7" },
|
||||
"nui.nvim": { "branch": "main", "commit": "8d5b0b568517935d3c84f257f272ef004d9f5a59" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
|
||||
"nvim-html-css": { "branch": "main", "commit": "fa7e2da75edfd3d110fc8d4f8e5215b5de56ff42" },
|
||||
"nvim-lint": { "branch": "master", "commit": "6e9dd545a1af204c4022a8fcd99727ea41ffdcc8" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "7c8cb61b21727a473663054edec4b83633d9e442" },
|
||||
"nvim-html-css": { "branch": "main", "commit": "23f53cbb8cf4ae7c302ba483ea8a28e5b03713a7" },
|
||||
"nvim-lint": { "branch": "master", "commit": "9dfb77ef6c5092a19502883c02dc5a02ec648729" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "46434074f188e6bfccf9d9153dd8be6b1381498b" },
|
||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||
"nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "d529a99f88e0dff02e0aa275db2f595cd252a2c8" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "bf18d4dc8d9a7a61e855190bc154df12d6536741" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "1020869742ecb191f260818234517f4a1515cfe8" },
|
||||
"nvim-notify": { "branch": "master", "commit": "b5825cf9ee881dd8e43309c93374ed5b87b7a896" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "be5b788f2dc1522c73fb7afad9092331c8aebe80" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "94ea4f436d2b59c80f02e293466c374584f03b8c" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "6daca3ad780f045550b820f262002f35175a6c04" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "2c2b4eafce6cdd0cb165036faa17396eff18f847" },
|
||||
"obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" },
|
||||
"odis": { "branch": "master", "commit": "5176a07a729860d0c0cdefe96252fc7ff9e16d43" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
|
||||
"rainbow-delimiters.nvim": { "branch": "master", "commit": "011d98eaa3a73b5a51d82ce5bc6b1397dde95562" },
|
||||
"render-markdown.nvim": { "branch": "main", "commit": "57fa691b9e374c6539cc0340062dac8f42d4bd8b" },
|
||||
"rainbow-delimiters.nvim": { "branch": "master", "commit": "55ad4fb76ab68460f700599b7449385f0c4e858e" },
|
||||
"render-markdown.nvim": { "branch": "main", "commit": "b2d857c848c2c27440c8e5efc8e49a9b5bcf13c6" },
|
||||
"telescope-color-names.nvim": { "branch": "main", "commit": "95b372b9a8ba0fc7cf6a67be637ee37453f322da" },
|
||||
"telescope-file-browser.nvim": { "branch": "master", "commit": "626998e5c1b71c130d8bc6cf7abb6709b98287bb" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "2a5ceff981501cff8f46871d5402cd3378a8ab6a" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
|
||||
"telescope-glyph.nvim": { "branch": "master", "commit": "f63f01e129e71cc25b79637610674bbf0be5ce9d" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "78857db9e8d819d3cc1a9a7bdc1d39d127a36495" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" },
|
||||
"vim-commentary": { "branch": "master", "commit": "64a654ef4a20db1727938338310209b6a63f60c9" },
|
||||
"vim-dotenv": { "branch": "master", "commit": "5c51cfcf8d87280d6414e03cd6b253eb70ecb800" },
|
||||
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
|
||||
"vim-wakatime": { "branch": "master", "commit": "e46d7c4f98ee0f40782008dd60cb2a79c377fb1d" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "5bf7a73fe851896d5ac26d313db849bf00f45b78" }
|
||||
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
|
||||
}
|
||||
|
||||
@@ -61,9 +61,9 @@ vim.cmd([[
|
||||
-- }}}
|
||||
|
||||
-- {{{ Code companion hook
|
||||
local group = vim.api.nvim_create_augroup("CodeCompanionHooks", {})
|
||||
local group = augroup("CodeCompanionHooks", {})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "User" }, {
|
||||
autocmd({ "User" }, {
|
||||
pattern = "CodeCompanionInline*",
|
||||
group = group,
|
||||
callback = function(request)
|
||||
@@ -74,17 +74,3 @@ vim.api.nvim_create_autocmd({ "User" }, {
|
||||
end,
|
||||
})
|
||||
-- }}}
|
||||
|
||||
-- {{{ Hyprlang LSP
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||
pattern = { "*.hl", "hypr*.conf" },
|
||||
callback = function(event)
|
||||
print(string.format("starting hyprls for %s", vim.inspect(event)))
|
||||
vim.lsp.start({
|
||||
name = "hyprlang",
|
||||
cmd = { "hyprls" },
|
||||
root_dir = vim.fn.getcwd(),
|
||||
})
|
||||
end,
|
||||
})
|
||||
--}}}
|
||||
|
||||
@@ -12,10 +12,14 @@ local nosilent = { noremap = true }
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = ","
|
||||
|
||||
function create_custom_command(trigger, command, description)
|
||||
-- Create a custom command with the given trigger, command, and description
|
||||
vim.api.nvim_create_user_command(trigger, command, { desc = description })
|
||||
end
|
||||
-- Custom commands
|
||||
vim.api.nvim_create_user_command("Config", "edit ~/.config/nvim", {})
|
||||
vim.api.nvim_create_user_command("Keymaps", "edit ~/.config/nvim/lua/core/keymaps.lua", {})
|
||||
vim.api.nvim_create_user_command("Hypr", "edit ~/.config/hypr/hyprland.conf", {})
|
||||
create_custom_command("Config", "edit ~/.config/nvim", "Edit nvim configuration")
|
||||
create_custom_command("Keymaps", "edit ~/.config/nvim/lua/core/keymaps.lua", "Edit Hyprland keybindings")
|
||||
create_custom_command("Hypr", "edit ~/.config/hypr/hyprland.conf", "Edit Hyprland configuration")
|
||||
|
||||
-- {{{ Basic Mappings
|
||||
local basic_mappings = {
|
||||
@@ -34,10 +38,10 @@ local basic_mappings = {
|
||||
local buffer_navigation_mappings = {
|
||||
{ key = "<C-J>", cmd = ":bnext<CR>", desc = "Next buffer", mode = "n" },
|
||||
{ key = "<C-K>", cmd = ":bprev<CR>", desc = "Previous buffer", mode = "n" },
|
||||
{ key = "<leader>bb", cmd = ":Telescope buffers<CR>", desc = "List buffers", mode = "n", group = "Buffers" },
|
||||
{ key = "<leader>bk", cmd = ":bdelete<CR>", desc = "Delete buffer", mode = "n", group = "Buffers" },
|
||||
{ key = "<leader>bn", cmd = ":bnext<CR>", desc = "Next buffer", mode = "n", group = "Buffers" },
|
||||
{ key = "<leader>bp", cmd = ":bprev<CR>", desc = "Previous buffer", mode = "n", group = "Buffers" },
|
||||
{ key = "<leader>bb", cmd = ":Telescope buffers<CR>", desc = "List buffers", mode = "n" },
|
||||
{ key = "<leader>bk", cmd = ":bdelete<CR>", desc = "Delete buffer", mode = "n" },
|
||||
{ key = "<leader>bn", cmd = ":bnext<CR>", desc = "Next buffer", mode = "n" },
|
||||
{ key = "<leader>bp", cmd = ":bprev<CR>", desc = "Previous buffer", mode = "n" },
|
||||
}
|
||||
--}}}
|
||||
|
||||
@@ -68,84 +72,72 @@ local terminal_mappings = {
|
||||
cmd = ":ToggleTerm name=toggleterm<CR>",
|
||||
desc = "Toggle terminal",
|
||||
mode = "n",
|
||||
group = "Toggle",
|
||||
},
|
||||
{
|
||||
key = "<leader>tT",
|
||||
cmd = ":ToggleTerm name=toggleterm-full direction=tab<CR>",
|
||||
desc = "Toggle full terminal",
|
||||
mode = "n",
|
||||
group = "Toggle",
|
||||
},
|
||||
{
|
||||
key = "<leader>ot",
|
||||
cmd = ":ToggleTerm name=toggleterm<CR>",
|
||||
desc = "Open terminal",
|
||||
mode = "n",
|
||||
group = "Open",
|
||||
},
|
||||
{
|
||||
key = "<leader>oT",
|
||||
cmd = ":ToggleTerm name=toggleterm-full direction=tab<CR>",
|
||||
desc = "Open full terminal",
|
||||
mode = "n",
|
||||
group = "Open",
|
||||
},
|
||||
{
|
||||
key = "<leader>ts",
|
||||
cmd = ":TermSelect<CR>",
|
||||
desc = "Select terminal",
|
||||
mode = "n",
|
||||
group = "Terminal",
|
||||
},
|
||||
{
|
||||
key = "<leader>tv",
|
||||
cmd = ":ToggleTerm direction=vertical name=toggleterm-vert<CR>",
|
||||
desc = "Toggle vertical terminal",
|
||||
mode = "n",
|
||||
group = "Terminal",
|
||||
},
|
||||
{
|
||||
key = "<leader>th",
|
||||
cmd = ":ToggleTerm direction=horizontal name=toggleterm-hori<CR>",
|
||||
desc = "Toggle horizontal terminal",
|
||||
mode = "n",
|
||||
group = "Terminal",
|
||||
},
|
||||
{
|
||||
key = "<leader>ov",
|
||||
cmd = ":ToggleTerm direction=vertical name=toggleterm-vert<CR>",
|
||||
desc = "Open vertical terminal",
|
||||
mode = "n",
|
||||
group = "Open",
|
||||
},
|
||||
{
|
||||
key = "<leader>oh",
|
||||
cmd = ":ToggleTerm direction=horizontal name=toggleterm-hori<CR>",
|
||||
desc = "Open horizontal terminal",
|
||||
mode = "n",
|
||||
group = "Open",
|
||||
},
|
||||
{
|
||||
key = "<leader>tf",
|
||||
cmd = ":ToggleTerm name=toggleterm<CR>",
|
||||
desc = "Toggle terminal",
|
||||
mode = "n",
|
||||
group = "Terminal",
|
||||
},
|
||||
{
|
||||
key = "<leader>-",
|
||||
cmd = ":ToggleTerm direction='horizontal'<CR>",
|
||||
desc = "Toggle horizontal terminal",
|
||||
mode = "n",
|
||||
group = "Horizontal Terminal",
|
||||
},
|
||||
{
|
||||
key = "<leader>|",
|
||||
cmd = ":ToggleTerm direction='vertical'<CR>",
|
||||
desc = "Toggle vertical terminal",
|
||||
mode = "n",
|
||||
group = "Vertical Terminal",
|
||||
},
|
||||
}
|
||||
--}}}
|
||||
@@ -214,8 +206,8 @@ local code_companion_mappings = {
|
||||
{
|
||||
mode = "v",
|
||||
key = "<leader>Ci",
|
||||
cmd = ":CodeCompanion /buffer ",
|
||||
group = "CodeCompanion /buffer",
|
||||
cmd = ":CodeCompanion #buffer ",
|
||||
group = "CodeCompanion #buffer",
|
||||
opts = nosilent,
|
||||
},
|
||||
{ mode = "v", key = "<leader>Ce", cmd = ":CodeCompanion /explain<CR>", group = "CodeCompanion /explain" },
|
||||
|
||||
@@ -15,7 +15,7 @@ o.syntax = "on"
|
||||
o.laststatus = 3
|
||||
o.number = true
|
||||
o.relativenumber = true
|
||||
o.colorcolumn = "80"
|
||||
o.colorcolumn = "88"
|
||||
o.textwidth = 80
|
||||
o.shiftwidth = 4
|
||||
o.expandtab = true
|
||||
@@ -67,5 +67,19 @@ local border = {
|
||||
}
|
||||
|
||||
-- set border for floating windows and signature help
|
||||
l.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = border })
|
||||
l.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
|
||||
-- UNSUPPPORTED: https://github.com/neovim/neovim/issues/32242#issuecomment-2777120640
|
||||
-- l.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = border })
|
||||
-- l.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
|
||||
o.winborder = "rounded"
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
signs = true,
|
||||
underline = true,
|
||||
float = { border = "rounded", source = true },
|
||||
severity_sort = true,
|
||||
})
|
||||
vim.keymap.set("", "<Leader>tl", function()
|
||||
local current = vim.diagnostic.config().virtual_text
|
||||
vim.diagnostic.config({ virtual_text = not current })
|
||||
end, { desc = "Toggle diagnostics virtual text" })
|
||||
|
||||
@@ -4,6 +4,7 @@ return {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"j-hui/fidget.nvim",
|
||||
"ravitemer/mcphub.nvim",
|
||||
},
|
||||
opts = {
|
||||
adapters = {
|
||||
@@ -11,17 +12,26 @@ return {
|
||||
return require("codecompanion.adapters").extend("copilot", {
|
||||
schema = {
|
||||
name = "copilot",
|
||||
opts = {
|
||||
stream = true,
|
||||
},
|
||||
model = {
|
||||
default = "claude-3.5-sonnet",
|
||||
-- default = "claude-3.7-sonnet-thought",
|
||||
-- default = "o3-mini",
|
||||
-- default = "gemini-2.0-flash-001",
|
||||
default = "gpt-4.1",
|
||||
-- default = "gpt-4o",
|
||||
-- default = "o3-mini-2025-01-31",
|
||||
choices = {
|
||||
["o3-mini-2025-01-31"] = { opts = { can_reason = true } },
|
||||
["o1-2024-12-17"] = { opts = { can_reason = true } },
|
||||
["o1-mini-2024-09-12"] = { opts = { can_reason = true } },
|
||||
"claude-3.5-sonnet",
|
||||
"gpt-4o-2024-08-06",
|
||||
"gemini-2.0-flash-001",
|
||||
},
|
||||
-- choices = {
|
||||
-- ["o3-mini-2025-01-31"] = { opts = { can_reason = true } },
|
||||
-- ["o1-2024-12-17"] = { opts = { can_reason = true } },
|
||||
-- ["o1-mini-2024-09-12"] = { opts = { can_reason = true } },
|
||||
-- "gpt-4o-2024-08-06",
|
||||
-- "claude-3.7-sonnet-thought",
|
||||
-- "claude-3.7-sonnet",
|
||||
-- "claude-3.5-sonnet",
|
||||
-- "gemini-2.0-flash-001",
|
||||
-- },
|
||||
},
|
||||
-- max_tokens = {
|
||||
-- default = 65536,
|
||||
@@ -29,12 +39,78 @@ return {
|
||||
},
|
||||
})
|
||||
end,
|
||||
llama_cpp = function()
|
||||
return require("codecompanion.adapters").extend("openai_compatible", {
|
||||
name = "llama.cpp",
|
||||
formatted_name = "llama.cpp",
|
||||
opts = {
|
||||
stream = false,
|
||||
},
|
||||
schema = {
|
||||
-- model = {
|
||||
-- default = "qwen2.5-coder-14b-instruct",
|
||||
-- choices = {
|
||||
-- ["qwen2.5-coder-14b-instruct"] = { opts = { can_reason = true } },
|
||||
-- ["/models/lmstudio-community/DeepSeek-R1-Distill-Qwen-7B-GGUF/DeepSeek-R1-Distill-Qwen-7B-Q4_K_M.gguf"] = {
|
||||
-- opts = { can_reason = true },
|
||||
-- },
|
||||
-- ["/models/lmstudio-community/Qwen2.5-7B-Instruct-1M-GGUF/Qwen2.5-7B-Instruct-1M-Q4_K_M.gguf"] = {
|
||||
-- opts = { can_reason = true },
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
temperature = {
|
||||
order = 2,
|
||||
mapping = "parameters",
|
||||
type = "number",
|
||||
optional = true,
|
||||
default = 0.2,
|
||||
validate = function(n)
|
||||
return n >= 0 and n <= 2, "Must be between 0 and 2"
|
||||
end,
|
||||
},
|
||||
},
|
||||
env = {
|
||||
url = "http://localhost:8080",
|
||||
chat_url = "/v1/chat/completions",
|
||||
},
|
||||
})
|
||||
end,
|
||||
openrouter = function()
|
||||
return require("codecompanion.adapters").extend("openai_compatible", {
|
||||
env = {
|
||||
url = "https://openrouter.ai/api",
|
||||
api_key = "cmd:cat $HOME/.openrouterapikey",
|
||||
chat_url = "/v1/chat/completions",
|
||||
},
|
||||
schema = {
|
||||
model = {
|
||||
default = "google/gemini-2.5-pro-exp-03-25:free",
|
||||
-- default = "deepseek/deepseek-chat-v3-0324:free",
|
||||
-- default = "google/gemini-2.0-flash-thinking-exp:free",
|
||||
-- default = "deepseek/deepseek-r1-distill-qwen-32b:free",
|
||||
-- default = "qwen/qwen-2.5-coder-32b-instruct:free",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
strategies = {
|
||||
chat = {
|
||||
adapter = "copilot",
|
||||
-- adapter = "openrouter",
|
||||
roles = {
|
||||
llm = " Assistant",
|
||||
llm = function(adapter)
|
||||
if adapter.model == nil then
|
||||
return " Assistant"
|
||||
else
|
||||
return " Assistant ("
|
||||
.. adapter.formatted_name
|
||||
.. " - "
|
||||
.. adapter.parameters.model
|
||||
.. ")"
|
||||
end
|
||||
end,
|
||||
user = " User",
|
||||
},
|
||||
slash_commands = {
|
||||
@@ -62,6 +138,7 @@ return {
|
||||
},
|
||||
inline = {
|
||||
adapter = "copilot",
|
||||
-- adapter = "openrouter",
|
||||
},
|
||||
},
|
||||
display = {
|
||||
@@ -81,14 +158,51 @@ return {
|
||||
show_token_count = true, -- Show the token count for each response?
|
||||
start_in_insert_mode = false, -- Open the chat buffer in insert mode?
|
||||
},
|
||||
window = {
|
||||
layout = "vertical",
|
||||
position = nil,
|
||||
border = "rounded",
|
||||
height = 0.45,
|
||||
width = 0.45,
|
||||
relative = "editor",
|
||||
opts = {
|
||||
breakindent = true,
|
||||
cursorcolumn = false,
|
||||
cursorline = false,
|
||||
foldcolumn = "0",
|
||||
linebreak = true,
|
||||
list = false,
|
||||
numberwidth = 1,
|
||||
signcolumn = "no",
|
||||
spell = false,
|
||||
wrap = true,
|
||||
},
|
||||
},
|
||||
diff = {
|
||||
enabled = true,
|
||||
provider = "mini_diff",
|
||||
},
|
||||
---Customize how tokens are displayed
|
||||
---@param tokens number
|
||||
---@param adapter CodeCompanion.Adapter
|
||||
---@return string
|
||||
token_count = function(tokens, adapter)
|
||||
return " (" .. tokens .. " tokens)"
|
||||
end,
|
||||
},
|
||||
opts = {
|
||||
-- log_level = "DEBUG",
|
||||
log_level = "TRACE",
|
||||
log_level = "DEBUG",
|
||||
-- log_level = "TRACE",
|
||||
},
|
||||
extensions = {
|
||||
mcphub = {
|
||||
callback = "mcphub.extensions.codecompanion",
|
||||
opts = {
|
||||
show_result_in_chat = true, -- Show the mcp tool result in the chat buffer
|
||||
make_vars = true, -- make chat #variables from MCP server resources
|
||||
make_slash_commands = true, -- make /slash_commands from MCP server prompts
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
init = function()
|
||||
|
||||
126
lua/plugins/codecompanion/fidget-spinner-notify.lua
Normal file
126
lua/plugins/codecompanion/fidget-spinner-notify.lua
Normal file
@@ -0,0 +1,126 @@
|
||||
local notify = require("notify")
|
||||
local spinner_frames = { "⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏" }
|
||||
local spinner_len = #spinner_frames -- cache spinner length
|
||||
local M = {}
|
||||
local timeout = 2999
|
||||
|
||||
-- Helper function to safely call notify
|
||||
local function safe_notify(msg, level, opts)
|
||||
local ok, res = pcall(notify, msg, level, opts)
|
||||
return ok, res
|
||||
end
|
||||
|
||||
function M:init()
|
||||
local group = vim.api.nvim_create_augroup("CodeCompanionFidgetHooks", {})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "User" }, {
|
||||
pattern = "CodeCompanionRequestStarted",
|
||||
group = group,
|
||||
callback = function(request)
|
||||
local handle = M:create_progress_handle(request)
|
||||
M:store_progress_handle(request.data.id, handle)
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "User" }, {
|
||||
pattern = "CodeCompanionRequestFinished",
|
||||
group = group,
|
||||
callback = function(request)
|
||||
local handle = M:pop_progress_handle(request.data.id)
|
||||
if handle then
|
||||
M:report_exit_status(handle, request)
|
||||
handle:finish()
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
M.handles = {}
|
||||
|
||||
function M:store_progress_handle(id, handle)
|
||||
M.handles[id] = handle
|
||||
end
|
||||
|
||||
function M:pop_progress_handle(id)
|
||||
local handle = M.handles[id]
|
||||
M.handles[id] = nil
|
||||
return handle
|
||||
end
|
||||
|
||||
function M:create_progress_handle(request)
|
||||
local title = " Requesting assistance"
|
||||
.. " ("
|
||||
.. request.data.strategy
|
||||
.. ") from "
|
||||
.. request.data.adapter.formatted_name
|
||||
.. " using "
|
||||
.. request.data.adapter.model
|
||||
local idx = 1
|
||||
local start_time = os.time()
|
||||
local notification_id =
|
||||
notify(spinner_frames[idx] .. " In progress (" .. "0s" .. ")...", "info", { title = title, timeout = false })
|
||||
local handle = { notification_id = notification_id, title = title, finished = false }
|
||||
local timer = vim.loop.new_timer()
|
||||
timer:start(
|
||||
0,
|
||||
100,
|
||||
vim.schedule_wrap(function()
|
||||
if handle.finished then
|
||||
return
|
||||
end -- stop updating if finished
|
||||
idx = idx % spinner_len + 1
|
||||
local elapsed = os.difftime(os.time(), start_time)
|
||||
local opts = { replace = handle.notification_id, title = title, timeout = false }
|
||||
local ok, new_id = safe_notify(spinner_frames[idx] .. " In progress (" .. elapsed .. "s)...", "info", opts)
|
||||
if ok then
|
||||
handle.notification_id = new_id
|
||||
else
|
||||
handle.notification_id = notify(
|
||||
spinner_frames[idx] .. " In progress (" .. elapsed .. "s)...",
|
||||
"info",
|
||||
{ title = title, timeout = false }
|
||||
)
|
||||
end
|
||||
end)
|
||||
)
|
||||
handle.timer = timer
|
||||
handle.finish = function()
|
||||
handle.finished = true -- mark as finished to abort future updates
|
||||
if handle.timer then
|
||||
handle.timer:stop()
|
||||
handle.timer:close()
|
||||
handle.timer = nil
|
||||
end
|
||||
end
|
||||
return handle
|
||||
end
|
||||
|
||||
function M:report_exit_status(handle, request)
|
||||
local title = handle.title
|
||||
or (
|
||||
" Requesting assistance"
|
||||
.. " ("
|
||||
.. request.data.strategy
|
||||
.. ") from "
|
||||
.. request.data.adapter.formatted_name
|
||||
.. " using "
|
||||
.. request.data.adapter.model
|
||||
)
|
||||
local function report(msg, level)
|
||||
local opts = { replace = handle.notification_id, title = title, timeout = timeout }
|
||||
local ok = safe_notify(msg, level, opts)
|
||||
if not ok then
|
||||
notify(msg, level, { title = title, timeout = timeout })
|
||||
end
|
||||
end
|
||||
|
||||
if request.data.status == "success" then
|
||||
report("Completed", "info")
|
||||
elseif request.data.status == "error" then
|
||||
report(" Error", "error")
|
||||
else
|
||||
report(" Cancelled", "warn")
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,14 +1,8 @@
|
||||
local notify = require("notify")
|
||||
local spinner_frames = { "⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏" }
|
||||
local spinner_len = #spinner_frames -- cache spinner length
|
||||
local M = {}
|
||||
local timeout = 2999
|
||||
-- lua/plugins/codecompanion/fidget-spinner.lua
|
||||
|
||||
-- Helper function to safely call notify
|
||||
local function safe_notify(msg, level, opts)
|
||||
local ok, res = pcall(notify, msg, level, opts)
|
||||
return ok, res
|
||||
end
|
||||
local progress = require("fidget.progress")
|
||||
|
||||
local M = {}
|
||||
|
||||
function M:init()
|
||||
local group = vim.api.nvim_create_augroup("CodeCompanionFidgetHooks", {})
|
||||
@@ -48,72 +42,31 @@ function M:pop_progress_handle(id)
|
||||
end
|
||||
|
||||
function M:create_progress_handle(request)
|
||||
local title = " Requesting assistance"
|
||||
.. " ("
|
||||
.. request.data.strategy
|
||||
.. ") from "
|
||||
.. request.data.adapter.formatted_name
|
||||
.. " using "
|
||||
.. request.data.adapter.model
|
||||
local idx = 1
|
||||
local notification_id = notify(spinner_frames[idx] .. " In progress...", "info", { title = title, timeout = false })
|
||||
local handle = { notification_id = notification_id, title = title, finished = false }
|
||||
local timer = vim.loop.new_timer()
|
||||
timer:start(
|
||||
0,
|
||||
100,
|
||||
vim.schedule_wrap(function()
|
||||
if handle.finished then
|
||||
return
|
||||
end -- stop updating if finished
|
||||
idx = idx % spinner_len + 1
|
||||
local opts = { replace = handle.notification_id, title = title, timeout = false }
|
||||
local ok, new_id = safe_notify(spinner_frames[idx] .. " In progress...", "info", opts)
|
||||
if ok then
|
||||
handle.notification_id = new_id
|
||||
else
|
||||
handle.notification_id =
|
||||
notify(spinner_frames[idx] .. " In progress...", "info", { title = title, timeout = false })
|
||||
end
|
||||
end)
|
||||
)
|
||||
handle.timer = timer
|
||||
handle.finish = function()
|
||||
handle.finished = true -- mark as finished to abort future updates
|
||||
if handle.timer then
|
||||
handle.timer:stop()
|
||||
handle.timer:close()
|
||||
handle.timer = nil
|
||||
end
|
||||
return progress.handle.create({
|
||||
title = " Requesting assistance (" .. request.data.strategy .. ")",
|
||||
message = "In progress...",
|
||||
lsp_client = {
|
||||
name = M:llm_role_title(request.data.adapter),
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
function M:llm_role_title(adapter)
|
||||
local parts = {}
|
||||
table.insert(parts, adapter.formatted_name)
|
||||
if adapter.model and adapter.model ~= "" then
|
||||
table.insert(parts, "(" .. adapter.model .. ")")
|
||||
end
|
||||
return handle
|
||||
return table.concat(parts, " ")
|
||||
end
|
||||
|
||||
function M:report_exit_status(handle, request)
|
||||
local title = handle.title
|
||||
or (
|
||||
" Requesting assistance"
|
||||
.. " ("
|
||||
.. request.data.strategy
|
||||
.. ") from "
|
||||
.. request.data.adapter.formatted_name
|
||||
.. " using "
|
||||
.. request.data.adapter.model
|
||||
)
|
||||
local function report(msg, level)
|
||||
local opts = { replace = handle.notification_id, title = title, timeout = timeout }
|
||||
local ok = safe_notify(msg, level, opts)
|
||||
if not ok then
|
||||
notify(msg, level, { title = title, timeout = timeout })
|
||||
end
|
||||
end
|
||||
|
||||
if request.data.status == "success" then
|
||||
report("Completed", "info")
|
||||
handle.message = "Completed"
|
||||
elseif request.data.status == "error" then
|
||||
report(" Error", "error")
|
||||
handle.message = " Error"
|
||||
else
|
||||
report(" Cancelled", "warn")
|
||||
handle.message = " Cancelled"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
4
lua/plugins/conform.lua
Normal file
4
lua/plugins/conform.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
return {
|
||||
"stevearc/conform.nvim",
|
||||
opts = {},
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
return {
|
||||
"https://git.sr.ht/~whynothugo/lsp_lines.nvim",
|
||||
config = function()
|
||||
-- lsp_lines
|
||||
vim.diagnostic.config({ virtual_text = false })
|
||||
-- --
|
||||
vim.keymap.set("", "<Leader>tl", require("lsp_lines").toggle, { desc = "Toggle lsp_lines" })
|
||||
end,
|
||||
}
|
||||
@@ -5,9 +5,10 @@ return {
|
||||
vim.notify = require("notify")
|
||||
local servers = {
|
||||
"bashls",
|
||||
"jedi_language_server",
|
||||
-- "jedi_language_server",
|
||||
"basedpyright",
|
||||
"jsonls",
|
||||
"yamlls",
|
||||
-- "yamlls",
|
||||
"vimls",
|
||||
"dotls",
|
||||
"dockerls",
|
||||
@@ -18,28 +19,38 @@ return {
|
||||
"ts_ls",
|
||||
"angularls",
|
||||
"ansiblels",
|
||||
"docker_compose_language_service",
|
||||
"golangci_lint_ls",
|
||||
"gopls",
|
||||
}
|
||||
-- Define the highlight color for float border
|
||||
vim.api.nvim_set_hl(0, "FloatBorder", { fg = "#89b4fa", bold = true })
|
||||
local border = {
|
||||
{ "╭", "FloatBorder" },
|
||||
{ "─", "FloatBorder" },
|
||||
{ "╮", "FloatBorder" },
|
||||
{ "│", "FloatBorder" },
|
||||
{ "╯", "FloatBorder" },
|
||||
{ "─", "FloatBorder" },
|
||||
{ "╰", "FloatBorder" },
|
||||
{ "│", "FloatBorder" },
|
||||
}
|
||||
|
||||
for _, lsp in ipairs(servers) do
|
||||
if lsp == "lua_ls" then
|
||||
lspconfig[lsp].setup({
|
||||
-- on_attach = require("lsp-format").on_attach,
|
||||
on_attach = function()
|
||||
vim.notify("Lua LSP attached", nil, { title = "LSP" })
|
||||
end,
|
||||
vim.lsp.enable(lsp)
|
||||
vim.lsp.config("lua_ls", {
|
||||
on_init = function(client)
|
||||
if client.workspace_folders then
|
||||
local path = client.workspace_folders[1].name
|
||||
if
|
||||
path ~= vim.fn.stdpath("config")
|
||||
and (
|
||||
vim.loop.fs_stat(path .. "/.luarc.json")
|
||||
or vim.loop.fs_stat(path .. "/.luarc.jsonc")
|
||||
)
|
||||
and (vim.uv.fs_stat(path .. "/.luarc.json") or vim.uv.fs_stat(path .. "/.luarc.jsonc"))
|
||||
then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using
|
||||
@@ -52,7 +63,7 @@ return {
|
||||
library = {
|
||||
vim.env.VIMRUNTIME,
|
||||
-- Depending on the usage, you might want to add additional paths here.
|
||||
-- "${3rd}/luv/library"
|
||||
-- "${3rd}/luv/library",
|
||||
-- "${3rd}/busted/library",
|
||||
},
|
||||
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower and will cause issues when working on your own configuration (see https://github.com/neovim/nvim-lspconfig/issues/3189)
|
||||
@@ -60,17 +71,36 @@ return {
|
||||
},
|
||||
})
|
||||
end,
|
||||
callSnippet = "Replace",
|
||||
settings = {
|
||||
Lua = {},
|
||||
},
|
||||
handlers = {},
|
||||
})
|
||||
elseif lsp == "basedpyright" then
|
||||
vim.lsp.enable(lsp)
|
||||
vim.lsp.config(lsp, {
|
||||
analysis = {
|
||||
autoSearchPaths = true,
|
||||
diagnosticMode = "openFilesOnly",
|
||||
useLibraryCodeForTypes = true,
|
||||
},
|
||||
diagnosticMode = "openFilesOnly",
|
||||
inlayHints = {
|
||||
callArgumentNames = true,
|
||||
},
|
||||
})
|
||||
else
|
||||
lspconfig[lsp].setup({
|
||||
on_attach = function()
|
||||
vim.notify(lsp .. " LSP attached", nil, { title = "LSP" })
|
||||
end,
|
||||
})
|
||||
vim.lsp.enable(lsp)
|
||||
-- vim.lsp.config(lsp, {
|
||||
-- handlers = {
|
||||
-- UNNSUUPPORTED
|
||||
-- ["textDocument/signatureHelp"] = vim.lsp.with(
|
||||
-- vim.lsp.handlers.signature_help,
|
||||
-- { border = border }
|
||||
-- ),
|
||||
-- ["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border }),
|
||||
-- },
|
||||
-- })
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
@@ -1,54 +1,6 @@
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
config = function()
|
||||
local M = require("lualine.component"):extend()
|
||||
|
||||
M.processing = false
|
||||
M.spinner_index = 1
|
||||
|
||||
local spinner_symbols = {
|
||||
"⠋",
|
||||
"⠙",
|
||||
"⠹",
|
||||
"⠸",
|
||||
"⠼",
|
||||
"⠴",
|
||||
"⠦",
|
||||
"⠧",
|
||||
"⠇",
|
||||
"⠏",
|
||||
}
|
||||
local spinner_symbols_len = 10
|
||||
|
||||
-- Initializer
|
||||
function M:init(options)
|
||||
M.super.init(self, options)
|
||||
|
||||
local group = vim.api.nvim_create_augroup("CodeCompanionHooks", {})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "User" }, {
|
||||
pattern = "CodeCompanionRequest*",
|
||||
group = group,
|
||||
callback = function(request)
|
||||
if request.match == "CodeCompanionRequestStarted" then
|
||||
self.processing = true
|
||||
elseif request.match == "CodeCompanionRequestFinished" then
|
||||
self.processing = false
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- Function that runs every time statusline is updated
|
||||
function M:update_status()
|
||||
if self.processing then
|
||||
self.spinner_index = (self.spinner_index % spinner_symbols_len) + 1
|
||||
return spinner_symbols[self.spinner_index]
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
@@ -66,8 +18,9 @@ return {
|
||||
lualine_b = { "branch", "diff" },
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = {
|
||||
M,
|
||||
{
|
||||
"seachcount",
|
||||
{ require("mcphub.extensions.lualine") },
|
||||
"copilot",
|
||||
symbols = {
|
||||
status = {
|
||||
@@ -130,7 +83,7 @@ return {
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {},
|
||||
extensions = { "quickfix", "fzf", "nvim-tree", "symbols-outline", "fugitive" },
|
||||
extensions = { "quickfix", "fzf", "nvim-tree", "symbols-outline", "fugitive", "toggleterm", "man" },
|
||||
})
|
||||
end,
|
||||
depends = { "kyazdani42/nvim-web-devicons" },
|
||||
|
||||
51
lua/plugins/mcphub.lua
Normal file
51
lua/plugins/mcphub.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
return {
|
||||
"ravitemer/mcphub.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
cmd = "MCPHub",
|
||||
build = "bundled_build.lua", -- Bundles mcp-hub locally
|
||||
config = function()
|
||||
vim.notify = require("notify")
|
||||
require("mcphub").setup({
|
||||
use_bundled_binary = true, -- Use local binary
|
||||
port = 37373, -- Port for MCP Hub Express API
|
||||
config = vim.fn.expand("~/.config/mcphub/servers.json"), -- Config file path
|
||||
native_servers = {}, -- add your native servers here
|
||||
auto_approve = true,
|
||||
extensions = {
|
||||
avante = {},
|
||||
codecompanion = {
|
||||
show_result_in_chat = true, -- Show tool results in chat
|
||||
make_vars = true, -- Create chat variables from resources
|
||||
make_slash_commands = true, -- make /slash_commands from MCP server prompts
|
||||
},
|
||||
},
|
||||
|
||||
-- UI configuration
|
||||
ui = {
|
||||
window = {
|
||||
width = 0.8, -- Window width (0-1 ratio)
|
||||
height = 0.8, -- Window height (0-1 ratio)
|
||||
border = "rounded", -- Window border style
|
||||
relative = "editor", -- Window positioning
|
||||
zindex = 50, -- Window stack order
|
||||
},
|
||||
},
|
||||
|
||||
-- Event callbacks
|
||||
on_ready = function(hub) end, -- Called when hub is ready
|
||||
on_error = function(err)
|
||||
vim.notify(err, "ERROR")
|
||||
end, -- Called on errors
|
||||
|
||||
-- Logging configuration
|
||||
log = {
|
||||
level = vim.log.levels.WARN, -- Minimum log level
|
||||
to_file = false, -- Enable file logging
|
||||
file_path = nil, -- Custom log file path
|
||||
prefix = "MCPHub", -- Log message prefix
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
@@ -48,6 +48,39 @@ return {
|
||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||
lsp_doc_border = true, -- add a border to hover docs and signature help
|
||||
},
|
||||
cmdline = {
|
||||
enabled = true, -- enables the Noice cmdline UI
|
||||
view = "cmdline_popup", -- view for rendering the cmdline. Change to `cmdline` to get a classic cmdline at the bottom
|
||||
opts = {}, -- global options for the cmdline. See section on views
|
||||
---@type table<string, CmdlineFormat>
|
||||
format = {
|
||||
-- conceal: (default=true) This will hide the text in the cmdline that matches the pattern.
|
||||
-- view: (default is cmdline view)
|
||||
-- opts: any options passed to the view
|
||||
-- icon_hl_group: optional hl_group for the icon
|
||||
-- title: set to anything or empty string to hide
|
||||
cmdline = { pattern = "^:", icon = "", lang = "vim" },
|
||||
search_down = { kind = "search", pattern = "^/", icon = " ", lang = "regex" },
|
||||
search_up = { kind = "search", pattern = "^%?", icon = " ", lang = "regex" },
|
||||
filter = { pattern = "^:%s*!", icon = "$", lang = "bash" },
|
||||
lua = { pattern = { "^:%s*lua%s+", "^:%s*lua%s*=%s*", "^:%s*=%s*" }, icon = "", lang = "lua" },
|
||||
help = { pattern = "^:%s*he?l?p?%s+", icon = "" },
|
||||
input = { view = "cmdline_input", icon = " " }, -- Used by input()
|
||||
-- lua = false, -- to disable a format, set to `false`
|
||||
},
|
||||
},
|
||||
views = {
|
||||
cmdline_popup = {
|
||||
border = {
|
||||
style = "none",
|
||||
padding = { 0, 0 },
|
||||
},
|
||||
filter_options = {},
|
||||
win_options = {
|
||||
winhighlight = "NormalFloat:NormalFloat,FloatBorder:FloatBorder",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
|
||||
|
||||
@@ -1,65 +1,73 @@
|
||||
return {
|
||||
"nvimtools/none-ls.nvim",
|
||||
config = function()
|
||||
local null_ls = require("null-ls")
|
||||
local helpers = require("null-ls.helpers")
|
||||
-- syncronous formatting
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
"nvimtools/none-ls.nvim",
|
||||
config = function()
|
||||
local null_ls = require("null-ls")
|
||||
local helpers = require("null-ls.helpers")
|
||||
-- syncronous formatting
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
|
||||
-- null_ls.setup({
|
||||
-- on_attach = function(client)
|
||||
-- if client.supports_method "textDocument/formatting" then
|
||||
-- vim.cmd([[
|
||||
-- augroup LspFormatting
|
||||
-- autocmd! * <buffer>
|
||||
-- autocmd BufWritePre <buffer> lua vim.lsp.buf.format()
|
||||
-- augroup END
|
||||
-- ]])
|
||||
-- end
|
||||
-- end,
|
||||
-- })
|
||||
-- you can reuse a shared lspconfig on_attach callback here
|
||||
-- null_ls.setup({
|
||||
-- on_attach = function(client)
|
||||
-- if client.supports_method "textDocument/formatting" then
|
||||
-- vim.cmd([[
|
||||
-- augroup LspFormatting
|
||||
-- autocmd! * <buffer>
|
||||
-- autocmd BufWritePre <buffer> lua vim.lsp.buf.format()
|
||||
-- augroup END
|
||||
-- ]])
|
||||
-- end
|
||||
-- end,
|
||||
-- })
|
||||
-- you can reuse a shared lspconfig on_attach callback here
|
||||
|
||||
|
||||
require('null-ls').setup({
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
-- on 0.8, you should use vim.lsp.buf.format({ bufnr = bufnr }) instead
|
||||
-- on later neovim version, you should use vim.lsp.buf.format({ async = false }) instead
|
||||
-- vim.lsp.buf.formatting_sync()
|
||||
vim.lsp.buf.format({
|
||||
async = false,
|
||||
bufnr = bufnr,
|
||||
filter = function(client)
|
||||
return client.name == "null-ls"
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
sources = {
|
||||
null_ls.builtins.completion.luasnip,
|
||||
null_ls.builtins.formatting.black,
|
||||
null_ls.builtins.formatting.isort,
|
||||
null_ls.builtins.diagnostics.mypy,
|
||||
null_ls.builtins.diagnostics.markdownlint,
|
||||
null_ls.builtins.diagnostics.pylint,
|
||||
-- null_ls.builtins.diagnostics.pydoclint,
|
||||
null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.formatting.markdownlint,
|
||||
null_ls.builtins.formatting.prettier, -- handled by lsp server
|
||||
null_ls.builtins.formatting.shfmt.with({
|
||||
filetypes = { "sh", "bash" },
|
||||
extra_args = { "-i", "0", "-ci", "-sr" },
|
||||
}),
|
||||
-- null_ls.builtins.diagnostics.actionlint,
|
||||
},
|
||||
})
|
||||
end
|
||||
require("null-ls").setup({
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
-- on 0.8, you should use vim.lsp.buf.format({ bufnr = bufnr }) instead
|
||||
-- on later neovim version, you should use vim.lsp.buf.format({ async = false }) instead
|
||||
-- vim.lsp.buf.formatting_sync()
|
||||
vim.lsp.buf.format({
|
||||
async = false,
|
||||
bufnr = bufnr,
|
||||
filter = function(client)
|
||||
return client.name == "null-ls"
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
sources = {
|
||||
null_ls.builtins.completion.luasnip,
|
||||
null_ls.builtins.formatting.black,
|
||||
null_ls.builtins.formatting.isort,
|
||||
null_ls.builtins.diagnostics.mypy,
|
||||
null_ls.builtins.diagnostics.markdownlint,
|
||||
null_ls.builtins.diagnostics.pylint,
|
||||
-- null_ls.builtins.diagnostics.pydocstyle.with({
|
||||
-- extra_arags = { "--config=$ROOT/setup.cfg" },
|
||||
-- }),
|
||||
-- null_ls.builtins.diagnostics.pydoclint,
|
||||
null_ls.builtins.formatting.stylua,
|
||||
-- null_ls.builtins.formatting.stylua.with({
|
||||
-- extra_args = { '--config-path', vim.fn.expand('~/.config/stylua.toml') },
|
||||
-- }),
|
||||
null_ls.builtins.formatting.markdownlint,
|
||||
null_ls.builtins.formatting.prettier, -- handled by lsp server
|
||||
null_ls.builtins.formatting.shfmt.with({
|
||||
filetypes = { "sh", "bash" },
|
||||
extra_args = { "-i", "0", "-ci", "-sr" },
|
||||
}),
|
||||
null_ls.builtins.formatting.gofmt,
|
||||
null_ls.builtins.formatting.goimports,
|
||||
null_ls.builtins.formatting.goimports_reviser,
|
||||
-- null_ls.builtins.diagnostics.actionlint,
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
1
lua/plugins/nui.lua
Normal file
1
lua/plugins/nui.lua
Normal file
@@ -0,0 +1 @@
|
||||
return { "MunifTanjim/nui.nvim" }
|
||||
@@ -1,14 +1,34 @@
|
||||
return {
|
||||
"mfussenegger/nvim-lint",
|
||||
config = function()
|
||||
require("lint").linters_by_ft = {
|
||||
local lint = require("lint")
|
||||
lint.linters_by_ft = {
|
||||
markdown = { "markdownlint" },
|
||||
lua = { "luacheck" },
|
||||
py = { "pylint", "pydocstyle", "pycodestyle", "mypy" },
|
||||
py = { "flake8", "pylint", "pydocstyle", "pycodestyle", "mypy" },
|
||||
sh = { "shellcheck" },
|
||||
json = { "jsonlint" },
|
||||
yaml = { "yamllint" },
|
||||
vim = { "vint" },
|
||||
go = { "golangcilint" },
|
||||
}
|
||||
local shellcheck = require("lint").linters.shellcheck
|
||||
shellcheck.args = {
|
||||
"-s",
|
||||
"bash",
|
||||
"-o",
|
||||
"all",
|
||||
"-e",
|
||||
"2250",
|
||||
}
|
||||
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
|
||||
group = lint_augroup,
|
||||
callback = function()
|
||||
lint.try_lint()
|
||||
end,
|
||||
})
|
||||
end,
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
}
|
||||
|
||||
1
lua/plugins/nvim-treesitter-context.lua
Normal file
1
lua/plugins/nvim-treesitter-context.lua
Normal file
@@ -0,0 +1 @@
|
||||
return { "nvim-treesitter/nvim-treesitter-context" }
|
||||
@@ -1,6 +1,7 @@
|
||||
return {
|
||||
"MeanderingProgrammer/render-markdown.nvim",
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter", "echasnovski/mini.nvim" }, -- if you use the mini.nvim suite
|
||||
ft = { "markdown", "codecompanion", "lsp" },
|
||||
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.icons' }, -- if you use standalone mini plugins
|
||||
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons
|
||||
---@module 'render-markdown'
|
||||
|
||||
102
lua/utils/hyprland/lsp/init.lua
Normal file
102
lua/utils/hyprland/lsp/init.lua
Normal file
@@ -0,0 +1,102 @@
|
||||
vim.notify = require("notify")
|
||||
|
||||
local client_notifs = {}
|
||||
|
||||
local function get_notif_data(client_id, token)
|
||||
if not client_notifs[client_id] then
|
||||
client_notifs[client_id] = {}
|
||||
end
|
||||
|
||||
if not client_notifs[client_id][token] then
|
||||
client_notifs[client_id][token] = {}
|
||||
end
|
||||
|
||||
return client_notifs[client_id][token]
|
||||
end
|
||||
|
||||
local spinner_frames = { "⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷" }
|
||||
|
||||
local function update_spinner(client_id, token)
|
||||
local notif_data = get_notif_data(client_id, token)
|
||||
|
||||
if notif_data.spinner then
|
||||
local new_spinner = (notif_data.spinner + 1) % #spinner_frames
|
||||
notif_data.spinner = new_spinner
|
||||
|
||||
notif_data.notification = vim.notify("", nil, {
|
||||
hide_from_history = true,
|
||||
icon = spinner_frames[new_spinner],
|
||||
replace = notif_data.notification,
|
||||
})
|
||||
|
||||
vim.defer_fn(function()
|
||||
update_spinner(client_id, token)
|
||||
end, 100)
|
||||
end
|
||||
end
|
||||
|
||||
local function format_title(title, client_name)
|
||||
return client_name .. (#title > 0 and ": " .. title or "")
|
||||
end
|
||||
|
||||
local function format_message(message, percentage)
|
||||
return (percentage and percentage .. "%\t" or "") .. (message or "")
|
||||
end
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
||||
pattern = { "*.hl", "hypr*.conf" },
|
||||
callback = function(event)
|
||||
-- print(string.format("starting hyprls for %s", vim.inspect(event)))
|
||||
vim.lsp.start({
|
||||
name = "hyprlang",
|
||||
cmd = { "hyprls" },
|
||||
root_dir = vim.fn.getcwd(),
|
||||
on_attach = function()
|
||||
vim.notify("Hyprlang LSP attached", "info")
|
||||
end,
|
||||
on_init = function()
|
||||
vim.notify("Hyprlang LSP initialized", "info")
|
||||
end,
|
||||
handlers = {
|
||||
["$/progress"] = function(_, result, ctx)
|
||||
local client_id = ctx.client_id
|
||||
|
||||
local val = result.value
|
||||
|
||||
if not val.kind then
|
||||
return
|
||||
end
|
||||
|
||||
local notif_data = get_notif_data(client_id, result.token)
|
||||
|
||||
if val.kind == "begin" then
|
||||
local message = format_message(val.message, val.percentage)
|
||||
|
||||
notif_data.notification = vim.notify(message, "info", {
|
||||
title = format_title(val.title, vim.lsp.get_client_by_id(client_id).name),
|
||||
icon = spinner_frames[1],
|
||||
timeout = false,
|
||||
hide_from_history = false,
|
||||
})
|
||||
|
||||
notif_data.spinner = 1
|
||||
update_spinner(client_id, result.token)
|
||||
elseif val.kind == "report" and notif_data then
|
||||
notif_data.notification = vim.notify(format_message(val.message, val.percentage), "info", {
|
||||
replace = notif_data.notification,
|
||||
hide_from_history = false,
|
||||
})
|
||||
elseif val.kind == "end" and notif_data then
|
||||
notif_data.notification =
|
||||
vim.notify(val.message and format_message(val.message) or "Complete", "info", {
|
||||
icon = "",
|
||||
replace = notif_data.notification,
|
||||
timeout = 3000,
|
||||
})
|
||||
|
||||
notif_data.spinner = nil
|
||||
end
|
||||
end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
@@ -10,7 +10,6 @@ vim.notify = require("notify")
|
||||
---@usage addToWhichKey(mappings, group)
|
||||
---@example addToWhichKey({{key = "n", cmd = "next", mode = "n", desc = "Next Line", group = "Navigation"}, {key = "t", group = "example"})
|
||||
function M.addToWhichKey(mappings, group)
|
||||
local wk_mappings = {}
|
||||
if group then
|
||||
whichkey.add({ group.key, group = group.group })
|
||||
end
|
||||
@@ -21,6 +20,7 @@ function M.addToWhichKey(mappings, group)
|
||||
return
|
||||
end
|
||||
for _, mapping in ipairs(mappings) do
|
||||
local wk_mappings = {}
|
||||
if not mapping.key or mapping.key == "" then
|
||||
vim.notify("Error: Key is empty or nil", "error")
|
||||
return
|
||||
@@ -38,9 +38,11 @@ function M.addToWhichKey(mappings, group)
|
||||
|
||||
wk_mappings[1] = mapping.key
|
||||
wk_mappings[2] = mapping.cmd
|
||||
wk_mappings.mode = mapping.mode
|
||||
wk_mappings.desc = mapping.desc or "No Description"
|
||||
wk_mappings.group = mapping.group or "No Group"
|
||||
wk_mappings.mode = mapping.mode or "n"
|
||||
wk_mappings.desc = mapping.desc
|
||||
if mapping.group then
|
||||
wk_mappings.group = mapping.group
|
||||
end
|
||||
whichkey.add(wk_mappings)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,3 +10,6 @@ parser_config.hyprlang = {
|
||||
},
|
||||
filetype = "conf", -- if filetype does not match the parser name
|
||||
}
|
||||
vim.filetype.add({
|
||||
pattern = { [".*/hypr/.*%.conf"] = "hyprlang" },
|
||||
})
|
||||
Reference in New Issue
Block a user