diff --git a/lua/plugins/list.lua b/lua/plugins/list.lua index 94edeb9..327ec6a 100644 --- a/lua/plugins/list.lua +++ b/lua/plugins/list.lua @@ -399,6 +399,10 @@ local plugins = { event = 'VeryLazy', config = load_config('tools.auto-save'), }, + { + 'CRAG666/code_runner.nvim', + config = load_config('tools.code-runner'), + }, -- Telescope { 'nvim-telescope/telescope.nvim', @@ -438,7 +442,7 @@ local plugins = { { 'ruifm/gitlinker.nvim', config = load_config('tools.gitlinker'), - keys = 'gy', + keys = 'yg', }, { 'lewis6991/gitsigns.nvim', diff --git a/lua/plugins/lock.json b/lua/plugins/lock.json index 2213c04..7af499c 100644 --- a/lua/plugins/lock.json +++ b/lua/plugins/lock.json @@ -9,8 +9,9 @@ "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "co-author.nvim": { "branch": "main", "commit": "62fbb6d6a58339c968bcea92d0f097f4ea1efaa5" }, - "codeium.vim": { "branch": "main", "commit": "31dd2962c81759be007895db6ce089feec397c86" }, + "co-author.nvim": { "branch": "main", "commit": "3beddbbd5fdf3121921fc7b28fd731cffc70f952" }, + "code_runner.nvim": { "branch": "main", "commit": "d135c4178bf8980ca5fa4aa6e27ab9ee4373c875" }, + "codeium.vim": { "branch": "main", "commit": "cec58651f90abc84fbc333ed1067664026db666c" }, "compiler.nvim": { "branch": "main", "commit": "cb14acd32ba9ea09d01bbe3493aefdc59b68965c" }, "dashboard-nvim": { "branch": "master", "commit": "1c8b82c5b02bb890862538be2061e37ef801a99b" }, "dracula.nvim": { "branch": "main", "commit": "8d8bddb8814c3e7e62d80dda65a9876f97eb699c" }, @@ -18,7 +19,7 @@ "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" }, "friendly-snippets": { "branch": "main", "commit": "d5f74ce4dfdd82848f3f4eac65fe6e29ac5df4c2" }, "gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" }, - "gitsigns.nvim": { "branch": "main", "commit": "790355f00af1fc2c330ea1b2b7f68d65f19b57c9" }, + "gitsigns.nvim": { "branch": "main", "commit": "9cafac31a091267838e1e90fd6e083d37611f516" }, "hardtime.nvim": { "branch": "main", "commit": "eaf4bc31b86419c26ad7b3a142dd36ca545ca2e4" }, "harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" }, "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" }, @@ -47,12 +48,12 @@ "nvim-dap": { "branch": "master", "commit": "6ae8a14828b0f3bff1721a35a1dfd604b6a933bb" }, "nvim-dap-ui": { "branch": "master", "commit": "5934302d63d1ede12c0b22b6f23518bb183fc972" }, "nvim-lspconfig": { "branch": "master", "commit": "aa5f4f4ee10b2688fb37fa46215672441d5cd5d9" }, - "nvim-nio": { "branch": "master", "commit": "79e8968769d4422c08d514a413815bea6c1f67f9" }, + "nvim-nio": { "branch": "master", "commit": "8765cbc4d0c629c8158a5341e1b4305fd93c3a90" }, "nvim-notify": { "branch": "master", "commit": "5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15" }, "nvim-spectre": { "branch": "master", "commit": "4651801ba37a9407b7257287aec45b6653ffc5e9" }, "nvim-spider": { "branch": "main", "commit": "76819082ef964db1f67f92454e18ad28ae34b37b" }, "nvim-tree.lua": { "branch": "master", "commit": "347e1eb35264677f66a79466bb5e3d111968e12c" }, - "nvim-treesitter": { "branch": "master", "commit": "1a4274c9e1226fb4c2009f4c0c3521b1931b0c5c" }, + "nvim-treesitter": { "branch": "master", "commit": "b1f3f02027f1fd21956c1e219878764014498a59" }, "nvim-treesitter-endwise": { "branch": "master", "commit": "8b34305ffc28bd75a22f5a0a9928ee726a85c9a6" }, "nvim-treesitter-refactor": { "branch": "master", "commit": "65ad2eca822dfaec2a3603119ec3cc8826a7859e" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "23b820146956b3b681c19e10d3a8bc0cbd9a1d4c" }, @@ -60,7 +61,7 @@ "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "a6382f744f584bbf71d0a563af789af7190aabda" }, "nvim-web-devicons": { "branch": "master", "commit": "794bba734ec95eaff9bb82fbd112473be2087283" }, - "oil.nvim": { "branch": "master", "commit": "f3a31eba24587bc038592103d8f7e64648292115" }, + "oil.nvim": { "branch": "master", "commit": "bcfc0a2e01def5019aa14fac2fc6de20dedb6d3d" }, "overseer.nvim": { "branch": "master", "commit": "89942ad366c8a9bb93f82411de17dc7c644b4e3b" }, "plenary.nvim": { "branch": "master", "commit": "08e301982b9a057110ede7a735dd1b5285eb341f" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "7ef0766b5cd2f5cdf4fcb08886f0a2ebf65981fa" }, @@ -72,12 +73,12 @@ "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, "telescope-menufacture": { "branch": "main", "commit": "79376f887f589a4240267383e8abc0a31861325a" }, "telescope-symbols.nvim": { "branch": "master", "commit": "a6d0127a53d39b9fc2af75bd169d288166118aec" }, - "telescope-undo.nvim": { "branch": "main", "commit": "d19e2edc8b18d03283bd91f67310ac300ad003ce" }, - "telescope.nvim": { "branch": "master", "commit": "2d0d057791854decb2c9b6a0b52d43f3900dff40" }, + "telescope-undo.nvim": { "branch": "main", "commit": "95b61c01ea3a4c9e8747731148e905bbcf0ccaee" }, + "telescope.nvim": { "branch": "master", "commit": "fac83a556e7b710dc31433dec727361ca062dbe9" }, "termim.nvim": { "branch": "main", "commit": "2dba526e99c32a65db9599cfa90e85db13724a44" }, "ts-node-action": { "branch": "master", "commit": "6d3b60754fd87963d70eadaa2f77873b447eac26" }, "twilight.nvim": { "branch": "main", "commit": "8b7b50c0cb2dc781b2f4262a5ddd57571556d1e4" }, - "vim-fugitive": { "branch": "master", "commit": "dac8e5c2d85926df92672bf2afb4fc48656d96c7" }, + "vim-fugitive": { "branch": "master", "commit": "ce882460cf3db12e99f8bf579cbf99e331f6dd4f" }, "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }, "zen-mode.nvim": { "branch": "main", "commit": "78557d972b4bfbb7488e17b5703d25164ae64e6a" } } \ No newline at end of file diff --git a/lua/plugins/tools/code-runner.lua b/lua/plugins/tools/code-runner.lua new file mode 100644 index 0000000..a2ef7f1 --- /dev/null +++ b/lua/plugins/tools/code-runner.lua @@ -0,0 +1,33 @@ +require('code_runner').setup({ + filetype = { + java = { + "cd $dir &&", + "javac $fileName &&", + "java $fileNameWithoutExt" + }, + python = "python3 -u", + typescript = "deno run", + rust = { + "cd $dir &&", + "rustc $fileName &&", + "$dir/$fileNameWithoutExt" + }, + c = function(...) + c_base = { + "cd $dir &&", + "gcc $fileName -o", + "/tmp/$fileNameWithoutExt", + } + local c_exec = { + "&& /tmp/$fileNameWithoutExt &&", + "rm /tmp/$fileNameWithoutExt", + } + vim.ui.input({ prompt = "Add more args:" }, function(input) + c_base[4] = input + vim.print(vim.tbl_extend("force", c_base, c_exec)) + require("code_runner.commands").run_from_fn(vim.list_extend(c_base, c_exec)) + end) + end, + }, +}) + diff --git a/lua/plugins/tools/gitlinker.lua b/lua/plugins/tools/gitlinker.lua index a3ca9d8..a16dbcd 100644 --- a/lua/plugins/tools/gitlinker.lua +++ b/lua/plugins/tools/gitlinker.lua @@ -20,5 +20,5 @@ gitlinker.setup({ ['git.kernel.org'] = require('gitlinker.hosts').get_cgit_type_url, ['git.savannah.gnu.org'] = require('gitlinker.hosts').get_cgit_type_url, }, - mappings = 'gy', + mappings = 'yg', }) diff --git a/lua/plugins/tools/harpoon.lua b/lua/plugins/tools/harpoon.lua index 0e97ba3..218a415 100644 --- a/lua/plugins/tools/harpoon.lua +++ b/lua/plugins/tools/harpoon.lua @@ -20,3 +20,33 @@ local function toggle_telescope(harpoon_files) :find() end +vim.keymap.set('n', 'ha', function() + harpoon:list():append() +end, { desc = 'Add Mark' }) +vim.keymap.set('n', 'hh', function() + toggle_telescope(harpoon:list()) +end, { desc = 'Telescope Marks' }) +vim.keymap.set('n', 'hm', function() + harpoon.ui:toggle_quick_menu(harpoon:list()) +end, { desc = 'Open UI' }) + +vim.keymap.set('n', '[h', function() + harpoon:list():prev() +end, { desc = 'Prev Mark' }) +vim.keymap.set('n', ']h', function() + harpoon:list():next() +end, { desc = 'Next Mark' }) + +vim.keymap.set('n', 'hk', function() + harpoon:list():prev() +end, { desc = 'Prev Mark' }) +vim.keymap.set('n', 'hj', function() + harpoon:list():next() +end, { desc = 'Next Mark' }) + +for i = 1, 9 do + vim.keymap.set('n', 'h' .. i, function() + harpoon:list():select(i) + end, { desc = 'Mark ' .. i }) +end + diff --git a/lua/plugins/tools/which-key.lua b/lua/plugins/tools/which-key.lua index 279c477..df1d513 100644 --- a/lua/plugins/tools/which-key.lua +++ b/lua/plugins/tools/which-key.lua @@ -167,10 +167,7 @@ local mappings = { f = { name = icons.ui.Telescope .. 'Find', b = { 'Telescope buffers', 'Buffers' }, - B = { 'Telescope git_branches', 'Checkout branch' }, a = { 'lua require("telescope").extensions.menufacture.find_files()', 'All Files' }, - c = { 'Telescope git_bcommits', 'File Commits' }, - C = { 'Telescope git_commits', 'Git Commits' }, d = { 'Telescope file_browser', 'Browse Folders' }, e = { 'Oil', 'Dir Editor' }, f = { 'lua require("telescope").extensions.menufacture.git_files()', 'Find files' }, @@ -198,8 +195,11 @@ local mappings = { a = { 'Gitsigns stage_hunk', 'Stage Hunk' }, A = { 'Gitsigns stage_buffer', 'Stage Buffer' }, b = { 'Gitsigns blame_line', 'Blame' }, - c = { 'Git', 'Commit' }, - C = { 'CoAuthor', 'Add Co Author' }, + B = { 'Telescope git_branches', 'Branches' }, + c = { 'Telescope git_bcommits', 'File Commits' }, + C = { 'Telescope git_commits', 'Commits' }, + f = { 'Git', 'Fugitive' }, + F = { 'CoAuthor', 'Find Co Author' }, d = { 'Gitsigns preview_hunk', 'Preview Hunk' }, D = { 'Gitsigns diffthis HEAD', 'Diff' }, g = { 'Fterm lazygit', 'Lazygit' }, @@ -390,7 +390,7 @@ local vmappings = { x = { 'x', icons.ui.Pencil .. 'Write and Quit' }, y = { name = icons.ui.Clipboard .. 'Yank', - g = { 'lua require"gitlinker".get_buf_range_url()', 'Copy Git URL' }, + g = { 'lua require"gitlinker".get_buf_range_url("v")', 'Copy Git URL' }, }, } diff --git a/lua/plugins/ui/dressing.lua b/lua/plugins/ui/dressing.lua index e6f2ef0..eb32f4c 100644 --- a/lua/plugins/ui/dressing.lua +++ b/lua/plugins/ui/dressing.lua @@ -8,11 +8,11 @@ dressing.setup({ input = { enabled = true, default_prompt = 'Input:', - prompt_align = 'left', + prompt_align = 'center', insert_only = true, start_in_insert = true, border = 'rounded', - relative = 'cursor', + relative = 'editor', prefer_width = 40, width = nil, max_width = { 140, 0.9 }, @@ -21,7 +21,7 @@ dressing.setup({ }, select = { enabled = true, - backend = { 'telescope', 'fzf_lua', 'fzf', 'nui', 'builtin' }, + backend = { 'telescope', 'fzf_lua', 'fzf', 'nui', 'builtin'}, trim_prompt = true, }, }) diff --git a/lua/plugins/ui/notify.lua b/lua/plugins/ui/notify.lua index a006fe4..13e636a 100644 --- a/lua/plugins/ui/notify.lua +++ b/lua/plugins/ui/notify.lua @@ -1,56 +1,19 @@ -local notify = require('notify') +vim.notify = require("notify") -local icons = require('lib.icons') - -notify.setup({ - background_colour = '#000', - fps = 30, - icons = { - DEBUG = icons.ui.Bug, - ERROR = icons.diagnostics.Error, - INFO = icons.diagnostics.Information, - TRACE = icons.ui.Bookmark, - WARN = icons.diagnostics.Warning, - }, - level = 2, - render = 'default', - stages = 'fade_in_slide_out', - timeout = 2000, - top_down = true, - - max_height = function() - return math.floor(vim.o.lines * 0.75) - end, - max_width = function() - return math.floor(vim.o.columns * 0.75) - end, - on_open = function(win) - vim.api.nvim_win_set_config(win, { zindex = 100 }) - end, +require("notify").setup({ + background_colour = "Normal", + fps = 30, + icons = { + DEBUG = " ", + ERROR = " ", + INFO = " ", + TRACE = "✎", + WARN = " " + }, + level = 2, + minimum_width = 30, + maximum_width = 30, + render = "wrapped-compact", + stages = "slide", + timeout = 2000 }) - --- Controls noisy notifications -local buffered_messages = { - 'Client %d+ quit', - 'No node found at cursor', -} - -local message_notifications = {} -vim.notify = function(msg, level, opts) - opts = opts or {} - for _, pattern in ipairs(buffered_messages) do - if string.find(msg, pattern) then - if message_notifications[pattern] then - opts.replace = message_notifications[pattern] - end - - opts.on_close = function() - message_notifications[pattern] = nil - end - message_notifications[pattern] = notify.notify(msg, level, opts) - return - end - end - - notify.notify(msg, level, opts) -end