aboutsummaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2026-06-26 13:50:48 +0530
committerAkshay Nair <phenax5@gmail.com>2026-06-26 13:50:48 +0530
commitd2f4982e389431b74357bbc108567ae0e1d912a5 (patch)
treed9e18402fda762f5f8840d6974b89981625ce5f0 /autoload
parentd2995bc1d5968b5e8d018135748c6768f920d3c8 (diff)
downloadkakoune-config-d2f4982e389431b74357bbc108567ae0e1d912a5.tar.gz
kakoune-config-d2f4982e389431b74357bbc108567ae0e1d912a5.zip
Add open selection in git remote url
Diffstat (limited to 'autoload')
-rw-r--r--autoload/git.kak15
1 files changed, 13 insertions, 2 deletions
diff --git a/autoload/git.kak b/autoload/git.kak
index 59ac173..775cf0d 100644
--- a/autoload/git.kak
+++ b/autoload/git.kak
@@ -6,8 +6,6 @@ define-command gitui -params .. %{
gitu %arg{@}
}
-# TODO: Script to open git remote url (github/srht/gitlab/etc)
-
declare-user-mode git
declare-user-mode git-r
declare-user-mode git-d
@@ -16,6 +14,7 @@ map global git s ': gitui<ret>' -docstring 'Git tui'
map global git A ': git add %val{buffile}<ret>' -docstring 'Add file'
map global git m ': git-line-blame<ret>' -docstring 'Blame selection lines'
map global git M ': git-file-blame<ret>' -docstring 'Blame buffer file'
+map global git l ': git-link<ret>' -docstring 'Open remote link to selection in file'
map global git d ': enter-user-mode git-d<ret>' -docstring 'Diff mode'
map global git-d d ': git-open-diff<ret>' -docstring 'Open staged files'
@@ -53,3 +52,15 @@ define-command git-open-diff -params 0..1 %{
define-command git-open-commit -params 0..1 %{
eval %sh{ git show --name-only --pretty="" "$@" | sed 's/^/edit /' }
}
+
+define-command git-link %{
+ eval %sh{
+ line_start=${kak_selection_desc%%.*}
+ tmp=${kak_selection_desc#*,}
+ line_end=${tmp%%.*}
+ link=$("$kak_config/scripts/git.clj" link "$kak_buffile" "$line_start" "$line_end")
+ xdg-open "$link" || true >/dev/null
+ echo "info '$link'"
+ }
+}
+