Merge branch 'improve/commandline' into master
This commit is contained in:
commit
9650037041
@ -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
|
||||
|
||||
|
||||
@ -163,7 +164,7 @@ endfunction
|
||||
|
||||
function! s:base.connect(module, ...)
|
||||
if type(a:module) == type("")
|
||||
return self.connect(s:get_module(a:module).make())
|
||||
return call(self.connect, [s:get_module(a:module).make()] + a:000, self)
|
||||
endif
|
||||
let name = get(a:, 1, a:module.name)
|
||||
let self.variables.modules[name] = a:module
|
||||
@ -171,7 +172,7 @@ endfunction
|
||||
|
||||
|
||||
function! s:base.disconnect(name)
|
||||
unlet self.variables.modules[a:name] = a:module
|
||||
unlet self.variables.modules[a:name]
|
||||
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)
|
||||
|
||||
|
@ -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\<Tab>"
|
||||
" echom "Completion\<Tab>" == a:cmdline.char()
|
||||
if a:cmdline.is_input("<Over>(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("\<Tab>", "Completion")
|
||||
elseif a:cmdline.is_input("<Over>(buffer-complete)", "Completion")
|
||||
\ || a:cmdline.is_input("\<Right>", "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
|
||||
|
||||
|
@ -9,8 +9,6 @@ let s:module = {
|
||||
function! s:module.on_char_pre(cmdline)
|
||||
if a:cmdline.is_input("\<Esc>")
|
||||
\ || a:cmdline.is_input("\<C-c>")
|
||||
\ ||(a:cmdline.is_input("\<BS>") && a:cmdline.line.length() == 0)
|
||||
\ ||(a:cmdline.is_input("\<C-h>") && a:cmdline.line.length() == 0)
|
||||
" call a:cmdline.cancel()
|
||||
call a:cmdline.exit(1)
|
||||
call a:cmdline.setchar("")
|
||||
|
@ -9,8 +9,12 @@ let s:module = {
|
||||
function! s:module.on_char_pre(cmdline)
|
||||
if a:cmdline.is_input("\<C-h>")
|
||||
\ || a:cmdline.is_input("\<BS>")
|
||||
call a:cmdline.line.remove_prev()
|
||||
call a:cmdline.setchar('')
|
||||
if a:cmdline.line.length() == 0
|
||||
return a:cmdline.exit(1)
|
||||
else
|
||||
call a:cmdline.line.remove_prev()
|
||||
call a:cmdline.setchar('')
|
||||
endif
|
||||
elseif a:cmdline.is_input("\<Del>")
|
||||
call a:cmdline.line.remove_pos()
|
||||
call a:cmdline.setchar('')
|
||||
|
@ -33,47 +33,66 @@ let s:module = {
|
||||
|
||||
function! s:module.on_enter(...)
|
||||
let self.cword = expand("<cword>")
|
||||
let self.cWORD = expand("cWORD")
|
||||
let self.cWORD = expand("<cWORD>")
|
||||
let self.cfile = expand("<cfile>")
|
||||
" let self.prefix_key = ""
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:module.on_char_pre(cmdline)
|
||||
if a:cmdline.is_input("\<C-r>")
|
||||
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("\<C-w>", "InsertRegister")
|
||||
elseif char == "\<C-w>"
|
||||
call a:cmdline.setchar(self.cword)
|
||||
elseif a:cmdline.is_input("\<C-a>", "InsertRegister")
|
||||
elseif char == "\<C-a>"
|
||||
call a:cmdline.setchar(self.cWORD)
|
||||
elseif a:cmdline.is_input("\<C-f>", "InsertRegister")
|
||||
elseif char == "\<C-f>"
|
||||
call a:cmdline.setchar(self.cfile)
|
||||
elseif a:cmdline.is_input("\<C-r>", "InsertRegister")
|
||||
elseif char == "\<C-r>"
|
||||
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("\<C-w>", self.prefix_key)
|
||||
" call a:cmdline.setchar(self.cword)
|
||||
" elseif a:cmdline.is_input("\<C-a>", self.prefix_key)
|
||||
" call a:cmdline.setchar(self.cWORD)
|
||||
" elseif a:cmdline.is_input("\<C-f>", self.prefix_key)
|
||||
" call a:cmdline.setchar(self.cfile)
|
||||
" elseif a:cmdline.is_input("\<C-r>", 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("\<C-r>", "InsertRegister")
|
||||
if a:cmdline.is_input("\<C-r>")
|
||||
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
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
*easymotion.txt* Version 2.0 Last change:07 Feb 2014.
|
||||
*easymotion.txt* Version 2.0 Last change:08 Feb 2014.
|
||||
|
||||
|
||||
______ __ ___ __ _
|
||||
@ -528,6 +528,9 @@ Find Motion Command Line~
|
||||
<Up> or <C-p> | Recall older (previous) search from history
|
||||
<Down> or <C-n> | Recall more recent (next) search from history
|
||||
<C-r> {0-9a-z"%#:-=.} | Insert Register. See |c_Ctrl-R|
|
||||
<C-r><C-w> | Insert the Word under cursor
|
||||
<C-r><C-a> | Insert the |WORD| under cursor
|
||||
<C-r><C-f> | Insert the Filename under cursor
|
||||
------------------------|---------------------------------------
|
||||
<Over>(paste) | Paste yanked text to the command line
|
||||
| Default: <C-v>
|
||||
|
Loading…
x
Reference in New Issue
Block a user