diff options
-rw-r--r-- | bundle/git-shortcuts/autoload/git_shortcuts.vim | 10 | ||||
-rw-r--r-- | bundle/git-shortcuts/ftplugin/git/git_shortcuts.vim | 18 |
2 files changed, 28 insertions, 0 deletions
diff --git a/bundle/git-shortcuts/autoload/git_shortcuts.vim b/bundle/git-shortcuts/autoload/git_shortcuts.vim new file mode 100644 index 0000000..bcd32d9 --- /dev/null +++ b/bundle/git-shortcuts/autoload/git_shortcuts.vim @@ -0,0 +1,10 @@ +let s:COMMIT_START_PATTERN = '^commit' + + +function! git_shortcuts#CommitBackward() + call search(s:COMMIT_START_PATTERN, 'b') +endfunction + +function! git_shortcuts#CommitForward() + call search(s:COMMIT_START_PATTERN) +endfunction diff --git a/bundle/git-shortcuts/ftplugin/git/git_shortcuts.vim b/bundle/git-shortcuts/ftplugin/git/git_shortcuts.vim new file mode 100644 index 0000000..1c844b7 --- /dev/null +++ b/bundle/git-shortcuts/ftplugin/git/git_shortcuts.vim @@ -0,0 +1,18 @@ +if exists('g:no_plugin_maps') || exists('g:no_git_shortcut_maps') + finish +endif + +let b:undo_ftplugin = '' + +if !hasmapto('<Plug>GitShortcutsCommitBackward') + nmap <buffer> [[ <Plug>GitShortcutsCommitBackward + let b:undo_ftplugin .= '| nunmap <buffer> [[' +endif + +if !hasmapto('<Plug>GitShortcutsCommitForward') + nmap <buffer> ]] <Plug>GitShortcutsCommitForward + let b:undo_ftplugin .= '| nunmap <buffer> ]]' +endif + +nnoremap <buffer> <Plug>GitShortcutsCommitBackward :call git_shortcuts#CommitBackward()<CR> +nnoremap <buffer> <Plug>GitShortcutsCommitForward :call git_shortcuts#CommitForward()<CR> |