From 60bc8ea8b3b7be511c4240ca1d7dc1cc1149b113 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 10 May 2017 05:10:41 +0200 Subject: gitcha#GitSHAComplete(): Use `complete()` to open popup menu (WIP) Work in progress Rough code for a working implementation using `complete()` instead of 'completefunc'. Rejigger `start` and make a new `base` variable since we can no longer get it as an argument. Correctly reset 'completeopt' to its original user value after opening the popup menu. Return an empty string from the function as recommended by :h complete() --- ftplugin/gitcommit/gitcha.vim | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'ftplugin/gitcommit/gitcha.vim') diff --git a/ftplugin/gitcommit/gitcha.vim b/ftplugin/gitcommit/gitcha.vim index 19f4a0b..9be271d 100644 --- a/ftplugin/gitcommit/gitcha.vim +++ b/ftplugin/gitcommit/gitcha.vim @@ -8,10 +8,13 @@ if exists('g:no_plugin_maps') || exists('g:no_gitcha_maps') finish endif -if !hasmapto('GitchaCompleteSHA') - imap GitchaCompleteSHA -endif +" if !hasmapto('GitchaCompleteSHA') +" imap GitchaCompleteSHA +" endif -inoremap GitchaCompleteSHA gitcha#StartGitSHACompletion() +" inoremap GitchaCompleteSHA =gitcha#StartGitSHACompletion() +" inoremap GitchaCompleteSHA =gitcha#GitSHAComplete() +" inoremap =gitcha#GitSHAComplete() +inoremap =gitcha#GitSHAComplete() let b:undo_ftplugin = 'iunmap ' -- cgit v1.2.3 From 69a382bf1d6cd4645dfb4408f757368b069694fc Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 10 May 2017 21:00:54 +0200 Subject: ftplugin/gitcommit: Restore mapping Restore this after 60bc8ea8b3b7be511c4240ca1d7dc1cc1149b113 where I made a mess experimenting trying to get `complete()` to work. Take the mapping that we used successfully from that commit and combine it with our `` mappings from before to call our new completion function. --- ftplugin/gitcommit/gitcha.vim | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'ftplugin/gitcommit/gitcha.vim') diff --git a/ftplugin/gitcommit/gitcha.vim b/ftplugin/gitcommit/gitcha.vim index 9be271d..c81cf26 100644 --- a/ftplugin/gitcommit/gitcha.vim +++ b/ftplugin/gitcommit/gitcha.vim @@ -8,13 +8,10 @@ if exists('g:no_plugin_maps') || exists('g:no_gitcha_maps') finish endif -" if !hasmapto('GitchaCompleteSHA') -" imap GitchaCompleteSHA -" endif +if !hasmapto('GitchaCompleteSHA') + imap GitchaCompleteSHA +endif -" inoremap GitchaCompleteSHA =gitcha#StartGitSHACompletion() -" inoremap GitchaCompleteSHA =gitcha#GitSHAComplete() -" inoremap =gitcha#GitSHAComplete() -inoremap =gitcha#GitSHAComplete() +inoremap GitchaCompleteSHA =gitcha#GitSHAComplete() let b:undo_ftplugin = 'iunmap ' -- cgit v1.2.3