Skip to content

Commit 0cd4e47

Browse files
authored
Merge pull request #148 from lambdalisue/accept-and-cancel-aliases
👍 Add `:Accept` and `:Cancel` aliases for "gitcommit" and "gitrebase"
2 parents 093528d + 2beadf0 commit 0cd4e47

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

doc/gin.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ It asks if users want to apply or cancel changes when |:quit| command is
8484
invoked. Answer "yes" to apply changes and others to cancel changes. Or use
8585
:Accept or :Cancel buffer local command to directly apply or cancel changes.
8686

87+
Note that this :Accept and :Cancel command are aliased to |:wq| and |:cq|
88+
respectively for "gitcommit" and "gitrebase" filetype buffers so that users
89+
can use the same keybindings even they invoke "git commit" or "git rebase -i"
90+
outside of Vim.
91+
8792
Use |g:gin_proxy_apply_without_confirm| to apply changes without asking.
8893

8994
Use |g:gin_proxy_editor_opener| to specify the opener command to open the
@@ -92,6 +97,9 @@ buffer.
9297
Use |g:gin_proxy_disable_askpass| and/or |g:gin_proxy_disable_editor| to
9398
disable this proxy feature.
9499

100+
Use |g:gin_proxy_disable_accept_and_cancel_aliases| to disable the accept and
101+
cancel aliases in "gitcommit" and "gitrebase" filetype buffers.
102+
95103

96104
=============================================================================
97105
INTERFACE *gin-interface*
@@ -641,6 +649,12 @@ VARIABLES *gin-variables*
641649

642650
Default: 0
643651

652+
*g:gin_proxy_disable_accept_and_cancel_aliases*
653+
Disable :Accept and :Cancel aliases in "gitcommit" and "gitrebase"
654+
filetype buffers.
655+
656+
Default: 0
657+
644658
*g:gin_proxy_editor_opener*
645659
Opener command (e.g. "split", "vsplit", "tabedit") to open a buffer
646660
on proxy editors.

ftplugin/gitcommit/gin.vim

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
if get(g:, 'gin_proxy_disable_accept_and_cancel_aliases', 0)
2+
finish
3+
endif
4+
5+
if !exists(':Accept')
6+
command! Accept wq
7+
endif
8+
if !exists(':Cancel')
9+
command! Cancel cq
10+
endif

ftplugin/gitrebase/gin.vim

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
if get(g:, 'gin_proxy_disable_accept_and_cancel_aliases', 0)
2+
finish
3+
endif
4+
5+
if !exists(':Accept')
6+
command! Accept wq
7+
endif
8+
if !exists(':Cancel')
9+
command! Cancel cq
10+
endif

0 commit comments

Comments
 (0)