try %{ # declare-user-mode surround declare-user-mode git } map global user 'v' ': enter-user-mode git' -docstring 'git vcs mode' map global user 'V' ': enter-user-mode -lock git' -docstring 'git vcs mode' map global git 's' ': git status' -docstring 'status' map global git 'S' '_: git show %val{selection} --' -docstring 'show' map global git 'a' ': git add' -docstring 'add current' map global git 'd' ': git diff %reg{%}' -docstring 'diff current' map global git 'r' ': git checkout %reg{%}' -docstring 'restore current' map global git 'A' ': git add --all' -docstring 'add all' map global git 'D' ': git diff' -docstring 'diff all' map global git '' ': git diff --staged' -docstring 'diff staged' map global git 'c' ': git commit -v' -docstring 'commit' map global git 'u' ': git update-diff' -docstring 'update gutter diff' map global git 'n' ': git next-hunk ' -docstring 'next hunk' map global git 'p' ': git prev-hunk ' -docstring 'previous hunk' 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-merge-head %{ evaluate-commands -draft %{ # delete head marker execute-keys ^{4,}d try %{ # select original marker execute-keys /^[|]{4,} # extend to theirs marker execute-keys ?^={4,} } catch %{ # select theirs marker execute-keys /^={4,} } # extend to end marker execute-keys ?^{4,}d } } -docstring "merge using head" define-command -override git-merge-original %{ evaluate-commands -draft %{ # select head marker execute-keys ^{4,} # select to middle of conflict execute-keys ?^[|]{4,}d # select theirs marker execute-keys /^={4,} # extend to end marker execute-keys ?^{4,}d } } -docstring "merge using original" define-command -override git-merge-new %{ evaluate-commands -draft %{ # select head marker execute-keys ^{4,} # extend to theirs marker execute-keys ?^={4,}\nd # delete end marker execute-keys /^{4,}d } } -docstring "merge using new"