From 508978ea5866ddfb0604827068dcaa5ac14a0cac Mon Sep 17 00:00:00 2001 From: haya14busa Date: Thu, 6 Feb 2014 23:04:12 +0900 Subject: [PATCH] Update vital-over --- .../vital/_easymotion/Over/Commandline.vim | 2 + .../Commandline/Modules/BufferComplete.vim | 9 +++- .../Commandline/Modules/InsertRegister.vim | 41 ++++++++++++++----- 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/autoload/vital/_easymotion/Over/Commandline.vim b/autoload/vital/_easymotion/Over/Commandline.vim index 16bb490..2771b74 100644 --- a/autoload/vital/_easymotion/Over/Commandline.vim +++ b/autoload/vital/_easymotion/Over/Commandline.vim @@ -137,6 +137,7 @@ function! s:base.is_input(key, ...) let prekey = get(a:, 1, "") return self.get_tap_key() == prekey \ && self.char() == a:key +" \ && self.char() == (prekey . a:key) endfunction @@ -334,6 +335,7 @@ function! s:base._main(...) let self.variables.input_key = s:_getchar() let self.variables.char = s:_unmap(self._get_keymapping(), self.variables.input_key) +" let self.variables.char = s:_unmap(self._get_keymapping(), self.get_tap_key() . self.variables.input_key) call self.setchar(self.variables.char) diff --git a/autoload/vital/_easymotion/Over/Commandline/Modules/BufferComplete.vim b/autoload/vital/_easymotion/Over/Commandline/Modules/BufferComplete.vim index d1381f3..c079211 100644 --- a/autoload/vital/_easymotion/Over/Commandline/Modules/BufferComplete.vim +++ b/autoload/vital/_easymotion/Over/Commandline/Modules/BufferComplete.vim @@ -63,6 +63,7 @@ endfunction function! s:module.complete(cmdline) + call s:_finish() let s:old_statusline = &statusline let backward = a:cmdline.backward() @@ -98,6 +99,10 @@ endfunction function! s:module.on_char_pre(cmdline) +" echom "-----" +" echom a:cmdline.char() +" echom "Completion\" +" echom "Completion\" == a:cmdline.char() if a:cmdline.is_input("(buffer-complete)") if self.complete(a:cmdline) == -1 call s:_finish() @@ -106,6 +111,7 @@ function! s:module.on_char_pre(cmdline) endif call a:cmdline.setchar('') call a:cmdline.tap_keyinput("Completion") +" elseif a:cmdline.is_input("\", "Completion") elseif a:cmdline.is_input("(buffer-complete)", "Completion") \ || a:cmdline.is_input("\", "Completion") call a:cmdline.setchar('') @@ -121,7 +127,7 @@ function! s:module.on_char_pre(cmdline) endif else if a:cmdline.untap_keyinput("Completion") - call a:cmdline._on_char_pre() +" call a:cmdline._on_char_pre() endif call s:_finish() return @@ -138,6 +144,7 @@ endfunction function! s:module.on_leave(cmdline) + call s:_finish() unlet! s:complete endfunction diff --git a/autoload/vital/_easymotion/Over/Commandline/Modules/InsertRegister.vim b/autoload/vital/_easymotion/Over/Commandline/Modules/InsertRegister.vim index 7e42549..37342a2 100644 --- a/autoload/vital/_easymotion/Over/Commandline/Modules/InsertRegister.vim +++ b/autoload/vital/_easymotion/Over/Commandline/Modules/InsertRegister.vim @@ -33,47 +33,66 @@ let s:module = { function! s:module.on_enter(...) let self.cword = expand("") - let self.cWORD = expand("cWORD") + let self.cWORD = expand("") let self.cfile = expand("") +" let self.prefix_key = "" endfunction function! s:module.on_char_pre(cmdline) if a:cmdline.is_input("\") call a:cmdline.setchar('"') - call a:cmdline.tap_keyinput("InsertRegister") + let self.prefix_key = a:cmdline.input_key() let self.old_line = a:cmdline.getline() let self.old_pos = a:cmdline.getpos() return - elseif a:cmdline.get_tap_key() == "InsertRegister" + elseif exists("self.prefix_key") +\ && a:cmdline.get_tap_key() == self.prefix_key call a:cmdline.setline(self.old_line) call a:cmdline.setpos(self.old_pos) - let char = a:cmdline.char() + let char = a:cmdline.input_key() if char =~ '^[0-9a-zA-z.%#:/"\-*]$' execute "let regist = @" . char call a:cmdline.setchar(regist) - elseif a:cmdline.is_input('=', "InsertRegister") + elseif char == "=" call a:cmdline.setchar(s:input(a:cmdline)) - elseif a:cmdline.is_input("\", "InsertRegister") + elseif char == "\" call a:cmdline.setchar(self.cword) - elseif a:cmdline.is_input("\", "InsertRegister") + elseif char == "\" call a:cmdline.setchar(self.cWORD) - elseif a:cmdline.is_input("\", "InsertRegister") + elseif char == "\" call a:cmdline.setchar(self.cfile) - elseif a:cmdline.is_input("\", "InsertRegister") + elseif char == "\" call a:cmdline.setchar('"') else call a:cmdline.setchar("") endif +" elseif a:cmdline.is_input('=', self.prefix_key) +" call a:cmdline.setchar(s:input(a:cmdline)) +" elseif a:cmdline.is_input("\", self.prefix_key) +" call a:cmdline.setchar(self.cword) +" elseif a:cmdline.is_input("\", self.prefix_key) +" call a:cmdline.setchar(self.cWORD) +" elseif a:cmdline.is_input("\", self.prefix_key) +" call a:cmdline.setchar(self.cfile) +" elseif a:cmdline.is_input("\", self.prefix_key) +" call a:cmdline.setchar('"') +" else +" call a:cmdline.setchar("") +" endif endif endfunction function! s:module.on_char(cmdline) - if a:cmdline.is_input("\", "InsertRegister") + if a:cmdline.is_input("\") + call a:cmdline.tap_keyinput(self.prefix_key) call a:cmdline.setpos(a:cmdline.getpos()-1) else - call a:cmdline.untap_keyinput("InsertRegister") + if exists("self.prefix_key") + call a:cmdline.untap_keyinput(self.prefix_key) + unlet! self.prefix_key + endif endif endfunction