From 1f0b857f0f3ced3b505ebedb168845bcfd9e24c9 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Fri, 20 Sep 2024 21:45:33 -0400 Subject: [PATCH] Update gitlinker, use custom router for gitea --- nvim/.config/nvim/after/plugin/config.lua | 53 +++++++++++++++++------ nvim/.config/nvim/lazy-lock.json | 2 +- nvim/.config/nvim/lua/plugins.lua | 2 +- 3 files changed, 42 insertions(+), 15 deletions(-) diff --git a/nvim/.config/nvim/after/plugin/config.lua b/nvim/.config/nvim/after/plugin/config.lua index 0edf073..1d5ea7d 100644 --- a/nvim/.config/nvim/after/plugin/config.lua +++ b/nvim/.config/nvim/after/plugin/config.lua @@ -5,19 +5,42 @@ vim.keymap.set("n", "bd", function() end) --- gitlinker.nvim -require"gitlinker".setup() -vim.keymap.set("n", "gh", function() - require"gitlinker".get_buf_range_url( - "n", - { action_callback = require"gitlinker.actions".open_in_browser } - ) -end, { silent = true }) -vim.keymap.set("v", "gh", function() - require"gitlinker".get_buf_range_url( - "v", - { action_callback = require"gitlinker.actions".open_in_browser } - ) -end) +require"gitlinker".setup({ + router = { + browse = { + ["^git%.atomaka%.com"] = "https://git.atomaka.com/" + .. "{_A.ORG}/" + .. "{_A.REPO}/commit/" + .. "{_A.REV}/" + }, + blame = { + ["^git%.atomaka%.com"] = "https://git.atomaka.com/" + .. "{_A.ORG}/" + .. "{_A.REPO}/blame/" + .. "branch/{_A.CURRENT_BRANCH}/" + .. "{_A.FILE}" + }, + }, +}) +vim.keymap.set( + {"n", 'v'}, + "gl", + function() + require("gitlinker").link({ action = require("gitlinker.actions").system }) + end, + { silent = true, noremap = true, desc = "GitLink!" } +) +vim.keymap.set( + {"n", 'v'}, + "glb", + function() + require("gitlinker").link({ + router_type = "blame", + action = require("gitlinker.actions").system, + }) + end, + { silent = true, noremap = true, desc = "GitLink! blame" } +) --- gitsigns.nvim require("gitsigns").setup() @@ -30,6 +53,10 @@ vim.g["git_messenger_always_into_popup"] = 1 require("nvim-surround").setup() --- telescope.nvim +vim.api.nvim_set_keymap('n', 't', ':Telescope', { + noremap = true, + silent = true, +}) vim.keymap.set("n", "", function() require("telescope.builtin").find_files({ file_ignore_patterns = {".git/", "node_modules/"}, diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index 2ce3218..8d2e408 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -2,7 +2,7 @@ "bufdelete.nvim": { "branch": "master", "commit": "f6bcea78afb3060b198125256f897040538bcb81" }, "editorconfig.nvim": { "branch": "master", "commit": "5b9e303e1d6f7abfe616ce4cc8d3fffc554790bf" }, "git-messenger.vim": { "branch": "master", "commit": "edc603d4cda7894a743e383e16c638e206d03148" }, - "gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" }, + "gitlinker.nvim": { "branch": "master", "commit": "a221c13fc3c7f5b8799933f4966ee8e618287292" }, "gitsigns.nvim": { "branch": "main", "commit": "1ef74b546732f185d0f806860fa5404df7614f28" }, "gruvbox": { "branch": "master", "commit": "143a3b8babcfd2bce6c99d6ba496942647c3e30b" }, "lazy.nvim": { "branch": "main", "commit": "460e1cd8f24e364d54543a4b0e83f6f4ec1f65fb" }, diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua index 855fc94..cc0d55d 100644 --- a/nvim/.config/nvim/lua/plugins.lua +++ b/nvim/.config/nvim/lua/plugins.lua @@ -21,7 +21,7 @@ require("lazy").setup({ -- "FabijanZulj/blame.nvim", "rhysd/git-messenger.vim", "lewis6991/gitsigns.nvim", - "ruifm/gitlinker.nvim", + "linrongbin16/gitlinker.nvim", "tpope/vim-eunuch", "gruvbox-community/gruvbox",