From 81da838549f215816eb9bdb05e166eaf44275e75 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Thu, 24 Apr 2025 13:06:38 +0300 Subject: [PATCH] Added snacks gitbrowse to open the current file in a github repo (or copy the url of that) --- .config/nvim/init.lua | 8 ++++++++ .config/nvim/lua/plugins/neogit.lua | 2 +- .config/nvim/lua/plugins/snacks.lua | 25 +++++++++++++++++++++++-- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 111d5c4..306d91a 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -3,6 +3,14 @@ vim.loader.enable() vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' +_G.dd = function(...) + Snacks.debug.inspect(...) +end +_G.bt = function() + Snacks.debug.backtrace() +end +vim.print = _G.dd + require('options') vim.schedule(function() require('keymaps') diff --git a/.config/nvim/lua/plugins/neogit.lua b/.config/nvim/lua/plugins/neogit.lua index e1e164f..fafbc66 100644 --- a/.config/nvim/lua/plugins/neogit.lua +++ b/.config/nvim/lua/plugins/neogit.lua @@ -5,7 +5,7 @@ return { { 'gb', 'Neogit branch' }, { 'gs', 'Neogit' }, { 'gL', 'Neogit log' }, - { 'gc', 'Neogit commit' }, + -- { 'gc', 'Neogit commit' }, { 'gp', 'Neogit push' }, { 'gP', 'Neogit pull' }, { 'gr', 'Neogit rebase' }, diff --git a/.config/nvim/lua/plugins/snacks.lua b/.config/nvim/lua/plugins/snacks.lua index 7f2cfa8..6c74e62 100644 --- a/.config/nvim/lua/plugins/snacks.lua +++ b/.config/nvim/lua/plugins/snacks.lua @@ -24,25 +24,46 @@ return { }, }, keys = { + { + 'go', + function() + Snacks.gitbrowse.open() + end, + desc = '[G]it [O]pen', + }, + { + 'gc', + function() + Snacks.gitbrowse.open({ + open = function(url) + vim.fn.setreg('+', url) + end, + }) + end, + desc = '[G]it [O]pen', + }, + { 'si', function() Snacks.image.hover() end, + desc = '[S]how [I]mage', }, + { 'nd', function() Snacks.notifier.hide() end, - desc = '[N]otifications [D]ismiss All', + desc = '[N]otification [D]ismiss All', }, { 'nh', function() Snacks.notifier.show_history() end, - desc = '[N]otifications [D]ismiss All', + desc = '[N]otification [H]istory', }, }, }