Compare commits

..

43 Commits

Author SHA1 Message Date
kyasuda
f4f8b345dd Merge branch 'master' of gitea.suda.codes:sudacode/nvim 2025-07-30 16:12:48 -07:00
kyasuda
1aea2cfc68 fix bug in keymap converter for whichkey 2025-07-30 16:12:35 -07:00
9fa8ac630c update 2025-05-03 22:22:30 -07:00
3d6e9d215e update 2025-05-02 21:52:12 -07:00
97e81424fa update 2025-05-02 21:51:10 -07:00
kyasuda
ab352ba2a9 update lsp diagnostics to use internal functions 2025-05-02 10:14:59 -07:00
a8f250f96b update plugins 2025-05-01 21:18:16 -07:00
95089a5a57 update 2025-04-30 18:34:59 -07:00
9a7981eaba add mcphub 2025-04-13 20:27:07 -07:00
78b8e47080 fix lspconfig 2025-04-13 03:57:11 -07:00
dfab17ce27 update 2025-04-13 00:30:44 -07:00
8a151a6430 update lsp config to use vim.lsp 2025-04-13 00:30:16 -07:00
ebbe37bece fix command 2025-04-10 22:17:35 -07:00
211a543b71 update to use file 2025-04-10 22:01:03 -07:00
79556ce727 roll key 2025-04-10 22:00:00 -07:00
cc288092b8 Merge branch 'master' of gitea.suda.codes:sudacode/nvim 2025-04-10 21:58:03 -07:00
3038404b0a update 2025-04-10 21:57:59 -07:00
ab2e588899 add openrouter and set as default 2025-04-10 17:55:18 -07:00
b4789ac055 update 2025-02-26 14:55:20 -08:00
e5a4785c0c update codecompanion 2025-02-25 02:22:26 -08:00
2a2ceff819 update 2025-02-25 00:45:48 -08:00
73df9af394 add claude-3.7 2025-02-24 19:00:13 -08:00
283b2540ee add local llama.cpp 2025-02-23 22:03:10 -08:00
c9631baf48 update 2025-02-21 14:05:23 -08:00
9c292f0fa8 add rendering to lsp 2025-02-21 03:22:44 -08:00
4ec292dde6 add render markdown to codecompanion 2025-02-21 03:15:56 -08:00
e216dc057c updates 2025-02-21 03:02:01 -08:00
9bae49fa30 update 2025-02-20 19:20:58 -08:00
d3ace6bbc8 update keymaps 2025-02-20 19:20:54 -08:00
b29d79a356 fix codecompanion fidget spinner 2025-02-20 19:20:49 -08:00
dc29310cf1 add hyprlang stuff 2025-02-20 04:18:32 -08:00
f4e0406181 bump versions and fix notify clear 2025-02-19 18:27:42 -08:00
611be5f360 updates 2025-02-19 02:24:24 -08:00
4f88084419 update nvimtree keymap 2025-02-16 22:21:01 -08:00
0ec4557f5d Merge branch 'master' of gitea.suda.codes:sudacode/nvim 2025-02-16 20:11:11 -08:00
9f6f878fb7 update 2025-02-16 20:11:07 -08:00
8742b343b3 remove unnecessary code 2025-02-16 19:15:41 -08:00
51cf93a90e fix fidget spinner notification not closing 2025-02-16 19:15:26 -08:00
19567ee2b5 enable color for copilot lualine 2025-02-16 16:55:19 -08:00
5cc63de54c bump codecompanion version 2025-02-16 16:05:19 -08:00
03701f3616 fix cmp and codecompanion
- remove blink dependency
- set up telescope as default provider for codecompanion slash commands
2025-02-16 14:14:13 -08:00
ef124ea808 update codecompanion fidget spinner 2025-02-16 13:39:54 -08:00
e6e69a5d7c add obsidian nvim 2025-02-16 02:22:25 -08:00
44 changed files with 2271 additions and 915 deletions

2
.gitignore vendored
View File

@@ -2,3 +2,5 @@ plugin
spell
.git
*.old
.repro
test

View File

@@ -1 +1,16 @@
require("core.lazy")
vim.cmd("colorscheme catppuccin")
require("core.keymaps")
-- require("core.lsp-notifications")
require("utils.extensions")
require("utils.telescope_extra").setup()
require("utils.git_paste").setup({
telescope_key = "<leader>pg",
})
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

View File

@@ -1,61 +1,65 @@
{
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
"any-jump.vim": { "branch": "master", "commit": "f95674d9a4251ac02f452d5f1861e4422f4652c7" },
"auto-format.nvim": { "branch": "main", "commit": "1e3c069753d4b0960b351292c1a01af1b122907c" },
"blink.cmp": { "branch": "main", "commit": "cc2f10e9d8b6420324d4743a4d9a428de427e2cf" },
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
"catppuccin": { "branch": "main", "commit": "0b2437bcc12b4021614dc41fcea9d0f136d94063" },
"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": "f1f05fa75dcb6016b2f2af121f1558ebcaf35ef9" },
"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": "8b00147519d6f8353867d5d0b55f587306b0cfb6" },
"goto-preview": { "branch": "main", "commit": "4972fcd01c568c2ae981f3f48182e7832ed544ec" },
"image.nvim": { "branch": "master", "commit": "6ffafab2e98b5bda46bf227055aa84b90add8cdc" },
"indent-blankline.nvim": { "branch": "master", "commit": "e10626f7fcd51ccd56d7ffc00883ba7e0aa28f78" },
"lazy.nvim": { "branch": "main", "commit": "e5e9bf48211a13d9ee6c1077c88327c49c1ab4a0" },
"lazydev.nvim": { "branch": "main", "commit": "a1b78b2ac6f978c72e76ea90ae92a94edf380cfc" },
"lsp_lines.nvim": { "branch": "main", "commit": "a92c755f182b89ea91bd8a6a2227208026f27b4d" },
"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" },
"lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
"lualine.nvim": { "branch": "master", "commit": "f4f791f67e70d378a754d02da068231d2352e5bc" },
"mini.diff": { "branch": "main", "commit": "bc3a7be30fd45ed4961ea90de1d9d04637cdeae6" },
"mini.nvim": { "branch": "main", "commit": "4dd209e4f03bacd46d6d87408b2529a8823112fb" },
"none-ls.nvim": { "branch": "main", "commit": "02f5275d8a5546092f01306f162c00c71d6e0281" },
"nvim-autopairs": { "branch": "master", "commit": "68f0e5c3dab23261a945272032ee6700af86227a" },
"nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" },
"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": "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-lsp-notify": { "branch": "main", "commit": "9541bdde0b84b7a33a24dbc2eccc3df33d4a0cdb" },
"nvim-lspconfig": { "branch": "master", "commit": "7af2c37192deae28d1305ae9e68544f7fb5408e1" },
"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": "38e46a6d7ade5c8718f77b2b9fd98a0f7ab32c1e" },
"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": "e05a9f22f31c088ece3fa5928daf546a015b66ee" },
"telescope-cmdline.nvim": { "branch": "main", "commit": "8b05928ac1b9f2b772cedde891faa6669b0ec59a" },
"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.nvim": { "branch": "master", "commit": "78857db9e8d819d3cc1a9a7bdc1d39d127a36495" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"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" }
}

View File

@@ -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)

View File

@@ -1,241 +1,557 @@
local map = vim.keymap.set
local Terminal = require("toggleterm.terminal").Terminal
local notify = require("notify")
local function term_factory(cfg)
cfg["on_stderr"] = function(_, job, data, name)
notify(name .. " encountered an error on job: " .. job .. "\nData: " .. data)
end
cfg["on_stdout"] = function(_, job, data, name)
notify(name .. " output for job" .. job .. "\nData: " .. data)
end
return Terminal:new(cfg)
end
local function term_toggle(term)
term:toggle()
end
local term = require("utils.terminal")
local map_from_table = require("utils.keymaps.converters.from_table").set_keybindings
local add_to_whichkey = require("utils.keymaps.converters.whichkey").addToWhichKey
local term_factory = term.term_factory
local term_toggle = term.term_toggle
local opts = { silent = true, noremap = true }
local notsilent = { silent = false, noremap = true }
local function ReloadConfig()
dofile(vim.fn.stdpath("config") .. "/init.lua")
dofile(vim.fn.stdpath("config") .. "/lua/core/keymaps.lua")
dofile(vim.fn.stdpath("config") .. "/lua/core/autocmds.lua")
dofile(vim.fn.stdpath("config") .. "/lua/core/options.lua")
dofile(vim.fn.stdpath("config") .. "/lua/core/plugins.lua")
dofile(vim.fn.stdpath("config") .. "/lua/plugins/ui/init.lua")
dofile(vim.fn.stdpath("config") .. "/lua/plugins/ui/toggleterm.lua")
dofile(vim.fn.stdpath("config") .. "/lua/plugins/ai/init.lua")
dofile(vim.fn.stdpath("config") .. "/lua/plugins/lsp/init.lua")
dofile(vim.fn.stdpath("config") .. "/lua/plugins/colorscheme/init.lua")
end
local nosilent = { noremap = true }
-- Leader key
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("PS", ":PackerSync", {})
vim.api.nvim_create_user_command("Reload", ReloadConfig, {})
vim.api.nvim_create_user_command("Config", "edit ~/.config/nvim", {})
vim.api.nvim_create_user_command("Plugins", "edit ~/.config/nvim/lua/core/plugins.lua", {})
vim.api.nvim_create_user_command("Keymaps", "edit ~/.config/nvim/lua/core/keymaps.lua", {})
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
map("n", "<C-u>", "<C-u>zz", opts)
map("n", "n", "nzzzv", opts)
map("n", "N", "Nzzzv", opts)
map("x", "<leader>p", '"_dP', opts) -- paste without yanking
map("v", "<", "<gv", opts) -- reselect after indent
map("v", ">", ">gv", opts)
map("v", "J", ":m '>+1<CR>gv=gv", opts) -- move lines
map("v", "K", ":m '<-2<CR>gv=gv", opts)
-- {{{ Basic Mappings
local basic_mappings = {
{ key = "<C-u>", cmd = "<C-u>zz", desc = "Scroll up and center", mode = "n" },
{ key = "n", cmd = "nzzzv", desc = "Next search result and center", mode = "n" },
{ key = "N", cmd = "Nzzzv", desc = "Previous search result and center", mode = "n" },
{ key = "<leader>p", cmd = '"_dP', desc = "Paste without yanking", mode = "x", group = "Paste in place" },
{ key = "<", cmd = "<gv", desc = "Reselect after indent", mode = "v" },
{ key = ">", cmd = ">gv", desc = "Reselect after indent", mode = "v" },
{ key = "J", cmd = ":m '>+1<CR>gv=gv", desc = "Move line down", mode = "v" },
{ key = "K", cmd = ":m '<-2<CR>gv=gv", desc = "Move line up", mode = "v" },
}
--}}}
--{{{ Buffer Navigation 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" },
{ 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" },
}
--}}}
--{{{ Terminal Mappings
local terminal_mappings = {
-- {
-- key = "op",
-- cmd = "<C-\\><C-N>:ToggleTerm name=ipython",
-- desc = "Open IPython",
-- mode = "v",
-- group = "Open",
-- },
-- {
-- key = "oP",
-- cmd = "<C-\\><C-N>:ToggleTerm name=ipython-full",
-- desc = "Open full IPython",
-- mode = "v",
-- group = "Open",
-- },
{
key = "<C-T>",
cmd = ":ToggleTerm name=toggleterm<CR>",
desc = "Toggle terminal",
mode = "n",
},
{
key = "<leader>tt",
cmd = ":ToggleTerm name=toggleterm<CR>",
desc = "Toggle terminal",
mode = "n",
},
{
key = "<leader>tT",
cmd = ":ToggleTerm name=toggleterm-full direction=tab<CR>",
desc = "Toggle full terminal",
mode = "n",
},
{
key = "<leader>ot",
cmd = ":ToggleTerm name=toggleterm<CR>",
desc = "Open terminal",
mode = "n",
},
{
key = "<leader>oT",
cmd = ":ToggleTerm name=toggleterm-full direction=tab<CR>",
desc = "Open full terminal",
mode = "n",
},
{
key = "<leader>ts",
cmd = ":TermSelect<CR>",
desc = "Select terminal",
mode = "n",
},
{
key = "<leader>tv",
cmd = ":ToggleTerm direction=vertical name=toggleterm-vert<CR>",
desc = "Toggle vertical terminal",
mode = "n",
},
{
key = "<leader>th",
cmd = ":ToggleTerm direction=horizontal name=toggleterm-hori<CR>",
desc = "Toggle horizontal terminal",
mode = "n",
},
{
key = "<leader>ov",
cmd = ":ToggleTerm direction=vertical name=toggleterm-vert<CR>",
desc = "Open vertical terminal",
mode = "n",
},
{
key = "<leader>oh",
cmd = ":ToggleTerm direction=horizontal name=toggleterm-hori<CR>",
desc = "Open horizontal terminal",
mode = "n",
},
{
key = "<leader>tf",
cmd = ":ToggleTerm name=toggleterm<CR>",
desc = "Toggle terminal",
mode = "n",
},
{
key = "<leader>-",
cmd = ":ToggleTerm direction='horizontal'<CR>",
desc = "Toggle horizontal terminal",
mode = "n",
},
{
key = "<leader>|",
cmd = ":ToggleTerm direction='vertical'<CR>",
desc = "Toggle vertical terminal",
mode = "n",
},
}
--}}}
-- {{{ LSP Mappings
local lsp_mappings = {
{ mode = "n", key = "gA", cmd = vim.lsp.buf.code_action, group = "Code Action" },
{ mode = "n", key = "gd", cmd = ":Telescope lsp_definitions<CR>", group = "LSP Definitions" },
{ mode = "n", key = "gDc", cmd = ":Telescope lsp_implementations<CR>", group = "LSP Implementations" },
{ mode = "n", key = "gDf", cmd = ":Telescope lsp_definitions<CR>", group = "LSP Definitions" },
{ mode = "n", key = "gF", cmd = ":edit <cfile><CR>", group = "Edit File" },
{ mode = "n", key = "gT", cmd = ":Telescope lsp_type_definitions<CR>", group = "LSP Type Definitions" },
{ mode = "n", key = "gb", cmd = ":Gitsigns blame_line<CR>", group = "Git Blame" },
{ mode = "n", key = "gi", cmd = ":Telescope lsp_implementations<CR>", group = "Telescope Implementations" },
{ mode = "n", key = "gj", cmd = ":Telescope jumplist<CR>", group = "Telescope Jumplist" },
{ mode = "n", key = "gr", cmd = ":Telescope lsp_references<CR>", goup = "LSP References" },
{ mode = "n", key = "gs", cmd = vim.lsp.buf.signature_help },
-- { mode = "n", key = "K", cmd = vim.lsp.buf.hover },
{ mode = "n", key = "<leader>ca", cmd = vim.lsp.buf.code_action, group = "Code" },
{ mode = "n", key = "<leader>ch", cmd = ":lua vim.lsp.buf.signature_help()<CR>", group = "Signature Help" },
{ mode = "n", key = "<leader>cR", cmd = ":lua vim.lsp.buf.rename()<CR>", group = "Rename" },
{ mode = "n", key = "<leader>cr", cmd = ":Telescope lsp_references<CR>", group = "LSP References" },
{ mode = "n", key = "<leader>cs", cmd = ":Telescope lsp_document_symbols<CR>", group = "LsP Document Symbols" },
{ mode = "n", key = "<leader>ct", cmd = ":Telescope lsp_type_definitions<CR>", group = "LSP Definitions" },
{
mode = "n",
key = "<leader>cw",
cmd = ":Telescope lsp_dynamic_workspace_symbols<CR>",
group = "LSP Workspace Symbols",
},
{ mode = "n", key = "<leader>ci", cmd = ":Telescope lsp_implementations<CR>", group = "LSP Implementations" },
{ mode = "n", key = "<leader>cci", cmd = ":Telescope lsp_incoming_calls<CR>", group = "LSP Incoming Calls" },
{ mode = "n", key = "<leader>cco", cmd = ":Telescope lsp_outgoing_calls<CR>", group = "LSP Outgoing Calls" },
{
mode = "n",
key = "<leader>cd",
cmd = ":Telescope diagnostics theme=dropdown layout_config={width=0.8}<CR>",
group = "Telecope Diagnostics",
},
{
mode = "n",
key = "<leader>cDs",
cmd = ":Telescope diagnostics theme=dropdown layout_config={width=0.8}<CR>",
group = "Telecope Diagnostics",
},
{ mode = "n", key = "<leader>cDn", cmd = ":lua vim.diagnostic.goto_next()<CR>", group = "Goto Next Preview" },
{
mode = "n",
key = "<leader>cDp",
cmd = ":lua vim.diagnostic.goto_prev()<CR<CR>",
group = "Goto Previous Preview",
},
{ mode = "n", key = "<leader>cl", cmd = ":lua vim.diagnostic.setloclist()<CR>", group = "Set Loclist" },
}
-- }}}
-- {{{ Buffer navigation
map("n", "<C-J>", ":bnext<CR>", opts)
map("n", "<C-K>", ":bprev<CR>", opts)
map("n", "<leader>bb", ":Telescope buffers<CR>", opts)
map("n", "<leader>bk", ":bdelete<CR>", opts)
map("n", "<leader>bn", ":bnext<CR>", opts)
map("n", "<leader>bp", ":bprev<CR>", opts)
-- {{{ Code Companion Mappings
local code_companion_mappings = {
{ mode = "n", key = "<leader>cp", cmd = ":vert Copilot panel<CR>", group = "Code" },
{ mode = "n", key = "<leader>oc", cmd = ":CodeCompanionChat Toggle<CR>", group = "Open" },
{ mode = "n", key = "<leader>Cc", cmd = ":CodeCompanionChat Toggle<CR>", group = "CodeCompanionChat" },
{ mode = "n", key = "<leader>Ci", cmd = ":CodeCompanion ", group = "Inline CodeCompanion", opts = nosilent },
{ mode = "n", key = "<leader>CT", cmd = ":CodeCompanionChat Toggle<CR>", group = "CodeCompanion Toggle" },
{ mode = "n", key = "<leader>Ca", cmd = ":CodeCompanionActions<CR>", group = "CodeCompanion Actions" },
{ mode = "v", key = "<leader>Cc", cmd = ":CodeCompanionChat Add<CR>", group = "CodeCompanion Add" },
{
mode = "v",
key = "<leader>Ci",
cmd = ":CodeCompanion #buffer ",
group = "CodeCompanion #buffer",
opts = nosilent,
},
{ mode = "v", key = "<leader>Ce", cmd = ":CodeCompanion /explain<CR>", group = "CodeCompanion /explain" },
{ mode = "v", key = "<leader>Cf", cmd = ":CodeCompanion /fix<CR>", group = "CodeCompanion /fix" },
{ mode = "v", key = "<leader>Cl", cmd = ":CodeCompanion /lsp<CR>", group = "CodeCompanion /lsp" },
{ mode = "v", key = "<leader>Ct", cmd = ":CodeCompanion /tests<CR>", group = "CodeCompanion /tests" },
}
-- }}}
--{{{ Terminal mappings
-- {{{ Telescope mappings
local telescope_mappings = {
{
mode = "n",
key = "//",
cmd = ":Telescope current_buffer_fuzzy_find previewer=false<CR>",
"Current buffer fuzzy find",
},
{
mode = "n",
key = "??",
cmd = ":Telescope lsp_document_symbols theme=dropdown layout_config={width=0.5}<CR>",
group = "Lsp document symbols",
},
{
mode = "n",
key = "<leader>fc",
cmd = ':Telescope color_names theme=dropdown layout_config={width=0.45,height=25,prompt_position="bottom"} layout_strategy=vertical<CR>',
group = "Telescope color names",
},
{
mode = "n",
key = "<leader>Tc",
cmd = ":Telescope colorscheme<CR>",
group = "Telescope colorscheme",
},
{
mode = "n",
key = "<leader>TC",
cmd = ':Telescope color_names theme=dropdown layout_config={width=0.45,height=25,prompt_position="bottom"} layout_strategy=vertical<CR>',
group = "Telescope color names",
},
{
mode = "n",
key = "<leader>Tn",
cmd = ":Telescope notify theme=dropdown layout_config={width=0.75}<CR>",
group = "Telescope notify",
},
{
mode = "n",
key = "<leader>TN",
cmd = ":Telescope noice theme=dropdown layout_config={width=0.75}<CR>",
group = "Telescope Noice",
},
{
mode = "n",
key = "<leader>ff",
cmd = ":Telescope find_files find_command=rg,--ignore,--follow,--hidden,--files prompt_prefix=🔍<CR>",
group = "Find files",
},
{ mode = "n", key = "<leader>fg", cmd = ":Telescope live_grep<CR>", group = "Live Grep" },
{
mode = "n",
key = "<leader>Tg",
cmd = ':Telescope glyph theme=dropdown layout_config={width=0.45,height=35,prompt_position="bottom"} layout_strategy=vertical<CR>',
group = "Telescope Glyph",
},
{
mode = "n",
key = "<leader>fG",
cmd = ':Telescope glyph theme=dropdown layout_config={width=0.45,height=35,prompt_position="bottom"} layout_strategy=vertical<CR>',
group = "Glhph",
},
{ mode = "n", key = "<leader>fb", cmd = ":Telescope file_browser<CR>", group = "File browser" },
{
mode = "n",
key = "<leader>fr",
cmd = ":Telescope oldfiles theme=dropdown layout_config={width=0.5}<CR>",
group = "Oldfiles",
},
{
mode = "n",
key = "<leader>hc",
cmd = ":Telescope commands<CR>",
group = "Commands",
},
{
mode = "n",
key = "<leader>hv",
cmd = ":Telescope vim_options<CR>",
group = "Vim options",
},
{
mode = "n",
key = "<leader>hk",
cmd = ":Telescope keymaps<CR>",
group = "Keymaps",
},
{
mode = "n",
key = "<leader>hs",
cmd = ":Telescope spell_suggest<CR>",
group = "Spell suggest",
},
{
mode = "n",
key = "<leader>ht",
cmd = ":Telescope help_tags<CR>",
group = "Help tags",
},
{
mode = "n",
key = "<leader>hm",
cmd = ":Telescope man_pages theme=dropdown layout_config={width=0.75}<CR>",
group = "Man pages",
},
{
mode = "n",
key = "<leader>sf",
cmd = ":Telescope find_files find_command=rg,--ignore,--follow,--hidden,--files prompt_prefix=🔍<CR>",
group = "Search files",
},
{ mode = "n", key = "<leader>sF", cmd = ":Telescope fidget<CR>", group = "Fidget" },
{ mode = "n", key = "<leader>sg", cmd = ":Telescope live_grep<CR>", group = "Live grep" },
{ mode = "n", key = "<leader>sh", cmd = ":Telescope command_history<CR>", group = "Command history" },
{ mode = "n", key = "<leader>sm", cmd = ":Telescope man_pages<CR>", group = "Man pages" },
{ mode = "n", key = "<leader>s/", cmd = ":Telescope search_history<CR>", group = "Search history" },
{ mode = "n", key = "<leader>gc", cmd = ":Telescope git_commits<CR>", group = "Git commits" },
{ mode = "n", key = "<leader>gf", cmd = ":Telescope git_files<CR>", group = "Git files" },
{ mode = "n", key = "<leader>Tr", cmd = ":Telescope reloader<CR>", group = "Telescope reloader" },
}
--}}}
-- {{{ File Explorer Mappings (i guess)
local file_explorer_mappings = {
{ mode = "n", key = "<leader>nt", cmd = ":NvimTreeToggle<CR>" },
{ mode = "n", key = "<leader>nc", cmd = ":lua require('notify').dismiss()<CR>" },
{ mode = "n", key = "<leader>D", cmd = ":Dotenv .env<CR>", group = "Dotenv" },
}
-- }}}
-- {{{ Misc Utilities Mappings
local misc_utilities_mappings = {
{ mode = "n", key = "<leader>x", cmd = "<cmd>!chmod +x %<CR>", group = "Make Executable" },
{ mode = "n", key = "<leader>y", cmd = '"+', group = "System Yank" },
{ mode = "v", key = "<leader>y", cmd = '"+', group = "System Yank" },
{ mode = "n", key = "<leader>sc", cmd = ":nohls<CR>", group = "Search" },
}
-- }}}
-- {{{ Goto Preview Mappings
local goto_preview_mappings = {
{ mode = "n", key = "gpc", cmd = ':lua require("goto-preview").close_all_win()<CR>', group = "Goto Preview" },
{
mode = "n",
key = "gpd",
cmd = ':lua require("goto-preview").goto_preview_definition()<CR>',
group = "Goto Preview",
},
{
mode = "n",
key = "gpi",
cmd = ':lua require("goto-preview").goto_preview_implementation()<CR>',
group = "Goto Preview",
},
}
-- }}}
-- {{{ Workspace Management Mappings
local workspace_management_mappings = {
{ mode = "n", key = "<leader>wa", cmd = vim.lsp.buf.add_workspace_folder },
{ mode = "n", key = "<leader>wr", cmd = vim.lsp.buf.remove_workspace_folder },
{
mode = "n",
key = "<leader>wl",
cmd = function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end,
},
}
-- }}}
-- {{{ Noice Mappings
local noice_mappings = {
{ mode = "n", key = "<leader>Nh", cmd = ":Noice telescope<CR>", group = "Noice" },
{ mode = "n", key = "<leader>Nl", cmd = ":Noice last<CR>", group = "Noice" },
{ mode = "n", key = "<leader>Nd", cmd = ":Noice dismiss<CR>", group = "Noice" },
{ mode = "n", key = "<leader>Ne", cmd = ":Noice errors<CR>", group = "Noice" },
{ mode = "n", key = "<leader>Ns", cmd = ":Noice stats<CR>", group = "Noice" },
}
-- }}}
-- {{{ ODIS Mappings
local odis_mappings = {
{
mode = "n",
key = "<leader>dv",
cmd = ':lua require("odis").show_documentation("vsplit")<CR>',
group = "Vertical split",
},
{ mode = "n", key = "<leader>dh", cmd = ':lua require("odis").show_documentation("split")<CR>', group = "Split" },
{ mode = "n", key = "<leader>db", cmd = ':lua require("odis").show_documentation("buffer")<CR>', group = "Buffer" },
{ mode = "n", key = "<leader>dt", cmd = ':lua require("odis").show_documentation("tab")<CR>', group = "Tab" },
{ mode = "n", key = "<leader>df", cmd = ':lua require("odis").show_documentation("float")<CR>', group = "Float" },
}
-- }}}
-- {{{ Diffview Mappings
local diffview_mappings = {
{
mode = "n",
key = "<leader>gdo",
cmd = ":DiffviewOpen<CR>",
group = "DiffviewOpen",
},
{
mode = "n",
key = "<leader>gdf",
cmd = ":DiffviewFileHistory %<CR>",
group = "Git",
},
{
mode = "n",
key = "<leader>gdh",
cmd = ":DiffviewHistory<CR>",
group = "Git",
},
{
mode = "n",
key = "<leader>gdc",
cmd = ":DiffviewClose<CR>",
group = "Git",
},
{
mode = "n",
key = "<leader>gdt",
cmd = ":DiffviewToggleFiles<CR>",
group = "Git",
desc = "Toggle files view",
},
{
mode = "n",
key = "<leader>gdr",
cmd = ":DiffviewRefresh<CR>",
desc = "Refresh diffview",
group = "Git",
},
}
-- }}}
--{{{ Custom Terminals
local programs_map = {
gg = { cmd = "lazygit", display_name = "lazygit", direction = "tab", hidden = true },
op = { cmd = "ipython", display_name = "ipython", direction = "vertical", hidden = true },
oP = { cmd = "ipython", display_name = "ipython-full", direction = "tab", hidden = true },
on = { cmd = "ncmpcpp", display_name = "ncmpcpp", direction = "tab", hidden = true },
ob = { cmd = "btop", display_name = "btop", direction = "tab", hidden = true },
od = { cmd = "lazydocker", display_name = "lazydocker", direction = "tab", hidden = true },
gg = { cmd = "lazygit", display_name = "lazygit", direction = "tab", hidden = true, group = "Lazygit" },
op = { cmd = "ipython", display_name = "ipython", direction = "vertical", hidden = true, group = "Ipython" },
oP = {
cmd = "ipython",
display_name = "ipython-full",
direction = "tab",
hidden = true,
group = "Ipython Fullscreen",
},
oi = { cmd = "sudo iotop", display_name = "ncmpcpp", direction = "tab", hidden = true, group = "Ncmpcpp" },
on = { cmd = "ncmpcpp", display_name = "ncmpcpp", direction = "tab", hidden = true, group = "Ncmpcpp" },
oN = { cmd = "nvtop", display_name = "nvtop", direction = "tab", hidden = true, group = "Nvtop" },
ob = { cmd = "/usr/bin/btop", display_name = "btop", direction = "tab", hidden = true, group = "Btop" },
od = { cmd = "lazydocker", display_name = "lazydocker", direction = "tab", hidden = true, group = "Lazydocker" },
}
for key, value in pairs(programs_map) do
map("n", "<leader>" .. key, function()
term_toggle(term_factory(value))
end, opts)
map("n", "<leader>" .. key, function()
term_toggle(term_factory(value))
end, opts)
end
map("v", "op", "<C-\\><C-N>:ToggleTerm name=ipython")
map("v", "oP", "<C-\\><C-N>:ToggleTerm name=ipython-full")
map("n", "<C-T>", ":ToggleTerm name=toggleterm<CR>", opts)
map("n", "<leader>tt", ":ToggleTerm name=toggleterm<CR>", opts)
map("n", "<leader>tT", ":ToggleTerm name=toggleterm-full direction=tab<CR>", opts)
map("n", "<leader>ot", ":ToggleTerm name=toggleterm<CR>", opts)
map("n", "<leader>oT", ":ToggleTerm name=toggleterm-full direction=tab<CR>", opts)
map("n", "<leader>ts", ":TermSelect<CR>", opts)
map("n", "<leader>tv", ":ToggleTerm direction=vertical name=toggleterm-vert<CR>", opts)
map("n", "<leader>th", ":ToggleTerm direction=horizontal name=toggleterm-hori<CR>", opts)
map("n", "<leader>ov", ":ToggleTerm direction=vertical name=toggleterm-vert<CR>", opts)
map("n", "<leader>oh", ":ToggleTerm direction=horizontal name=toggleterm-hori<CR>", opts)
map("n", "<leader>tf", ":ToggleTerm name=toggleterm<CR>", opts)
map("n", "<leader>-", ":ToggleTerm direction='horizontal'<CR>", opts)
map("n", "<leader>|", ":ToggleTerm direction='vertical'<CR>", opts)
local tbl = {}
for key, value in pairs(programs_map) do
local temp = {
cmd = value.cmd,
key = "<leader>" .. key,
group = value.group,
mode = "n",
desc = "Open " .. value.display_name,
}
table.insert(tbl, temp)
end
add_to_whichkey(tbl, { key = "<leader>o", group = "Open" })
function _G.set_terminal_keymaps()
local opts = { buffer = 0 }
map("t", "<esc>", [[<C-\><C-n>]], opts)
map("t", "<C-w>", [[<C-\><C-n><C-w>]], opts)
-- map("t", "<space>", "<space>", { buffer = 0, silent = true }) -- fix space in terminal
local opts = { buffer = 0 }
map("t", "<esc>", [[<C-\><C-n>]], opts)
map("t", "<C-w>", [[<C-\><C-n><C-w>]], opts)
end
-- if you only want these mappings for toggle term use term://*toggleterm#* instead
vim.cmd("autocmd! TermOpen term://* lua set_terminal_keymaps()")
--}}}
--{{{ LSP mappings
map("n", "gA", vim.lsp.buf.code_action, opts)
map("n", "gd", ":Telescope lsp_definitions<CR>", opts)
map("n", "gDc", ":Telescope lsp_implementations<CR>", opts)
map("n", "gDf", ":Telescope lsp_definitions<CR>", opts)
map("n", "gF", ":edit <cfile><CR>", opts)
map("n", "gT", ":Telescope lsp_type_definitions<CR>", opts)
map("n", "gb", ":Gitsigns blame_line<CR>", opts)
map("n", "gi", ":Telescope lsp_implementations<CR>", opts)
map("n", "gj", ":Telescope jumplist<CR>", opts)
map("n", "gl", vim.lsp.codelens.run, opts)
map("n", "gr", ":Telescope lsp_references<CR>", opts)
map("n", "gs", vim.lsp.buf.signature_help, opts)
map("n", "K", vim.lsp.buf.hover, opts)
map("n", "<leader>cd", ":Telescope lsp_definitions<CR>")
map("n", "<leader>ca", vim.lsp.buf.code_action)
map("n", "<leader>cci", ":Telescope lsp_incoming_calls<CR>")
map("n", "<leader>cco", ":Telescope lsp_outgoing_calls<CR>")
map("n", "<leader>ch", ":lua vim.lsp.buf.signature_help()<CR>")
map("n", "<leader>ci", ":Telescope lsp_implementations<CR>")
map("n", "<leader>cr", ":Telescope lsp_references<CR>")
map("n", "<leader>cR", ":lua vim.lsp.buf.rename()<CR>")
map("n", "<leader>cs", ":Telescope lsp_document_symbols<CR>")
map("n", "<leader>ct", ":Telescope lsp_type_definitions<CR>")
map("n", "<leader>cw", ":Telescope lsp_dynamic_workspace_symbols<CR>")
map("n", "<leader>cd", ":Telescope diagnostics<CR>")
map("n", "<leader>cDs", ":Telescope diagnostics<CR>")
map("n", "<leader>cDn", ":lua vim.diagnostic.goto_next()<CR>")
map("n", "<leader>cDp", ":lua vim.diagnostic.goto_prev()<CR<CR>")
map("n", "<leader>cl", ":lua vim.diagnostic.setloclist()<CR>")
--{{{ Groups
add_to_whichkey(nil, { key = "<leader>a", group = "AnyJump" })
add_to_whichkey(nil, { key = "<leader>b", group = "Buffers" })
add_to_whichkey(nil, { key = "<leader>c", group = "Code" })
add_to_whichkey(nil, { key = "<leader>ca", group = "Code Actions" })
add_to_whichkey(nil, { key = "<leader>C", group = "CodeCompanion" })
add_to_whichkey(nil, { key = "<leader>d", group = "ODIS" })
add_to_whichkey(nil, { key = "<leader>f", group = "Find" })
add_to_whichkey(nil, { key = "<leader>g", group = "Git" })
add_to_whichkey(nil, { key = "<leader>gd", group = "DiffView" })
add_to_whichkey(nil, { key = "<leader>gg", group = "Lazygit" })
add_to_whichkey(nil, { key = "<leader>h", group = "Help" })
add_to_whichkey(nil, { key = "<leader>j", group = "AnyJump" })
add_to_whichkey(nil, { key = "<leader>N", group = "Noice" })
-- add_to_whichkey(nil, { key = "<leader>o", group = "Open" })
add_to_whichkey(nil, { key = "<leader>ob", group = "Btop" })
add_to_whichkey(nil, { key = "<leader>on", group = "Ncmpcpp" })
add_to_whichkey(nil, { key = "<leader>od", group = "Lazydocker" })
add_to_whichkey(nil, { key = "<leader>op", group = "Ipython" })
add_to_whichkey(nil, { key = "<leader>oP", group = "Ipython Full" })
add_to_whichkey(nil, { key = "<leader>p", group = "Paste in Place" })
add_to_whichkey(nil, { key = "<leader>s", group = "Search" })
add_to_whichkey(nil, { key = "<leader>t", group = "Terminal" })
add_to_whichkey(nil, { key = "<leader>T", group = "Telescope" })
add_to_whichkey(nil, { key = "<leader>w", group = "Workspace" })
add_to_whichkey(nil, { key = "<leader>x", group = "Make Executable" })
add_to_whichkey(nil, { key = "<leader>y", group = "System Yank" })
add_to_whichkey(nil, { key = "<leader>0", group = "Horizontal Terminal" })
--}}}
--{{{ Code Companion and Copilot
map("n", "<leader>cp", ":vert Copilot panel<CR>", opts)
map("n", "<leader>oc", ":CodeCompanionChat Toggle<CR>")
map("n", "<leader>Cc", ":CodeCompanionChat Toggle<CR>", opts)
map("n", "<leader>Ci", ":CodeCompanion ", opts)
map("n", "<leader>CT", ":CodeCompanionChat Toggle<CR>", opts)
map("n", "<leader>Ca", ":CodeCompanionActions<CR>", opts)
map("v", "<leader>Cc", ":CodeCompanionChat Add<CR>", opts)
map("v", "<leader>Ci", ":CodeCompanion /buffer ", notsilent)
map("v", "<leader>Ce", ":CodeCompanion /explain<CR>", notsilent)
map("v", "<leader>Cf", ":CodeCompanion /fix<CR>", notsilent)
map("v", "<leader>Cl", ":CodeCompanion /lsp<CR>", notsilent)
map("v", "<leader>Ct", ":CodeCompanion /tests<CR>", notsilent)
--}}}
--{{{ Telescope mappings
-- {{{ Telescope Finders
map("n", "//", ":Telescope current_buffer_fuzzy_find<CR>", opts)
map("n", "??", ":Telescope lsp_document_symbols<CR>", opts)
map(
"n",
"<leader>fc",
':Telescope color_names theme=dropdown layout_config={width=0.45,height=25,prompt_position="bottom"} layout_strategy=vertical<CR>',
opts
)
-- map('n', '<leader>ob', ':Telescope file_browser<CR>')
map(
"n",
"<leader>ff",
":Telescope find_files find_command=rg,--ignore,--follow,--hidden,--files prompt_prefix=🔍<CR>",
opts
)
map("n", "<leader>fg", ":Telescope live_grep<CR>", opts)
map(
"n",
"<leader>fG",
':Telescope glyph theme=dropdown layout_config={width=0.45,height=35,prompt_position="bottom"} layout_strategy=vertical<CR>',
opts
)
map("n", "<leader>fb", ":Telescope file_browser<CR>", opts)
map("n", "<leader>fr", ":Telescope oldfiles<CR>", opts)
-- }}}
--{{{ Telescope Help
map("n", "<leader>hc", ":Telescope commands<CR>")
map("n", "<leader>hv", ":Telescope vim_options<CR>")
map("n", "<leader>hk", ":Telescope keymaps<CR>")
map("n", "<leader>hs", ":Telescope spell_suggest<CR>")
map("n", "<leader>hm", ":Telescope man_pages<CR>")
--}}}
--{{{ Telescope Search
map(
"n",
"<leader>sf",
":Telescope find_files find_command=rg,--ignore,--follow,--hidden,--files prompt_prefix=🔍<CR>",
opts
)
map("n", "<leader>sF", ":Telescope fidget<CR>")
map("n", "<leader>sg", ":Telescope live_grep<CR>")
map("n", "<leader>sh", ":Telescope command_history<CR>")
map("n", "<leader>sm", ":Telescope man_pages<CR>")
map("n", "<leader>s/", ":Telescope search_history<CR>")
--}}}
--{{{ Git mappings
map("n", "<leader>gc", ":Telescope git_commits<CR>", opts)
map("n", "<leader>gf", ":Telescope git_files<CR>", opts)
--}}}
map("n", "Q", ":Telescope cmdline<CR>", opts)
map("n", "<leader><leader>", ":Telescope cmdline<CR>", opts)
--}}}
--{{{ File explorer and tools
map("n", "<leader>n", ":NvimTreeToggle<CR>", opts)
map("n", "<leader>D", ":Dotenv .env<CR>", opts)
--}}}
--{{{ Misc utilities
map("n", "<leader>x", "<cmd>!chmod +x %<CR>", opts)
map("n", "<leader>y", '"+', opts)
map("v", "<leader>y", '"+', opts)
map("n", "<leader>sc", ":nohls<CR>")
--}}}
--{{{ Goto Preview
map("n", "gpc", ':lua require("goto-preview").close_all_win()<CR>')
map("n", "gpd", ':lua require("goto-preview").goto_preview_definition()<CR>')
map("n", "gpi", ':lua require("goto-preview").goto_preview_implementation()<CR>')
--}}}
--{{{ Workspace management
map("n", "<leader>wa", vim.lsp.buf.add_workspace_folder, opts)
map("n", "<leader>wr", vim.lsp.buf.remove_workspace_folder, opts)
map("n", "<leader>wl", function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, opts)
--{{{ Whichkey Mappings
add_to_whichkey(map_from_table(basic_mappings))
add_to_whichkey(map_from_table(buffer_navigation_mappings))
add_to_whichkey(map_from_table(terminal_mappings))
add_to_whichkey(map_from_table(lsp_mappings))
add_to_whichkey(map_from_table(code_companion_mappings))
add_to_whichkey(map_from_table(telescope_mappings))
add_to_whichkey(map_from_table(file_explorer_mappings))
add_to_whichkey(map_from_table(misc_utilities_mappings))
add_to_whichkey(map_from_table(goto_preview_mappings))
add_to_whichkey(map_from_table(workspace_management_mappings))
add_to_whichkey(map_from_table(noice_mappings))
add_to_whichkey(map_from_table(odis_mappings))
add_to_whichkey(map_from_table(diffview_mappings))
add_to_whichkey(nil, { key = "<leader>dc", group = "Close" })
--}}}

View File

@@ -30,8 +30,33 @@ require("lazy").setup({
install = { colorscheme = { "habamax" } },
-- automatically check for plugin updates
checker = { enabled = true },
dev = {
-- Directory where you store your local plugin projects. If a function is used,
-- the plugin directory (e.g. `~/projects/plugin-name`) must be returned.
---@type string | fun(plugin: LazyPlugin): string
path = "~/.config/nvim/test",
---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub
patterns = {}, -- For example {"folke"}
fallback = false, -- Fallback to git when local plugin doesn't exist
},
-- lazy can generate helptags from the headings in markdown readme files,
-- so :help works even for plugins that don't have vim docs.
-- when the readme opens with :help it will be correctly displayed as markdown
readme = {
enabled = true,
root = vim.fn.stdpath("state") .. "/lazy/readme",
files = { "README.md", "lua/**/README.md" },
-- only generate markdown helptags for plugins that don't have docs
skip_if_doc_exists = true,
},
state = vim.fn.stdpath("state") .. "/lazy/state.json", -- state info for checker and other things
-- Enable profiling of lazy.nvim. This will add some overhead,
-- so only enable this when you are debugging lazy.nvim
profiling = {
-- Enables extra stats on the debug tab related to the loader cache.
-- Additionally gathers stats about all package.loaders
loader = false,
-- Track each new require in the Lazy profiling tab
require = false,
},
})
vim.cmd("colorscheme catppuccin")
require("core.keymaps")
require("core.lsp-notifications")

View File

@@ -86,13 +86,19 @@ vim.lsp.handlers["$/progress"] = function(_, result, ctx)
end
end
-- table from lsp severity to vim severity.
local severity = {
"error",
"warn",
"info",
"info", -- map both hint and info to info?
}
vim.lsp.handlers["window/showMessage"] = function(err, method, params, client_id)
vim.notify(method.message, severity[params.type])
vim.lsp.handlers["window/showMessage"] = function(err, result, ctx)
local client = vim.lsp.get_client_by_id(ctx.client_id)
local lvl = ({
"ERROR",
"WARN",
"INFO",
"DEBUG",
})[result.type]
vim.notify("LSP Message: " .. result.message, lvl, {
title = "LSP | " .. client.name,
timeout = 5000,
keep = function()
return lvl == "ERROR" or lvl == "WARN"
end,
})
end

View File

@@ -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
@@ -46,11 +46,15 @@ o.updatetime = 300
o.timeoutlen = 500
o.pumwidth = 35
o.foldmethod = "marker"
o.conceallevel = 1
g.db_ui_use_nerd_fonts = 1
-- vim.cmd.colorscheme = 'catppuccin-macchiato'
vim.cmd.colorscheme = "catppuccin"
-- Define the highlight color for float border
vim.api.nvim_set_hl(0, "FloatBorder", { fg = "#89b4fa", bold = true })
local border = {
{ "", "FloatBorder" },
{ "", "FloatBorder" },
@@ -62,17 +66,20 @@ local border = {
{ "", "FloatBorder" },
}
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 })
-- set border for floating windows and signature help
-- 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"
-- lsp status
-- table from lsp severity to vim severity.
local severity = {
"error",
"warn",
"info",
"info", -- map both hint and info to info?
}
vim.lsp.handlers["window/showMessage"] = function(err, method, params, client_id)
vim.notify(method.message, severity[params.type])
end
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" })

View File

@@ -1,7 +0,0 @@
return {
"https://git.sr.ht/~nedia/auto-format.nvim",
event = "BufWinEnter",
config = function()
require("auto-format").setup()
end
}

View File

@@ -4,30 +4,205 @@ return {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
"j-hui/fidget.nvim",
"ravitemer/mcphub.nvim",
},
opts = {
adapters = {
copilot = function()
return require("codecompanion.adapters").extend("copilot", {
schema = {
name = "copilot",
opts = {
stream = true,
},
model = {
-- 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 } },
-- "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,
-- },
},
})
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 = function(adapter)
if adapter.model == nil then
return " Assistant"
else
return " Assistant ("
.. adapter.formatted_name
.. " - "
.. adapter.parameters.model
.. ")"
end
end,
user = " User",
},
slash_commands = {
["file"] = {
opts = {
provider = "telescope",
},
},
["symbols"] = {
opts = {
provider = "telescope",
},
},
["buffer"] = {
opts = {
provider = "telescope",
},
},
["terminal"] = {
opts = {
provider = "telescope",
},
},
},
},
inline = {
adapter = "copilot",
-- adapter = "openrouter",
},
},
display = {
action_palette = {
provider = "default",
width = 150,
heigth = 85,
provider = "telescope",
width = 75,
heigth = 45,
},
chat = {
layout = "vertical",
border = "single",
intro_message = "Welcome to CodeCompanion ✨! Press ? for options",
show_header_separator = false, -- Show header separators in the chat buffer? Set this to false if you're using an external markdown formatting plugin
separator = "", -- The separator between the different messages in the chat buffer
show_references = true, -- Show references (from slash commands and variables) in the chat buffer?
show_settings = false, -- Show LLM settings at the top of the chat buffer?
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",
},
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()

View 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

View File

@@ -1,3 +1,5 @@
-- lua/plugins/codecompanion/fidget-spinner.lua
local progress = require("fidget.progress")
local M = {}

4
lua/plugins/conform.lua Normal file
View File

@@ -0,0 +1,4 @@
return {
"stevearc/conform.nvim",
opts = {},
}

27
lua/plugins/diffview.lua Normal file
View File

@@ -0,0 +1,27 @@
return {
"sindrets/diffview.nvim",
dependencies = "nvim-tree/nvim-web-devicons",
opts = {
view = {
-- Disable the default normal mode mapping for `<tab>`:
-- ["<tab>"] = false,
-- Disable the default visual mode mapping for `gf`:
-- { "x", "gf", false },
},
},
hooks = {
diff_buf_read = function(bufnr)
-- Change local options in diff buffers
vim.opt_local.wrap = false
vim.opt_local.list = false
vim.opt_local.colorcolumn = { 80 }
end,
view_opened = function(view)
require("notify").notify(
("A new %s was opened on tab page %d!"):format(view.class:name(), view.tabpage),
"info",
{ timeout = 5000, title = "Diffview" }
)
end,
},
}

View File

@@ -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,
}

View File

@@ -1,14 +1,14 @@
return {
"neovim/nvim-lspconfig",
dependencies = { "saghen/blink.cmp" },
config = function()
local lspconfig = require("lspconfig")
vim.notify = require("notify")
local servers = {
"bashls",
"jedi_language_server",
-- "jedi_language_server",
"basedpyright",
"jsonls",
"yamlls",
-- "yamlls",
"vimls",
"dotls",
"dockerls",
@@ -19,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
@@ -53,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)
@@ -61,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,

View File

@@ -1,137 +1,90 @@
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,
theme = "catppuccin",
-- theme = 'dracula',
-- theme = 'horizon',
-- theme = 'onedark',
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
disabled_filetypes = {},
always_divide_middle = true,
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff" },
lualine_c = { "filename" },
lualine_x = {
M,
{
"copilot",
symbols = {
status = {
icons = {
enabled = "",
sleep = "", -- auto-trigger disabled
disabled = "",
warning = "",
unknown = "",
},
hl = {
enabled = "#50FA7B",
sleep = "#AEB7D0",
disabled = "#6272A4",
warning = "#FFB86C",
unknown = "#FF5555",
},
},
spinners = "dots", -- has some premade spinners
spinner_color = "#6272A4",
},
show_colors = false,
show_loading = true,
},
{
"diagnostics",
"fileformat",
symbols = {
unix = "", -- e712
dos = "", -- e70f
mac = "", -- e711
},
},
"encoding",
"fileformat",
{ "filetype", colored = true, icon_only = false },
},
lualine_y = { "progress" },
lualine_z = { "location" },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {
{
"filename",
file_status = true, -- Displays file status (readonly status, modified status)
path = 0, -- 0: Just the filename
shorting_target = 40, -- Shortens path to leave 40 spaces in the window
symbols = {
modified = "[+]", -- Text to show when the file is modified.
readonly = "[-]", -- Text to show when the file is non-modifiable or readonly.
unnamed = "[No Name]", -- Text to show for unnamed buffers.
},
},
M,
},
lualine_x = { "location" },
lualine_y = {},
lualine_z = {},
},
tabline = {},
extensions = { "quickfix", "fzf", "nvim-tree", "symbols-outline", "fugitive" },
})
end,
depends = { "kyazdani42/nvim-web-devicons" },
"nvim-lualine/lualine.nvim",
config = function()
require("lualine").setup({
options = {
icons_enabled = true,
theme = "catppuccin",
-- theme = 'dracula',
-- theme = 'horizon',
-- theme = 'onedark',
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
disabled_filetypes = {},
always_divide_middle = true,
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff" },
lualine_c = { "filename" },
lualine_x = {
{
"seachcount",
{ require("mcphub.extensions.lualine") },
"copilot",
symbols = {
status = {
icons = {
enabled = "",
sleep = "", -- auto-trigger disabled
disabled = "",
warning = "",
unknown = "",
},
hl = {
enabled = "#50FA7B",
sleep = "#AEB7D0",
disabled = "#6272A4",
warning = "#FFB86C",
unknown = "#FF5555",
},
},
spinners = "dots", -- has some premade spinners
spinner_color = "#6272A4",
},
show_colors = true,
show_loading = true,
},
{
"diagnostics",
"fileformat",
symbols = {
unix = "", -- e712
dos = "", -- e70f
mac = "", -- e711
},
},
"encoding",
"fileformat",
{ "filetype", colored = true, icon_only = false },
},
lualine_y = { "progress" },
lualine_z = { "location" },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {
{
"filename",
file_status = true, -- Displays file status (readonly status, modified status)
path = 0, -- 0: Just the filename
shorting_target = 40, -- Shortens path to leave 40 spaces in the window
symbols = {
modified = "[+]", -- Text to show when the file is modified.
readonly = "[-]", -- Text to show when the file is non-modifiable or readonly.
unnamed = "[No Name]", -- Text to show for unnamed buffers.
},
},
M,
},
lualine_x = { "location" },
lualine_y = {},
lualine_z = {},
},
tabline = {},
extensions = { "quickfix", "fzf", "nvim-tree", "symbols-outline", "fugitive", "toggleterm", "man" },
})
end,
depends = { "kyazdani42/nvim-web-devicons" },
}

51
lua/plugins/mcphub.lua Normal file
View 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,
}

View File

@@ -1,6 +1,6 @@
return {
"echasnovski/mini.diff",
depends = "echasnovski/mini.nvim",
depends = { "echasnovski/mini.nvim" },
opts = {
-- Options for how hunks are visualized

93
lua/plugins/noice.lua Normal file
View File

@@ -0,0 +1,93 @@
return {
"folke/noice.nvim",
event = "VeryLazy",
opts = {
lsp = {
progress = {
enabled = true,
-- Lsp Progress is formatted using the builtins for lsp_progress. See config.format.builtin
-- See the section on formatting for more details on how to customize.
--- @type NoiceFormat|string
format = "lsp_progress",
--- @type NoiceFormat|string
format_done = "lsp_progress_done",
throttle = 1000 / 30, -- frequency to update lsp progress message
view = "mini",
},
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp
},
hover = {
enabled = false,
silent = false, -- set to true to not show a message if hover is not available
view = "split", -- when nil, use defaults from documentation
---@type NoiceViewOptions
opts = {}, -- merged with defaults from documentation
},
signature = {
enabled = true,
auto_open = {
enabled = false,
trigger = true, -- Automatically show signature help when typing a trigger character from the LSP
luasnip = true, -- Will open signature help when jumping to Luasnip insert nodes
throttle = 50, -- Debounce lsp signature help request by 50ms
},
view = nil, -- when nil, use defaults from documentation
---@type NoiceViewOptions
opts = {}, -- merged with defaults from documentation
},
},
-- you can enable a preset for easier configuration
presets = {
bottom_search = true, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and popupmenu together
long_message_to_split = true, -- long messages will be sent to a split
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
"MunifTanjim/nui.nvim",
-- OPTIONAL:
-- `nvim-notify` is only needed, if you want to use the notification view.
-- If not available, we use `mini` as the fallback
"rcarriga/nvim-notify",
},
}

View File

@@ -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,
}

View File

@@ -14,7 +14,7 @@ return {
minimum_width = 50,
render = "default",
stages = "fade_in_slide_out",
timeout = 5000,
timeout = 3000,
top_down = true,
},
}

1
lua/plugins/nui.lua Normal file
View File

@@ -0,0 +1 @@
return { "MunifTanjim/nui.nvim" }

View File

@@ -1,263 +1,263 @@
return {
"hrsh7th/nvim-cmp",
dependencies = {
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lsp-signature-help",
"hrsh7th/cmp-nvim-lsp-document-symbol",
-- "hrsh7th/cmp-nvim-lsp",
-- "hrsh7th/cmp-path",
"rafamadriz/friendly-snippets",
"Jezda1337/nvim-html-css",
"https://codeberg.org/FelipeLema/cmp-async-path",
},
config = function()
-- Setup nvim-cmp.
local cmp = require("cmp")
local lspkind = require("lspkind")
-- luasnip setup
local luasnip = require("luasnip")
"hrsh7th/nvim-cmp",
dependencies = {
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lsp-signature-help",
"hrsh7th/cmp-nvim-lsp-document-symbol",
-- "hrsh7th/cmp-nvim-lsp",
-- "hrsh7th/cmp-path",
"rafamadriz/friendly-snippets",
"Jezda1337/nvim-html-css",
"https://codeberg.org/FelipeLema/cmp-async-path",
},
config = function()
-- Setup nvim-cmp.
local cmp = require("cmp")
local lspkind = require("lspkind")
-- luasnip setup
local luasnip = require("luasnip")
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local has_words_before = function()
if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then
return false
end
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match("^%s*$") == nil
end
require("luasnip.loaders.from_vscode").lazy_load()
local has_words_before = function()
if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then
return false
end
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match("^%s*$") == nil
end
require("luasnip.loaders.from_vscode").lazy_load()
lspkind.init({ symbol_map = { Copilot = "" } })
lspkind.init({ symbol_map = { Copilot = "" } })
cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "nvim_lsp_document_symbol" },
}, {
{ name = "buffer" },
}),
})
cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "nvim_lsp_document_symbol" },
}, {
{ name = "buffer" },
}),
})
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ { name = "path" } }, {
{ name = "cmdline", option = { ignore_cmds = { "Man", "!" } } },
}),
matching = { disallow_symbol_nonprefix_matching = false },
})
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ { name = "path" } }, {
{ name = "cmdline", option = { ignore_cmds = { "Man", "!" } } },
}),
matching = { disallow_symbol_nonprefix_matching = false },
})
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
require('cmp').setup({
snippet = {
expand = function(args)
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
luasnip.lsp_expand(args.body) -- For `luasnip` users.
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
end,
},
mapping = {
["<C-p>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<C-n>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = false,
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() and has_words_before() then
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
elseif luasnip.locally_jumpable(1) then
luasnip.jump(1)
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
},
window = {
completion = {
-- winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
col_offset = 0,
side_padding = 0,
border = "rounded",
borderchars = {
"",
"",
"",
"",
"",
"",
"",
"",
},
},
documentation = {
border = "rounded",
borderchars = {
"",
"",
"",
"",
"",
"",
"",
"",
},
-- padding = 15,
},
},
formatting = {
-- options: 'text', 'text_symbol', 'symbol_text', 'symbol'
-- mode = 'symbol_text',
fields = { "kind", "abbr", "menu" },
expandable_indicator = true,
format = function(entry, vim_item)
local kind = require("lspkind").cmp_format({
mode = "symbol_text",
-- mode = "symbol",
maxwidth = 75,
symbol_map = {
Copilot = "",
Text = "",
Method = "",
Function = "",
Constructor = "",
Field = "",
Variable = "",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
},
})(entry, vim_item)
local strings = vim.split(kind.kind, "%s", { trimempty = true })
kind.kind = " " .. strings[1] .. " "
kind.menu = " (" .. strings[2] .. ")"
require("cmp").setup({
snippet = {
expand = function(args)
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
luasnip.lsp_expand(args.body) -- For `luasnip` users.
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
end,
},
mapping = {
["<C-p>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<C-n>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = false,
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() and has_words_before() then
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
elseif luasnip.locally_jumpable(1) then
luasnip.jump(1)
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
},
window = {
completion = {
-- winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
col_offset = 0,
side_padding = 0,
border = "rounded",
borderchars = {
"",
"",
"",
"",
"",
"",
"",
"",
},
},
documentation = {
border = "rounded",
borderchars = {
"",
"",
"",
"",
"",
"",
"",
"",
},
-- padding = 15,
},
},
formatting = {
-- options: 'text', 'text_symbol', 'symbol_text', 'symbol'
-- mode = 'symbol_text',
fields = { "kind", "abbr", "menu" },
expandable_indicator = true,
format = function(entry, vim_item)
local kind = require("lspkind").cmp_format({
mode = "symbol_text",
-- mode = "symbol",
maxwidth = 75,
symbol_map = {
Copilot = "",
Text = "",
Method = "",
Function = "",
Constructor = "",
Field = "",
Variable = "",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
},
})(entry, vim_item)
local strings = vim.split(kind.kind, "%s", { trimempty = true })
kind.kind = " " .. strings[1] .. " "
kind.menu = " (" .. strings[2] .. ")"
return kind
end,
},
sources = cmp.config.sources({
{ name = "nvim_lsp_signature_help", group_index = 0 },
{ name = "lazydev", group_index = 0 },
{ name = "nvim_lsp", group_index = 1 },
{ name = "copilot", group_index = 1 },
{ name = "codecompanion", group_index = 1 },
{ name = "async_path", group_index = 2 },
-- { name = "path", group_index = 2 },
-- { name = "cmdline", option = { ignore_cmds = { "Man", "!" } } },
{ name = "nvim_lsp_document_symbol", group_index = 2 },
{ name = "luasnip", group_index = 2 }, -- For luasnip users.
{ name = "render-markdown", group_index = 2 },
{
name = "html-css",
group_indx = 2,
option = {
enable_on = { "html", "jsx", "tsx", "typescript", "typescriptreact" }, -- html is enabled by default
notify = false,
documentation = {
auto_show = true, -- show documentation on select
},
-- add any external scss like one below
style_sheets = {
"https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css",
"https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css",
},
},
},
{
name = "buffer",
option = {
get_bufnrs = function()
local bufs = {}
for _, win in ipairs(vim.api.nvim_list_wins()) do
bufs[vim.api.nvim_win_get_buf(win)] = true
end
return vim.tbl_keys(bufs)
end,
},
},
-- { name = 'ultisnips' }, -- For ultisnips users.
-- { name = 'snippy' }, -- For snippy users.
}, { { name = "buffer" } }),
sorting = {
priority_weight = 2,
comparators = {
require("copilot_cmp.comparators").prioritize,
cmp.config.compare.offset,
cmp.config.compare.exact,
require("copilot_cmp.comparators").score,
require("copilot_cmp.comparators").recently_used,
cmp.config.compare.locality,
require("copilot_cmp.comparators").kind,
require("copilot_cmp.comparators").sort_text,
require("copilot_cmp.comparators").length,
require("copilot_cmp.comparators").order,
return kind
end,
},
sources = cmp.config.sources({
{ name = "nvim_lsp_signature_help", group_index = 0 },
{ name = "lazydev", group_index = 0 },
{ name = "nvim_lsp", group_index = 1 },
{ name = "copilot", group_index = 1 },
{ name = "codecompanion", group_index = 2 },
{ name = "async_path", group_index = 2 },
-- { name = "path", group_index = 2 },
-- { name = "cmdline", option = { ignore_cmds = { "Man", "!" } } },
{ name = "nvim_lsp_document_symbol", group_index = 2 },
{ name = "luasnip", group_index = 2 }, -- For luasnip users.
{ name = "render-markdown", group_index = 2 },
{
name = "html-css",
group_indx = 2,
option = {
enable_on = { "html", "jsx", "tsx", "typescript", "typescriptreact" }, -- html is enabled by default
notify = false,
documentation = {
auto_show = true, -- show documentation on select
},
-- add any external scss like one below
style_sheets = {
"https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css",
"https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css",
},
},
},
{
name = "buffer",
option = {
get_bufnrs = function()
local bufs = {}
for _, win in ipairs(vim.api.nvim_list_wins()) do
bufs[vim.api.nvim_win_get_buf(win)] = true
end
return vim.tbl_keys(bufs)
end,
},
},
-- { name = 'ultisnips' }, -- For ultisnips users.
-- { name = 'snippy' }, -- For snippy users.
}, { { name = "buffer" } }),
sorting = {
priority_weight = 2,
comparators = {
require("copilot_cmp.comparators").prioritize,
cmp.config.compare.offset,
cmp.config.compare.exact,
require("copilot_cmp.comparators").score,
require("copilot_cmp.comparators").recently_used,
cmp.config.compare.locality,
require("copilot_cmp.comparators").kind,
require("copilot_cmp.comparators").sort_text,
require("copilot_cmp.comparators").length,
require("copilot_cmp.comparators").order,
-- Below is the default comparitor list and order for nvim-cmp
cmp.config.compare.offset,
-- cmp.config.compare.scopes, --this is commented in nvim-cmp too
cmp.config.compare.exact,
cmp.config.compare.score,
cmp.config.compare.recently_used,
cmp.config.compare.locality,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
},
},
})
end
-- Below is the default comparitor list and order for nvim-cmp
cmp.config.compare.offset,
-- cmp.config.compare.scopes, --this is commented in nvim-cmp too
cmp.config.compare.exact,
cmp.config.compare.score,
cmp.config.compare.recently_used,
cmp.config.compare.locality,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
},
},
})
end,
}

View File

@@ -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" },
}

View File

@@ -0,0 +1 @@
return { "nvim-treesitter/nvim-treesitter-context" }

102
lua/plugins/obsidian.lua Normal file
View File

@@ -0,0 +1,102 @@
vim.notify = require("notify")
return {
"epwalsh/obsidian.nvim",
version = "*", -- recommended, use latest release instead of latest commit
lazy = true,
ft = "markdown",
-- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault:
-- event = {
-- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'.
-- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/*.md"
-- -- refer to `:h file-pattern` for more examples
-- "BufReadPre path/to/my-vault/*.md",
-- "BufNewFile path/to/my-vault/*.md",
-- },
dependencies = {
-- Required.
"nvim-lua/plenary.nvim",
-- see below for full list of optional dependencies 👇
},
opts = {
workspaces = {
{
name = "vault",
path = "~/S/obsidian/Vault",
},
-- {
-- name = "work",
-- path = "~/vaults/work",
-- },
},
completion = {
-- Set to false to disable completion.
nvim_cmp = true,
-- Trigger completion at 2 chars.
min_chars = 2,
},
-- Optional, configure additional syntax highlighting / extmarks.
-- This requires you have `conceallevel` set to 1 or 2. See `:help conceallevel` for more details.
ui = {
enable = true, -- set to false to disable all additional syntax features
update_debounce = 200, -- update delay after a text change (in milliseconds)
max_file_length = 5000, -- disable UI features for files with more than this many lines
-- Define how various check-boxes are displayed
checkboxes = {
-- NOTE: the 'char' value has to be a single character, and the highlight groups are defined below.
[" "] = { char = "󰄱", hl_group = "ObsidianTodo" },
["x"] = { char = "", hl_group = "ObsidianDone" },
[">"] = { char = "", hl_group = "ObsidianRightArrow" },
["~"] = { char = "󰰱", hl_group = "ObsidianTilde" },
["!"] = { char = "", hl_group = "ObsidianImportant" },
-- Replace the above with this if you don't have a patched font:
-- [" "] = { char = "☐", hl_group = "ObsidianTodo" },
-- ["x"] = { char = "✔", hl_group = "ObsidianDone" },
-- You can also add more custom ones...
},
},
attachments = {
-- The default folder to place images in via `:ObsidianPasteImg`.
-- If this is a relative path it will be interpreted as relative to the vault root.
-- You can always override this per image by passing a full path to the command instead of just a filename.
img_folder = "screenshots", -- This is the default
-- Optional, customize the default name or prefix when pasting images via `:ObsidianPasteImg`.
---@return string
img_name_func = function()
-- Prefix image names with timestamp.
return string.format("%s-", os.time())
end,
-- A function that determines the text to insert in the note when pasting an image.
-- It takes two arguments, the `obsidian.Client` and an `obsidian.Path` to the image file.
-- This is the default implementation.
---@param client obsidian.Client
---@param path obsidian.Path the absolute path to the image file
---@return string
img_text_func = function(client, path)
path = client:vault_relative_path(path) or path
return string.format("![%s](%s)", path.name, path)
end,
},
-- Optional, by default when you use `:ObsidianFollowLink` on a link to an external
-- URL it will be ignored but you can customize this behavior here.
---@param url string
follow_url_func = function(url)
-- Open the URL in the default web browser.
vim.fn.jobstart({ "open", url }) -- Mac OS
-- vim.fn.jobstart({"xdg-open", url}) -- linux
-- vim.cmd(':silent exec "!start ' .. url .. '"') -- Windows
-- vim.ui.open(url) -- need Neovim 0.10.0+
end,
-- Optional, by default when you use `:ObsidianFollowLink` on a link to an image
-- file it will be ignored but you can customize this behavior here.
---@param img string
follow_img_func = function(url)
-- vim.fn.jobstart({ "qlmanage", "-p", img }) -- Mac OS quick look preview
vim.fn.jobstart({ "xdg-open", url }) -- linux
-- vim.cmd(':silent exec "!start ' .. url .. '"') -- Windows
end,
},
}

52
lua/plugins/odis.lua Normal file
View File

@@ -0,0 +1,52 @@
return {
url = "https://gitea.suda.codes/sudacode/odis",
dependencies = {
"nvim-treesitter/nvim-treesitter",
"neovim/nvim-lspconfig",
},
opts = {
opts = {
display = {
default_mode = "vsplit",
picker = true,
float = {
maxwidth = 80,
maxheight = 40,
border = "rounded",
title = true,
style = "minimal",
auto_focus = true,
anchor = "bottom_right",
offset = { row = -2, col = -2 },
},
window = {
width = 0.4,
height = 0.25,
position = "bottom|right",
floating = false,
border = "none",
},
},
integrations = {
treesitter = {
enabled = true, -- Enable Treesitter integration
highlight = true, -- Enable syntax highlighting
langs = { -- Language mapping for different doc types
lsp = "markdown",
man = "man",
help = "vimdoc",
},
},
},
sources = {
lsp = { enabled = true },
vim = { enabled = true },
man = { enabled = true },
},
priority = { "LSP", "Vim", "Man" },
mappings = {
close = "<leader>dc",
},
},
},
}

View File

@@ -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'

View File

@@ -1,14 +1,17 @@
return {
"nvim-telescope/telescope.nvim",
dependencies = {
"jonarrien/telescope-cmdline.nvim",
"nvim-lua/plenary.nvim",
-- "jonarrien/telescope-cmdline.nvim",
"nat-418/telescope-color-names.nvim",
"nvim-telescope/telescope-file-browser.nvim",
"ghassan0/telescope-glyph.nvim",
"nvim-telescope/telescope-ui-select.nvim",
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release",
},
"folke/noice.nvim",
},
opts = {
defaults = {
@@ -39,6 +42,7 @@ return {
-- actions.which_key shows the mappings for your picker,
-- e.g. git_{create, delete, ...}_branch for the git_branches picker
["<C-h>"] = "which_key",
["<C-u"] = false,
},
},
file_ignore_patterns = { "^node_modules/", "^env/", "^__pycache__/" },
@@ -105,15 +109,15 @@ return {
},
},
},
["ui-select"] = {
require("telescope.themes").get_dropdown({
winblend = 10,
width = 0.5,
prompt = " ",
results_height = 15,
previewer = true,
}),
},
},
},
config = function()
local ts = require("telescope")
ts.load_extension("fzf")
ts.load_extension("glyph")
ts.load_extension("color_names")
-- ts.load_extension("notify")
ts.load_extension("cmdline")
ts.load_extension("file_browser")
end,
}

View File

@@ -37,6 +37,8 @@ return {
"php",
"ruby",
"vue",
"markdown",
"markdown_inline",
},
sync_install = false,
highlight = { enable = true },

View File

@@ -1,143 +1,144 @@
return {
"folke/which-key.nvim",
config = function()
local wk = require("which-key")
opts = {},
-- config = function()
-- local wk = require("which-key")
wk.add({
{ "<leader>C", group = "CodeCompanion", desc = "CodeCompanion", icon = "󰭻" },
{ "<leader>Ca", desc = "CodeCompanion Actions" },
{ "<leader>Cc", desc = "CodeCompanionChat" },
{ "<leader>Cd", desc = "Docstring" },
{ "<leader>Ce", desc = "Explain Code" },
{ "<leader>Ci", desc = "Inline Chat" },
{ "<leader>Cf", desc = "Fix Code" },
{ "<leader>Cl", desc = "Explain LSP Diagnostics" },
{ "<leader>Ct", desc = "Generate Tests" },
{ "<leader>CT", desc = "Toggle CodeCompanionChat" },
-- { "<leader>Ci", desc = "Edit with Instructions" },
-- { "<leader>Co", desc = "Optimize Code" },
-- { "<leader>Cs", desc = "Summarize" },
{ "<leader>K", desc = "Show Docs", icon = "󱔗" },
{ "<leader>T", group = "Telescope", icon = "" },
{ "<leader>Tc", desc = "Color Names" },
{ "<leader>Tg", desc = "Glyph" },
{ "<leader>Tn", desc = "Notifications" },
{ "<leader>Tt", desc = "Telescope" },
{ "<leader>a", group = "AnyJump", icon = "" },
{ "<leader>ab", desc = "Back" },
{ "<leader>al", desc = "Last Result" },
{ "<leader>b", group = "Buffers" },
{ "<leader>bb", desc = "Show Buffers" },
{ "<leader>bd", desc = "Delete Buffer" },
{ "<leader>bn", desc = "Next Buffer" },
{ "<leader>bp", desc = "Previous Buffer" },
{ "<leader>c", group = "Code", icon = "" },
{ "<leader>cD", group = "Diagnostic List" },
{ "<leader>cDn", desc = "Next Diagnostic" },
{ "<leader>cDp", desc = "Previous Diagnostic" },
{ "<leader>ca", desc = "Code Action" },
{ "<leader>cd", desc = "Diagnostics" },
{ "<leader>cl", desc = "Set Loclist" },
{ "<leader>cp", desc = "Copilot Panel" },
{ "<leader>d", group = "Debug" },
{ "<leader>dO", desc = "Step Out" },
{ "<leader>dP", group = "Dap-python" },
{ "<leader>dPc", desc = "Test Class" },
{ "<leader>dPm", desc = "Test Method" },
{ "<leader>dPs", desc = "Debug Selection" },
{ "<leader>db", desc = "Toggle Breakpoint" },
{ "<leader>dc", desc = "Continue" },
{ "<leader>df", desc = "Frames" },
{ "<leader>dh", desc = "Hover" },
{ "<leader>di", desc = "Step Into" },
{ "<leader>dl", desc = "Run Last" },
{ "<leader>do", desc = "Step Over" },
{ "<leader>dp", desc = "Preview" },
{ "<leader>dr", desc = "REPL Open" },
{ "<leader>ds", desc = "Scopes" },
{ "<leader>du", group = "Dap UI" },
{ "<leader>duc", desc = "Close" },
{ "<leader>duo", desc = "Open" },
{ "<leader>dut", desc = "Toggle" },
{ "<leader>f", group = "Find File" },
{ "<leader>fb", desc = "File Browser" },
{ "<leader>fc", desc = "File Color" },
{ "<leader>ff", desc = "Find in Current Directory" },
{ "<leader>fg", desc = "Live Grep" },
{ "<leader>fr", desc = "File Recent" },
{ "<leader>g", group = "Git" },
{ "<leader>gP", desc = "Close goto-preview window" },
{ "<leader>gR", desc = "Telescope References" },
{ "<leader>gb", desc = "Blame" },
{ "<leader>gc", desc = "Commit" },
{ "<leader>gf", desc = "Files" },
{ "<leader>gg", desc = "Lazygit" },
{ "<leader>gp", desc = "Peek" },
{ "<leader>gpc", desc = "Close Preview" },
{ "<leader>gpd", desc = "Preview Definition" },
{ "<leader>gpi", desc = "Preview Implementation" },
{ "<leader>h", group = "Help", icon = "󰋖" },
{ "<leader>hc", desc = "Commands" },
{ "<leader>hd", group = "Dap", icon = "" },
{ "<leader>hdC", desc = "Configurations" },
{ "<leader>hdb", desc = "Breakpoints" },
{ "<leader>hdc", desc = "Commands" },
{ "<leader>hdf", desc = "Frames" },
{ "<leader>hdv", desc = "Variables" },
{ "<leader>hk", desc = "Keymaps" },
{ "<leader>hs", desc = "Spell Suggest" },
{ "<leader>hv", desc = "Vim Options" },
{ "<leader>i", group = "Insert", icon = "" },
{ "<leader>is", group = "Snippet" },
{ "<leader>isp", desc = "Python File" },
{ "<leader>j", desc = "Any Jump", icon = "" },
{ "<leader>cD", desc = "Diagnostics" },
{ "<leader>cR", desc = "Rename" },
{ "<leader>ca", desc = "Code Actions" },
{ "<leader>cc", group = "Calls" },
{ "<leader>cci", desc = "Incoming" },
{ "<leader>cco", desc = "Outgoing" },
{ "<leader>cd", desc = "Definitions" },
{ "<leader>ch", desc = "Signature Help" },
{ "<leader>ci", desc = "Implementations" },
{ "<leader>cr", desc = "References" },
{ "<leader>cs", desc = "Document Symbols" },
{ "<leader>ct", desc = "Type Definitions" },
{ "<leader>cw", desc = "Workspace Symbols" },
{ "<leader>n", desc = "NvimTree" },
{ "<leader>o", group = "Open", icon = "󰮫" },
{ "<leader>oB", desc = "Btop" },
{ "<leader>oC", desc = "Nvim Config" },
{ "<leader>oP", desc = "Ipython (fullscreen)" },
{ "<leader>ob", desc = "File Browser" },
{ "<leader>oc", desc = "CodeCompanionChat" },
{ "<leader>od", desc = "Lazydocker" },
{ "<leader>of", desc = "Floating Terminal" },
{ "<leader>oh", desc = "Horizontal Terminal" },
{ "<leader>op", desc = "Ipython" },
{ "<leader>or", desc = "Ranger" },
{ "<leader>ot", desc = "Vertical Terminal" },
{ "<leader>s", group = "Search" },
{ "<leader>sc", desc = "Clear Highlights" },
{ "<leader>sf", desc = "Files" },
{ "<leader>tG", desc = "Glyph" },
{ "<leader>sg", desc = "Grep" },
{ "<leader>sh", desc = "Command History" },
{ "<leader>sm", desc = "Man Pages" },
{ "<leader>t", group = "Toggle" },
{ "<leader>tP", desc = "Ipython (fullscreen)" },
{ "<leader>tc", desc = "Colorscheme" },
{ "<leader>td", desc = "DBUI" },
{ "<leader>tf", desc = "Floating Terminal" },
{ "<leader>tp", desc = "Ipython" },
{ "<leader>tt", desc = "Split Terminal" },
{ "<leader>w", group = "Workspace" },
{ "<leader>wa", desc = "Add Folder" },
{ "<leader>wl", desc = "List Folders" },
{ "<leader>wr", desc = "Remove Folder" },
{ "<leader>x", group = "Set Executable Bit", desc = "Set Executable Bit" },
{ "<leader>y", desc = "System Yank", icon = "" },
{ "<leader>e", desc = "Edit", icon = "" },
})
end,
-- wk.add({
-- { "<leader>C", group = "CodeCompanion", desc = "CodeCompanion", icon = "󰭻" },
-- { "<leader>Ca", desc = "CodeCompanion Actions" },
-- { "<leader>Cc", desc = "CodeCompanionChat" },
-- { "<leader>Cd", desc = "Docstring" },
-- { "<leader>Ce", desc = "Explain Code" },
-- { "<leader>Ci", desc = "Inline Chat" },
-- { "<leader>Cf", desc = "Fix Code" },
-- { "<leader>Cl", desc = "Explain LSP Diagnostics" },
-- { "<leader>Ct", desc = "Generate Tests" },
-- { "<leader>CT", desc = "Toggle CodeCompanionChat" },
-- -- { "<leader>Ci", desc = "Edit with Instructions" },
-- -- { "<leader>Co", desc = "Optimize Code" },
-- -- { "<leader>Cs", desc = "Summarize" },
-- { "<leader>K", desc = "Show Docs", icon = "󱔗" },
-- { "<leader>T", group = "Telescope", icon = "" },
-- { "<leader>Tc", desc = "Color Names" },
-- { "<leader>Tg", desc = "Glyph" },
-- { "<leader>Tn", desc = "Notifications" },
-- { "<leader>Tt", desc = "Telescope" },
-- { "<leader>a", group = "AnyJump", icon = "" },
-- { "<leader>ab", desc = "Back" },
-- { "<leader>al", desc = "Last Result" },
-- { "<leader>b", group = "Buffers" },
-- { "<leader>bb", desc = "Show Buffers" },
-- { "<leader>bd", desc = "Delete Buffer" },
-- { "<leader>bn", desc = "Next Buffer" },
-- { "<leader>bp", desc = "Previous Buffer" },
-- { "<leader>c", group = "Code", icon = "" },
-- { "<leader>cD", group = "Diagnostic List" },
-- { "<leader>cDn", desc = "Next Diagnostic" },
-- { "<leader>cDp", desc = "Previous Diagnostic" },
-- { "<leader>ca", desc = "Code Action" },
-- { "<leader>cd", desc = "Diagnostics" },
-- { "<leader>cl", desc = "Set Loclist" },
-- { "<leader>cp", desc = "Copilot Panel" },
-- { "<leader>d", group = "Debug" },
-- { "<leader>dO", desc = "Step Out" },
-- { "<leader>dP", group = "Dap-python" },
-- { "<leader>dPc", desc = "Test Class" },
-- { "<leader>dPm", desc = "Test Method" },
-- { "<leader>dPs", desc = "Debug Selection" },
-- { "<leader>db", desc = "Toggle Breakpoint" },
-- { "<leader>dc", desc = "Continue" },
-- { "<leader>df", desc = "Frames" },
-- { "<leader>dh", desc = "Hover" },
-- { "<leader>di", desc = "Step Into" },
-- { "<leader>dl", desc = "Run Last" },
-- { "<leader>do", desc = "Step Over" },
-- { "<leader>dp", desc = "Preview" },
-- { "<leader>dr", desc = "REPL Open" },
-- { "<leader>ds", desc = "Scopes" },
-- { "<leader>du", group = "Dap UI" },
-- { "<leader>duc", desc = "Close" },
-- { "<leader>duo", desc = "Open" },
-- { "<leader>dut", desc = "Toggle" },
-- { "<leader>f", group = "Find File" },
-- { "<leader>fb", desc = "File Browser" },
-- { "<leader>fc", desc = "File Color" },
-- { "<leader>ff", desc = "Find in Current Directory" },
-- { "<leader>fg", desc = "Live Grep" },
-- { "<leader>fr", desc = "File Recent" },
-- { "<leader>g", group = "Git" },
-- { "<leader>gP", desc = "Close goto-preview window" },
-- { "<leader>gR", desc = "Telescope References" },
-- { "<leader>gb", desc = "Blame" },
-- { "<leader>gc", desc = "Commit" },
-- { "<leader>gf", desc = "Files" },
-- { "<leader>gg", desc = "Lazygit" },
-- { "<leader>gp", desc = "Peek" },
-- { "<leader>gpc", desc = "Close Preview" },
-- { "<leader>gpd", desc = "Preview Definition" },
-- { "<leader>gpi", desc = "Preview Implementation" },
-- { "<leader>h", group = "Help", icon = "󰋖" },
-- { "<leader>hc", desc = "Commands" },
-- { "<leader>hd", group = "Dap", icon = "" },
-- { "<leader>hdC", desc = "Configurations" },
-- { "<leader>hdb", desc = "Breakpoints" },
-- { "<leader>hdc", desc = "Commands" },
-- { "<leader>hdf", desc = "Frames" },
-- { "<leader>hdv", desc = "Variables" },
-- { "<leader>hk", desc = "Keymaps" },
-- { "<leader>hs", desc = "Spell Suggest" },
-- { "<leader>hv", desc = "Vim Options" },
-- { "<leader>i", group = "Insert", icon = "" },
-- { "<leader>is", group = "Snippet" },
-- { "<leader>isp", desc = "Python File" },
-- { "<leader>j", desc = "Any Jump", icon = "" },
-- { "<leader>cD", desc = "Diagnostics" },
-- { "<leader>cR", desc = "Rename" },
-- { "<leader>ca", desc = "Code Actions" },
-- { "<leader>cc", group = "Calls" },
-- { "<leader>cci", desc = "Incoming" },
-- { "<leader>cco", desc = "Outgoing" },
-- { "<leader>cd", desc = "Definitions" },
-- { "<leader>ch", desc = "Signature Help" },
-- { "<leader>ci", desc = "Implementations" },
-- { "<leader>cr", desc = "References" },
-- { "<leader>cs", desc = "Document Symbols" },
-- { "<leader>ct", desc = "Type Definitions" },
-- { "<leader>cw", desc = "Workspace Symbols" },
-- { "<leader>n", desc = "NvimTree" },
-- { "<leader>o", group = "Open", icon = "󰮫" },
-- { "<leader>oB", desc = "Btop" },
-- { "<leader>oC", desc = "Nvim Config" },
-- { "<leader>oP", desc = "Ipython (fullscreen)" },
-- { "<leader>ob", desc = "File Browser" },
-- { "<leader>oc", desc = "CodeCompanionChat" },
-- { "<leader>od", desc = "Lazydocker" },
-- { "<leader>of", desc = "Floating Terminal" },
-- { "<leader>oh", desc = "Horizontal Terminal" },
-- { "<leader>op", desc = "Ipython" },
-- { "<leader>or", desc = "Ranger" },
-- { "<leader>ot", desc = "Vertical Terminal" },
-- { "<leader>s", group = "Search" },
-- { "<leader>sc", desc = "Clear Highlights" },
-- { "<leader>sf", desc = "Files" },
-- { "<leader>tG", desc = "Glyph" },
-- { "<leader>sg", desc = "Grep" },
-- { "<leader>sh", desc = "Command History" },
-- { "<leader>sm", desc = "Man Pages" },
-- { "<leader>t", group = "Toggle" },
-- { "<leader>tP", desc = "Ipython (fullscreen)" },
-- { "<leader>tc", desc = "Colorscheme" },
-- { "<leader>td", desc = "DBUI" },
-- { "<leader>tf", desc = "Floating Terminal" },
-- { "<leader>tp", desc = "Ipython" },
-- { "<leader>tt", desc = "Split Terminal" },
-- { "<leader>w", group = "Workspace" },
-- { "<leader>wa", desc = "Add Folder" },
-- { "<leader>wl", desc = "List Folders" },
-- { "<leader>wr", desc = "Remove Folder" },
-- { "<leader>x", group = "Set Executable Bit", desc = "Set Executable Bit" },
-- { "<leader>y", desc = "System Yank", icon = "" },
-- { "<leader>e", desc = "Edit", icon = "" },
-- })
-- end,
}

View File

@@ -0,0 +1,3 @@
return {
require("utils.extensions.telescope"),
}

View File

@@ -0,0 +1,7 @@
local ts = require("telescope")
ts.load_extension("fzf")
ts.load_extension("color_names")
ts.load_extension("file_browser")
ts.load_extension("glyph")
ts.load_extension("ui-select")
ts.load_extension("noice")

View File

@@ -0,0 +1,57 @@
local M = {}
--- Fetches the content from the given URL and then pastes the contents below the current line.
---@param url string The URL to fetch (expects a Git raw URL).
function M.fetch_and_paste(url)
if not url or url == "" then
vim.notify("git-paste: No URL provided.", vim.log.levels.WARN)
return
end
-- Use curl to fetch the raw file content
local result = vim.fn.system({ "curl", "-s", url })
if vim.v.shell_error ~= 0 then
vim.notify("git-paste: Failed to fetch content from URL:\n" .. result, vim.log.levels.ERROR)
return
end
-- Split the result into lines. This creates a table with each line.
local lines = vim.split(result, "\n")
-- Get the current cursor position. This returns a table {line, col}
-- Nvim's API for setting lines expects 0-indexed line numbers.
local pos = vim.api.nvim_win_get_cursor(0)
-- Insert the fetched lines after the current cursor line.
-- Since pos[1] is 1-indexed, we use it directly as the insertion index (which is 0-indexed)
-- when inserting *after* the current line.
local insert_at = pos[1]
vim.api.nvim_buf_set_lines(0, insert_at, insert_at, false, lines)
vim.notify("git-paste: Content pasted successfully", vim.log.levels.INFO)
end
--- Prompts the user for a Git raw URL and then pastes the fetched content.
function M.git_paste_prompt()
vim.ui.input({ prompt = "Git raw URL: " }, function(input)
if input then
M.fetch_and_paste(input)
else
vim.notify("git-paste: No URL provided", vim.log.levels.WARN)
end
end)
end
--- Sets up the git-paste module.
---
--- The module expects an optional configuration table:
--- { telescope_key = "<leader>pg" } (or any other keymap you prefer)
---
---@param opts table|nil
function M.setup(opts)
opts = opts or {}
local telescope_key = opts.telescope_key or "<leader>pg"
vim.keymap.set("n", telescope_key, M.git_paste_prompt, { desc = "Git Paste: paste content from git raw URL" })
end
return M

View 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,
})

View File

@@ -0,0 +1,12 @@
local M = {}
local map = vim.keymap.set
local opts = { noremap = true, silent = true }
function M.set_keybindings(bindings)
for _, binding in ipairs(bindings) do
map(binding.mode, binding.key, binding.cmd, binding.opts or opts)
end
return bindings
end
return M

View File

@@ -0,0 +1,50 @@
local M = {}
local whichkey = require("which-key")
vim.notify = require("notify")
---Helper function to add mappings to which-key
---@parm mappings table : List of mappings to add to which-key
---@parm group table : Group to add mappings to (optional)
---@return nil
---@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)
if group then
whichkey.add({ group.key, group = group.group })
end
if not mappings and not group then
vim.notify("Error: Mappings is nil", "error")
return
elseif not mappings and group then
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
end
if not mapping.cmd or mapping.cmd == "" then
vim.notify("Error: Command is empty or nil for key: " .. mapping.key, "error")
return
end
if not mapping.mode or mapping.mode == "" then
vim.notify("Error: Mode is empty or nil for key: " .. mapping.key, "error")
return
end
wk_mappings[1] = mapping.key
wk_mappings[2] = mapping.cmd
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
return M

View File

@@ -0,0 +1,4 @@
return {
require('utils.keymaps.converters.whichkey'),
require('utils.keymaps.converters.from_table'),
}

View File

@@ -0,0 +1,68 @@
local telescope = require("telescope")
local telescopeConfig = require("telescope.config")
local M = {}
function M.setup()
-- Clone the default Telescope configuration
local vimgrep_arguments = { unpack(telescopeConfig.values.vimgrep_arguments) }
-- I want to search in hidden/dot files.
table.insert(vimgrep_arguments, "--hidden")
-- I don't want to search in the `.git` directory.
table.insert(vimgrep_arguments, "--glob")
table.insert(vimgrep_arguments, "!**/.git/*")
telescope.setup({
defaults = {
-- `hidden = true` is not supported in text grep commands.
vimgrep_arguments = vimgrep_arguments,
},
pickers = {
find_files = {
-- `hidden = true` will still show the inside of `.git/` as it's not `.gitignore`d.
find_command = { "rg", "--files", "--hidden", "--glob", "!**/.git/*" },
mappings = {
n = {
["cd"] = function(prompt_bufnr)
local selection = require("telescope.actions.state").get_selected_entry()
local dir = vim.fn.fnamemodify(selection.path, ":p:h")
require("telescope.actions").close(prompt_bufnr)
-- Depending on what you want put `cd`, `lcd`, `tcd`
vim.cmd(string.format("silent lcd %s", dir))
end,
},
},
},
},
preview = {
-- show images in telescope using kitty
mime_hook = function(filepath, bufnr, opts)
local is_image = function(filepath)
local image_extensions = { "png", "jpg" } -- Supported image formats
local split_path = vim.split(filepath:lower(), ".", { plain = true })
local extension = split_path[#split_path]
return vim.tbl_contains(image_extensions, extension)
end
if is_image(filepath) then
local term = vim.api.nvim_open_term(bufnr, {})
local function send_output(_, data, _)
for _, d in ipairs(data) do
vim.api.nvim_chan_send(term, d .. "\r\n")
end
end
vim.fn.jobstart({
"kitty +icat " .. filepath, -- Terminal image viewer command
}, { on_stdout = send_output, stdout_buffered = true, pty = true })
else
require("telescope.previewers.utils").set_preview_message(
bufnr,
opts.winid,
"Binary cannot be previewed"
)
end
end,
},
})
end
return M

View File

@@ -0,0 +1,6 @@
local M = {}
M.term_factory = require("utils.terminal.term_factory").term_factory
M.term_toggle = require("utils.terminal.toggle").term_toggle
return M

View File

@@ -0,0 +1,12 @@
local Terminal = require("toggleterm.terminal").Terminal
local notify = require("notify")
local M = {}
function M.term_factory(cfg)
cfg["on_stderr"] = function(_, job, data, name)
notify(name .. " encountered an error on job: " .. job .. "\nData: " .. data, "error")
end
return Terminal:new(cfg)
end
return M

View File

@@ -0,0 +1,9 @@
local M = {}
function M.term_toggle(term)
if term then
term:toggle()
end
end
return M

View File

@@ -0,0 +1,15 @@
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.hyprlang = {
install_info = {
url = "~/github/tree-sitter-hyprlang", -- local path or git repo
files = { "src/parser.c" }, -- note that some parsers also require src/scanner.c or src/scanner.cc
-- optional entries:
branch = "main", -- default branch in case of git repo if different from master
generate_requires_npm = false, -- if stand-alone parser without npm dependencies
requires_generate_from_grammar = true, -- if folder contains pre-generated src/parser.c
},
filetype = "conf", -- if filetype does not match the parser name
}
vim.filetype.add({
pattern = { [".*/hypr/.*%.conf"] = "hyprlang" },
})