aboutsummaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-10-20 17:45:21 +0530
committerAkshay Nair <phenax5@gmail.com>2025-10-21 13:39:46 +0530
commit662295b04b96580bcf1c78df9d13dca89adaa454 (patch)
tree9bbd181c74fe4db81158f32b9efbc9a8385897d8 /autoload
parentdff6bdcbd6951a38d1d4f43b4ab5342fbe4ca258 (diff)
downloadkakoune-config-662295b04b96580bcf1c78df9d13dca89adaa454.tar.gz
kakoune-config-662295b04b96580bcf1c78df9d13dca89adaa454.zip
Add git selection line blame
Diffstat (limited to 'autoload')
-rw-r--r--autoload/+init.kak12
-rw-r--r--autoload/git.kak9
-rw-r--r--autoload/orgmode/orgmode.kak27
3 files changed, 31 insertions, 17 deletions
diff --git a/autoload/+init.kak b/autoload/+init.kak
index 4c71b83..f2cc02a 100644
--- a/autoload/+init.kak
+++ b/autoload/+init.kak
@@ -40,9 +40,10 @@ map global user 'r' '*%s<ret>'
declare-user-mode system
map global user q ': enter-user-mode system<ret>' -docstring 'System mode'
-map global system o ': echo %opt{}<left>'
-map global system v ': echo %val{}<left>'
-map global system d ': buffer *debug*<ret>'
+map global system o ':echo %opt{}<left>'
+map global system v ':echo %val{}<left>'
+map global system d ':buffer *debug*<ret>'
+map global system f ':fennel %{()}<left><left>'
# Preserve count for user modes (look for alternatives)
# TODO: Reset count on modechange?
@@ -123,3 +124,8 @@ define-command define-surround -params 3 %{
# # define-surround "'" "'" "'"
# }
+
+hook global BufCreate .*[.]mdx %{
+ set-option buffer filetype markdown
+}
+
diff --git a/autoload/git.kak b/autoload/git.kak
index e0db3c4..20eab1e 100644
--- a/autoload/git.kak
+++ b/autoload/git.kak
@@ -12,6 +12,7 @@ map global git C ': git add commit --amend<ret>' -docstring 'Amend commit'
map global git r ': enter-user-mode git-r<ret>' -docstring 'Git re(base/set) mode'
map global git-r f ': git reset HEAD^1 -- %val{buffile}<ret>' -docstring 'Split file out of last commit'
+map global git m ': git-line-blame<ret>' -docstring 'Blame selection lines'
# Hunk
map global git n ': git next-hunk<ret>' -docstring 'Next hunk'
@@ -27,6 +28,14 @@ define-command git-toggle-diff %{
try %{ remove-highlighter window/git-diff } catch %{ git show-diff } catch %{ }
}
+define-command git-line-blame %{
+ evaluate-commands %sh{
+ file="${kak_buffile}"
+ line="$(echo "$kak_selection_desc" | sed -E 's/\.[0-9]+//g')"
+ echo "terminal sh -c \"git --no-pager log -u -L '$line:$file' --color=always | delta\""
+ }
+}
+
# TODO: Toggle this
# hook global -group git-diff-if-repo EnterDirectory .* %{
# remove-hooks global git-diff
diff --git a/autoload/orgmode/orgmode.kak b/autoload/orgmode/orgmode.kak
index 15e3ba3..370ea14 100644
--- a/autoload/orgmode/orgmode.kak
+++ b/autoload/orgmode/orgmode.kak
@@ -20,22 +20,21 @@ define-command orgmode-toggle %{
define-command orgmode-jump-link %{
# TODO: support multiple links in single line
- evaluate-commands -draft %{ try %{
+ evaluate-commands %{ try %{
execute-keys ',xs\[\[([^\n\]]+)\]<ret>'
- set-register a %reg{1}
+ evaluate-commands %sh{
+ [ -z "$kak_reg_1" ] && exit 0
+ case "$kak_reg_1" in
+ https://*|http://*) xdg-open "$kak_reg_1" >/dev/null 2>&1 ;;
+ /*|~/*) echo "edit %{$kak_reg_1}" ;;
+ *)
+ current_path="${kak_buffile:-"$kak_bufname"}"
+ path="$(realpath -s "$(dirname "$kak_buffile")/$kak_reg_1")"
+ echo "edit %{$path}"
+ ;;
+ esac
+ }
} }
- evaluate-commands %sh{
- [ -z "$kak_reg_a" ] && exit 0
- case "$kak_reg_a" in
- https://*|http://*) xdg-open "$kak_reg_a" >/dev/null 2>&1 ;;
- /*|~/*) echo "edit %{$kak_reg_a}" ;;
- *)
- current_path="${kak_buffile:-"$kak_bufname"}"
- path="$(realpath -s "$(dirname "$kak_buffile")/$kak_reg_a")"
- echo "edit %{$path}"
- ;;
- esac
- }
}
define-command orgmode-toggle-checkbox %{