From 234d39e0b836569b19164c4f08b881d66b9d11c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Thu, 23 Feb 2023 12:29:37 -0300 Subject: [PATCH] kakoune: git-mode fix goto-next-hunk --- user/kakoune/git-mode.kak | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/user/kakoune/git-mode.kak b/user/kakoune/git-mode.kak index e341cb7..419f96f 100644 --- a/user/kakoune/git-mode.kak +++ b/user/kakoune/git-mode.kak @@ -11,10 +11,14 @@ map global git 's' ': git status' -docstring 'status' map global git 'S' '_: git show %val{selection} --' -docstring 'show' map global git 'g' ': git-graph ' -docstring 'graph all commits' map global git 'G' ': git-graph-simpified ' -docstring 'graph all branches' +map global git '' ': git-graph-with-remotes' -docstring 'graph all branches and remotes' map global git 'd' ': git diff %reg{%}' -docstring 'diff current' map global git 'D' ': git diff' -docstring 'diff all' map global git '' ': git diff --staged' -docstring 'diff staged' +map global git 'n' ': git next-hunk ' -docstring 'next git modification' +map global git 'p' ': git prev-hunk ' -docstring 'previous git modification' + # make commits map global git 'a' ': git add' -docstring 'add current' map global git 'A' ': git add --all' -docstring 'add all' @@ -24,13 +28,13 @@ map global git 'c' ': git commit -v' -docstring 'commit' map global git 'r' ': git checkout %reg{%}' -docstring 'restore current' # deal with merges -map global git 'n' ': git-next-hunk ' -docstring 'next git merge hunk' -map global git 'p' ': git-prev-hunk ' -docstring 'previous git merge hunk' +map global git 'N' ': git-next-merge-conflict ' -docstring 'next git merge conflict' +map global git 'P' ': git-prev-merge-conflict ' -docstring 'previous git merge conflict' map global git 'm' ': git-merge-head ' -docstring 'merge using head' map global git 'M' ': git-merge-new ' -docstring 'merge using new' map global git '' ': git-merge-original ' -docstring 'merge using original' -define-command -override git-next-hunk %{ +define-command -override git-next-merge-conflict %{ try %{ execute-keys /^{6,}.*?^{6,}.*?$ } catch %{ @@ -38,7 +42,7 @@ define-command -override git-next-hunk %{ } } -docstring "next git merge hunk" -define-command -override git-prev-hunk %{ +define-command -override git-prev-merge-conflict %{ try %{ execute-keys ^{6,}.*?^{6,}.*?$ } catch %{ @@ -91,7 +95,7 @@ define-command -override git-merge-new %{ define-command -override git-graph %{ try %{ delete-buffer '*git-graph*' } edit -scratch '*git-graph*' - execute-keys ' timeout 10s git graph --color=always --decorate --all' + execute-keys ' timeout 10s git graph --color=always --decorate --branches' execute-keys 'gg' try ansi-render map buffer normal q ': delete-buffer!' @@ -105,3 +109,12 @@ define-command -override git-graph-simpified %{ try ansi-render map buffer normal q ': delete-buffer!' } + +define-command -override git-graph-with-remotes %{ + try %{ delete-buffer '*git-graph*' } + edit -scratch '*git-graph*' + execute-keys ' timeout 10s git graph --color=always --decorate --all' + execute-keys 'gg' + try ansi-render + map buffer normal q ': delete-buffer!' +}