kak: update git mode

This commit is contained in:
Leonardo Eugênio 2023-02-14 17:50:49 -03:00
parent 836bb4a4a6
commit ef329f2dac

View file

@ -5,22 +5,47 @@ try %{
map global user 'v' ': enter-user-mode git<ret>' -docstring 'git vcs mode' map global user 'v' ': enter-user-mode git<ret>' -docstring 'git vcs mode'
map global user 'V' ': enter-user-mode -lock git<ret>' -docstring 'git vcs mode' map global user 'V' ': enter-user-mode -lock git<ret>' -docstring 'git vcs mode'
# show status
map global git 's' ': git status<ret>' -docstring 'status' map global git 's' ': git status<ret>' -docstring 'status'
map global git 'S' '_: git show %val{selection} --<ret>' -docstring 'show' map global git 'S' '_: git show %val{selection} --<ret>' -docstring 'show'
map global git 'a' ': git add<ret>' -docstring 'add current' 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 'd' ': git diff %reg{%}<ret>' -docstring 'diff current' map global git 'd' ': git diff %reg{%}<ret>' -docstring 'diff current'
map global git 'r' ': git checkout %reg{%}<ret>' -docstring 'restore current'
map global git 'A' ': git add --all<ret>' -docstring 'add all'
map global git 'D' ': git diff<ret>' -docstring 'diff all' 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 '<a-d>' ': git diff --staged<ret>' -docstring 'diff staged'
# make commits
map global git 'a' ': git add<ret>' -docstring 'add current'
map global git 'A' ': git add --all<ret>' -docstring 'add all'
map global git 'c' ': git commit -v<ret>' -docstring 'commit' map global git 'c' ': git commit -v<ret>' -docstring 'commit'
map global git 'u' ': git update-diff<ret>' -docstring 'update gutter diff'
map global git 'n' ': git next-hunk <ret>' -docstring 'next hunk' # discard work
map global git 'p' ': git prev-hunk <ret>' -docstring 'previous hunk' 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 'm' ': git-merge-head <ret>' -docstring 'merge using head' 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 'M' ': git-merge-new <ret>' -docstring 'merge using new'
map global git '<a-m>' ': git-merge-original <ret>' -docstring 'merge using original' map global git '<a-m>' ': git-merge-original <ret>' -docstring 'merge using original'
define-command -override git-next-hunk %{
try %{
execute-keys /^<lt>{6,}.*?^<gt>{6,}.*?$<ret>
} catch %{
fail "No hunks found forward"
}
} -docstring "next git merge hunk"
define-command -override git-prev-hunk %{
try %{
execute-keys <a-/>^<lt>{6,}.*?^<gt>{6,}.*?$<ret>
} catch %{
fail "No hunks found backwards"
}
} -docstring "previous git merge hunk"
define-command -override git-merge-head %{ define-command -override git-merge-head %{
evaluate-commands -draft %{ evaluate-commands -draft %{
# delete head marker # delete head marker
@ -62,3 +87,21 @@ define-command -override git-merge-new %{
execute-keys /^<gt>{4,}<ret><a-x>d execute-keys /^<gt>{4,}<ret><a-x>d
} }
} -docstring "merge using new" } -docstring "merge using 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 'gg'
try ansi-render
map buffer normal q ': delete-buffer!<ret>'
}
define-command -override git-graph-simpified %{
try %{ delete-buffer '*git-graph*' }
edit -scratch '*git-graph*'
execute-keys '<a-!> timeout 10s git graph --color=always --decorate --all --simplify-by-decoration<ret>'
execute-keys 'gg'
try ansi-render
map buffer normal q ': delete-buffer!<ret>'
}