Revert "Merge branch 'update-vital-over'"

This reverts commit 10a147d534, reversing
changes made to 9f836921d3.
This commit is contained in:
haya14busa 2014-05-30 00:22:13 +09:00
parent 6d5cd26f98
commit 2c4fa0dde2
8 changed files with 32 additions and 246 deletions

View File

@ -59,19 +59,6 @@ function! s:unload()
let s:loaded = {} let s:loaded = {}
endfunction endfunction
function! s:exists(name)
return s:_get_module_path(a:name) !=# ''
endfunction
function! s:search(pattern)
let target = substitute(a:pattern, '\.', '/', 'g')
let tailpath = printf('autoload/vital/%s/%s.vim', s:self_version, target)
let paths = s:_runtime_files(tailpath)
let modules = sort(map(paths, 's:_file2module(v:val)'))
return s:_uniq(modules)
endfunction
function! s:_import(name) function! s:_import(name)
if type(a:name) == type(0) if type(a:name) == type(0)
return s:_build_module(a:name) return s:_build_module(a:name)
@ -102,16 +89,19 @@ function! s:_get_module_path(name)
if a:name ==# '' if a:name ==# ''
let tailpath = printf('autoload/vital/%s.vim', s:self_version) let tailpath = printf('autoload/vital/%s.vim', s:self_version)
elseif a:name =~# '\v^\u\w*%(\.\u\w*)*$' elseif a:name =~# '\v^\u\w*%(\.\u\w*)*$'
let target = substitute(a:name, '\W\+', '/', 'g') let target = '/' . substitute(a:name, '\W\+', '/', 'g')
let tailpath = printf('autoload/vital/%s/%s.vim', s:self_version, target) let tailpath = printf('autoload/vital/%s%s.vim', s:self_version, target)
else else
throw 'vital: Invalid module name: ' . a:name throw 'vital: Invalid module name: ' . a:name
endif endif
let paths = s:_runtime_files(tailpath) if s:globpath_third_arg
let paths = split(globpath(&runtimepath, tailpath, 1), "\n")
else
let paths = split(globpath(&runtimepath, tailpath), "\n")
endif
call filter(paths, 'filereadable(v:val)') call filter(paths, 'filereadable(v:val)')
let path = get(paths, 0, '') return s:_unify_path(get(paths, 0, ''))
return path !=# '' ? s:_unify_path(path) : ''
endfunction endfunction
function! s:_scripts() function! s:_scripts()
@ -126,12 +116,6 @@ function! s:_scripts()
return scripts return scripts
endfunction endfunction
function! s:_file2module(file)
let filename = s:_unify_path(a:file)
let tail = matchstr(filename, 'autoload/vital/_\w\+/\zs.*\ze\.vim$')
return join(split(tail, '[\\/]\+'), '.')
endfunction
if filereadable(expand('<sfile>:r') . '.VIM') if filereadable(expand('<sfile>:r') . '.VIM')
function! s:_unify_path(path) function! s:_unify_path(path)
" Note: On windows, vim can't expand path names from 8.3 formats. " Note: On windows, vim can't expand path names from 8.3 formats.
@ -146,16 +130,6 @@ else
endfunction endfunction
endif endif
if s:globpath_third_arg
function! s:_runtime_files(path)
return split(globpath(&runtimepath, a:path, 1), "\n")
endfunction
else
function! s:_runtime_files(path)
return split(globpath(&runtimepath, a:path), "\n")
endfunction
endif
" Copy from System.Filepath " Copy from System.Filepath
if has('win16') || has('win32') || has('win64') if has('win16') || has('win32') || has('win64')
function! s:_is_absolute_path(path) function! s:_is_absolute_path(path)
@ -214,25 +188,6 @@ else
endfunction endfunction
endif endif
if exists('*uniq')
function! s:_uniq(list)
return uniq(a:list)
endfunction
else
function! s:_uniq(list)
let i = len(a:list) - 1
while 0 < i
if a:list[i] ==# a:list[i - 1]
call remove(a:list, i)
let i -= 2
else
let i -= 1
endif
endwhile
return a:list
endfunction
endif
function! s:_redir(cmd) function! s:_redir(cmd)
let [save_verbose, save_verbosefile] = [&verbose, &verbosefile] let [save_verbose, save_verbosefile] = [&verbose, &verbosefile]
set verbose=0 verbosefile= set verbose=0 verbosefile=

View File

@ -29,8 +29,13 @@ function! s:conj(xs, x)
endfunction endfunction
" Removes duplicates from a list. " Removes duplicates from a list.
function! s:uniq(list) function! s:uniq(list, ...)
return s:uniq_by(a:list, 'v:val') if a:0
echomsg "Vital.Data.List.uniq() with 2 arguments is deprecated! Please use uniq_by() instead, if you still want to use the 2nd argument."
return s:uniq_by(a:list, a:1)
else
return s:uniq_by(a:list, 'v:val')
endif
endfunction endfunction
" Removes duplicates from a list. " Removes duplicates from a list.
@ -198,18 +203,6 @@ function! s:or(xs)
return s:any('v:val', a:xs) return s:any('v:val', a:xs)
endfunction endfunction
function! s:map_accum(expr, xs, init)
let memo = []
let init = a:init
for x in a:xs
let expr = substitute(a:expr, 'v:memo', init, 'g')
let expr = substitute(expr, 'v:val', x, 'g')
let [tmp, init] = eval(expr)
call add(memo, tmp)
endfor
return memo
endfunction
" similar to Haskell's Prelude.foldl " similar to Haskell's Prelude.foldl
function! s:foldl(f, init, xs) function! s:foldl(f, init, xs)
let memo = a:init let memo = a:init

View File

@ -8,7 +8,6 @@ function! s:_vital_loaded(V)
let s:String = s:V.import("Over.String") let s:String = s:V.import("Over.String")
let s:Signals = s:V.import("Over.Signals") let s:Signals = s:V.import("Over.Signals")
let s:Module = s:V.import("Over.Commandline.Modules") let s:Module = s:V.import("Over.Commandline.Modules")
let s:List = s:V.import("Data.List")
let s:base.variables.modules = s:Signals.make() let s:base.variables.modules = s:Signals.make()
function! s:base.variables.modules.get_slot(val) function! s:base.variables.modules.get_slot(val)
return a:val.slot.module return a:val.slot.module
@ -21,7 +20,6 @@ function! s:_vital_depends()
\ "Over.String", \ "Over.String",
\ "Over.Signals", \ "Over.Signals",
\ "Over.Commandline.Modules", \ "Over.Commandline.Modules",
\ "Data.List",
\ ] \ ]
endfunction endfunction
@ -345,53 +343,6 @@ function! s:base._execute(command)
endfunction endfunction
function! s:base._input(input, ...)
" let char = s:_unmap(self._get_keymapping(), a:input)
" let self.variables.input_key = char
" let self.variables.char = char
" call self.setchar(self.variables.char)
" call self.callevent("on_char_pre")
" call self.insert(self.variables.input)
" call self.callevent("on_char")
let self.variables.input_key = a:input
if self.get_tap_key() == ""
let key = s:_unmap(self._get_keymapping(), a:input)
else
let key = a:input
endif
for char in s:_split_keys(key)
let self.variables.input_key = char
let self.variables.char = char
call self.setchar(self.variables.char)
call self.callevent("on_char_pre")
call self.insert(self.variables.input)
call self.callevent("on_char")
endfor
" let loop = get(a:, 1, 1)
" if len(a:input) > 1
" return map(split(a:input, '\zs'), "self._input(v:val, loop)")
" else
" if self.get_tap_key() == ""
" let char = s:_unmap(self._get_keymapping(), a:input)
" if loop
" return self._input(char, 0)
" endif
" else
" let char = a:input
" endif
" let self.variables.input_key = a:input
" let self.variables.char = char
" call self.setchar(self.variables.char)
" call self.callevent("on_char_pre")
" call self.insert(self.variables.input)
" call self.callevent("on_char")
" endif
endfunction
function! s:base._main(...) function! s:base._main(...)
try try
call self._init() call self._init()
@ -402,7 +353,15 @@ function! s:base._main(...)
try try
call self.draw() call self.draw()
call self._input(s:_getchar()) 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)
call self.callevent("on_char_pre")
call self.insert(self.variables.input)
call self.callevent("on_char")
catch catch
call self.callevent("on_exception") call self.callevent("on_exception")
endtry endtry
@ -441,10 +400,6 @@ endfunction
function! s:_unmap(mapping, key) function! s:_unmap(mapping, key)
let keys = s:_split_keys(a:key)
if len(keys) > 1
return join(map(keys, 's:_unmap(a:mapping, v:val)'), '')
endif
if !has_key(a:mapping, a:key) if !has_key(a:mapping, a:key)
return a:key return a:key
endif endif
@ -477,117 +432,5 @@ function! s:_getchar()
endfunction endfunction
function! s:_split(str, pat)
let pat = '\%#=2' . a:pat
let list = split(a:str, pat . '\zs')
return s:List.flatten(map(list, 'v:val == a:pat ? a:pat : v:val =~ pat . ''$'' ? split(v:val, pat) + [a:pat] : v:val'))
endfunction
function! s:_split_keystring(str, pats, ...)
if a:str =~ '^<Over>(.\{-})$'
return [a:str]
endif
let pats = a:pats
let index = get(a:, 1, 0)
if !exists("+regexpengine")
\ || index > len(pats)
\ || len(filter(copy(pats), 'a:str =~ ''\%#=2'' . v:val')) == 0
if len(filter(copy(pats), 'a:str ==# v:val')) == 0
return split(a:str, '\zs')
else
return [a:str]
endif
endif
if len(filter(copy(pats), 'a:str == v:val')) == 1
return [a:str]
endif
let result = []
let pat = pats[index]
let list = s:_split(a:str, pat)
let result += eval(join(map(list, "s:_split_keystring(v:val, pats, index+1)"), "+"))
return result
endfunction
let s:s_keys = [
\ "\<BS>",
\ "\<Down>",
\ "\<Up>",
\ "\<Left>",
\ "\<Right>",
\ "\<Home>",
\ "\<End>",
\ "\<Insert>",
\ "\<Delete>",
\ "\<PageUp>",
\ "\<PageDown>",
\ "\<F1>",
\ "\<F2>",
\ "\<F3>",
\ "\<F4>",
\ "\<F5>",
\ "\<F6>",
\ "\<F7>",
\ "\<F8>",
\ "\<F9>",
\ "\<F10>",
\ "\<F11>",
\ "\<F12>",
\ "\<A-BS>",
\ "\<A-Down>",
\ "\<A-Up>",
\ "\<A-Left>",
\ "\<A-Right>",
\ "\<A-Home>",
\ "\<A-End>",
\ "\<A-Insert>",
\ "\<A-Delete>",
\ "\<A-PageUp>",
\ "\<A-PageDown>",
\ "\<A-F1>",
\ "\<A-F2>",
\ "\<A-F3>",
\ "\<A-F4>",
\ "\<A-F5>",
\ "\<A-F6>",
\ "\<A-F7>",
\ "\<A-F8>",
\ "\<A-F9>",
\ "\<A-F10>",
\ "\<A-F11>",
\ "\<A-F12>",
\ "\<C-BS>",
\ "\<C-Down>",
\ "\<C-Up>",
\ "\<C-Left>",
\ "\<C-Right>",
\ "\<C-Home>",
\ "\<C-End>",
\ "\<C-Insert>",
\ "\<C-Delete>",
\ "\<C-PageUp>",
\ "\<C-PageDown>",
\ "\<C-F1>",
\ "\<C-F2>",
\ "\<C-F3>",
\ "\<C-F4>",
\ "\<C-F5>",
\ "\<C-F6>",
\ "\<C-F7>",
\ "\<C-F8>",
\ "\<C-F9>",
\ "\<C-F10>",
\ "\<C-F11>",
\ "\<C-F12>",
\]
function! s:_split_keys(str)
return s:_split_keystring(a:str, s:s_keys)
endfunction
let &cpo = s:save_cpo let &cpo = s:save_cpo
unlet s:save_cpo unlet s:save_cpo

View File

@ -29,12 +29,10 @@ let s:hooks = [
\ "leave", \ "leave",
\ "char", \ "char",
\ "char_pre", \ "char_pre",
\ "draw",
\ "draw_pre",
\ "execute_pre", \ "execute_pre",
\ "execute_failed", \ "execute_failed",
\ "execute", \ "execute",
\ "exception", \ "cancel"
\] \]
let s:hooks_camel = [ let s:hooks_camel = [
@ -42,12 +40,10 @@ let s:hooks_camel = [
\ "Leave", \ "Leave",
\ "Char", \ "Char",
\ "CharPre", \ "CharPre",
\ "Draw",
\ "DrawPre",
\ "ExecutePre", \ "ExecutePre",
\ "ExecuteFailed", \ "ExecuteFailed",
\ "Execute", \ "Execute",
\ "Exception", \ "Cancel"
\] \]

View File

@ -66,7 +66,7 @@ endfunction
function! s:_as_echon(str) function! s:_as_echon(str)
return "echon " . strtrans(string(a:str)) return "echon " . string(a:str)
endfunction endfunction

View File

@ -51,9 +51,9 @@ function! s:module.on_char_pre(cmdline)
call a:cmdline.setline(self.old_line) call a:cmdline.setline(self.old_line)
call a:cmdline.setpos(self.old_pos) call a:cmdline.setpos(self.old_pos)
let char = a:cmdline.input_key() let char = a:cmdline.input_key()
if char =~ '^[0-9a-zA-z.%#:/"\-*+]$' if char =~ '^[0-9a-zA-z.%#:/"\-*]$'
let register = tr(getreg(char), "\n", "\r") execute "let regist = @" . char
call a:cmdline.setchar(register) call a:cmdline.setchar(regist)
elseif char == "=" elseif char == "="
call a:cmdline.setchar(s:input(a:cmdline)) call a:cmdline.setchar(s:input(a:cmdline))
elseif char == "\<C-w>" elseif char == "\<C-w>"

View File

@ -9,8 +9,7 @@ let s:module = {
function! s:module.on_char_pre(cmdline) function! s:module.on_char_pre(cmdline)
if a:cmdline.is_input("<Over>(paste)") if a:cmdline.is_input("<Over>(paste)")
let register = v:register == "" ? '"' : v:register call a:cmdline.insert(@*)
call a:cmdline.insert(tr(getreg("*"), "\n", "\r"))
call a:cmdline.setchar('') call a:cmdline.setchar('')
endif endif
endfunction endfunction

View File

@ -1,5 +1,5 @@
easymotion easymotion
d3dafa1 39d8e9c
Over.Commandline.Base Over.Commandline.Base
Over.Commandline.Modules.Cancel Over.Commandline.Modules.Cancel