kakoune: git-mode fix goto-next-hunk

This commit is contained in:
Leonardo Eugênio 2023-02-23 12:29:37 -03:00
parent f146f03d5c
commit 234d39e0b8
1 changed files with 18 additions and 5 deletions

View File

@ -11,10 +11,14 @@ map global git 's' ': git status<ret>' -docstring 'status'
map global git 'S' '_: git show %val{selection} --<ret>' -docstring 'show'
map global git 'g' ': git-graph <ret>' -docstring 'graph all commits'
map global git 'G' ': git-graph-simpified <ret>' -docstring 'graph all branches'
map global git '<a-g>' ': git-graph-with-remotes<ret>' -docstring 'graph all branches and remotes'
map global git 'd' ': git diff %reg{%}<ret>' -docstring 'diff current'
map global git 'D' ': git diff<ret>' -docstring 'diff all'
map global git '<a-d>' ': git diff --staged<ret>' -docstring 'diff staged'
map global git 'n' ': git next-hunk <ret>' -docstring 'next git modification'
map global git 'p' ': git prev-hunk <ret>' -docstring 'previous git modification'
# make commits
map global git 'a' ': git add<ret>' -docstring 'add current'
map global git 'A' ': git add --all<ret>' -docstring 'add all'
@ -24,13 +28,13 @@ map global git 'c' ': git commit -v<ret>' -docstring 'commit'
map global git 'r' ': git checkout %reg{%}<ret>' -docstring 'restore current'
# deal with merges
map global git 'n' ': git-next-hunk <ret>' -docstring 'next git merge hunk'
map global git 'p' ': git-prev-hunk <ret>' -docstring 'previous git merge hunk'
map global git 'N' ': git-next-merge-conflict <ret>' -docstring 'next git merge conflict'
map global git 'P' ': git-prev-merge-conflict <ret>' -docstring 'previous git merge conflict'
map global git 'm' ': git-merge-head <ret>' -docstring 'merge using head'
map global git 'M' ': git-merge-new <ret>' -docstring 'merge using new'
map global git '<a-m>' ': git-merge-original <ret>' -docstring 'merge using original'
define-command -override git-next-hunk %{
define-command -override git-next-merge-conflict %{
try %{
execute-keys /^<lt>{6,}.*?^<gt>{6,}.*?$<ret>
} 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 <a-/>^<lt>{6,}.*?^<gt>{6,}.*?$<ret>
} 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 '<a-!> timeout 10s git graph --color=always --decorate --all<ret>'
execute-keys '<a-!> timeout 10s git graph --color=always --decorate --branches<ret>'
execute-keys 'gg'
try ansi-render
map buffer normal q ': delete-buffer!<ret>'
@ -105,3 +109,12 @@ define-command -override git-graph-simpified %{
try ansi-render
map buffer normal q ': delete-buffer!<ret>'
}
define-command -override git-graph-with-remotes %{
try %{ delete-buffer '*git-graph*' }
edit -scratch '*git-graph*'
execute-keys '<a-!> timeout 10s git graph --color=always --decorate --all<ret>'
execute-keys 'gg'
try ansi-render
map buffer normal q ': delete-buffer!<ret>'
}