Revert "Merge branch 'update-vital-over'"
This reverts commit10a147d534
, reversing changes made to9f836921d3
.
This commit is contained in:
parent
6d5cd26f98
commit
2c4fa0dde2
@ -59,19 +59,6 @@ function! s:unload()
|
||||
let s:loaded = {}
|
||||
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)
|
||||
if type(a:name) == type(0)
|
||||
return s:_build_module(a:name)
|
||||
@ -102,16 +89,19 @@ function! s:_get_module_path(name)
|
||||
if a:name ==# ''
|
||||
let tailpath = printf('autoload/vital/%s.vim', s:self_version)
|
||||
elseif a:name =~# '\v^\u\w*%(\.\u\w*)*$'
|
||||
let target = substitute(a:name, '\W\+', '/', 'g')
|
||||
let tailpath = printf('autoload/vital/%s/%s.vim', s:self_version, target)
|
||||
let target = '/' . substitute(a:name, '\W\+', '/', 'g')
|
||||
let tailpath = printf('autoload/vital/%s%s.vim', s:self_version, target)
|
||||
else
|
||||
throw 'vital: Invalid module name: ' . a:name
|
||||
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)')
|
||||
let path = get(paths, 0, '')
|
||||
return path !=# '' ? s:_unify_path(path) : ''
|
||||
return s:_unify_path(get(paths, 0, ''))
|
||||
endfunction
|
||||
|
||||
function! s:_scripts()
|
||||
@ -126,12 +116,6 @@ function! s:_scripts()
|
||||
return scripts
|
||||
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')
|
||||
function! s:_unify_path(path)
|
||||
" Note: On windows, vim can't expand path names from 8.3 formats.
|
||||
@ -146,16 +130,6 @@ else
|
||||
endfunction
|
||||
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
|
||||
if has('win16') || has('win32') || has('win64')
|
||||
function! s:_is_absolute_path(path)
|
||||
@ -214,25 +188,6 @@ else
|
||||
endfunction
|
||||
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)
|
||||
let [save_verbose, save_verbosefile] = [&verbose, &verbosefile]
|
||||
set verbose=0 verbosefile=
|
||||
|
@ -29,8 +29,13 @@ function! s:conj(xs, x)
|
||||
endfunction
|
||||
|
||||
" Removes duplicates from a list.
|
||||
function! s:uniq(list)
|
||||
return s:uniq_by(a:list, 'v:val')
|
||||
function! s:uniq(list, ...)
|
||||
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
|
||||
|
||||
" Removes duplicates from a list.
|
||||
@ -198,18 +203,6 @@ function! s:or(xs)
|
||||
return s:any('v:val', a:xs)
|
||||
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
|
||||
function! s:foldl(f, init, xs)
|
||||
let memo = a:init
|
||||
|
@ -8,7 +8,6 @@ function! s:_vital_loaded(V)
|
||||
let s:String = s:V.import("Over.String")
|
||||
let s:Signals = s:V.import("Over.Signals")
|
||||
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()
|
||||
function! s:base.variables.modules.get_slot(val)
|
||||
return a:val.slot.module
|
||||
@ -21,7 +20,6 @@ function! s:_vital_depends()
|
||||
\ "Over.String",
|
||||
\ "Over.Signals",
|
||||
\ "Over.Commandline.Modules",
|
||||
\ "Data.List",
|
||||
\ ]
|
||||
endfunction
|
||||
|
||||
@ -345,53 +343,6 @@ function! s:base._execute(command)
|
||||
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(...)
|
||||
try
|
||||
call self._init()
|
||||
@ -402,7 +353,15 @@ function! s:base._main(...)
|
||||
try
|
||||
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
|
||||
call self.callevent("on_exception")
|
||||
endtry
|
||||
@ -441,10 +400,6 @@ endfunction
|
||||
|
||||
|
||||
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)
|
||||
return a:key
|
||||
endif
|
||||
@ -477,117 +432,5 @@ function! s:_getchar()
|
||||
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
|
||||
unlet s:save_cpo
|
||||
|
@ -29,12 +29,10 @@ let s:hooks = [
|
||||
\ "leave",
|
||||
\ "char",
|
||||
\ "char_pre",
|
||||
\ "draw",
|
||||
\ "draw_pre",
|
||||
\ "execute_pre",
|
||||
\ "execute_failed",
|
||||
\ "execute",
|
||||
\ "exception",
|
||||
\ "cancel"
|
||||
\]
|
||||
|
||||
let s:hooks_camel = [
|
||||
@ -42,12 +40,10 @@ let s:hooks_camel = [
|
||||
\ "Leave",
|
||||
\ "Char",
|
||||
\ "CharPre",
|
||||
\ "Draw",
|
||||
\ "DrawPre",
|
||||
\ "ExecutePre",
|
||||
\ "ExecuteFailed",
|
||||
\ "Execute",
|
||||
\ "Exception",
|
||||
\ "Cancel"
|
||||
\]
|
||||
|
||||
|
||||
|
@ -66,7 +66,7 @@ endfunction
|
||||
|
||||
|
||||
function! s:_as_echon(str)
|
||||
return "echon " . strtrans(string(a:str))
|
||||
return "echon " . string(a:str)
|
||||
endfunction
|
||||
|
||||
|
||||
|
@ -51,9 +51,9 @@ function! s:module.on_char_pre(cmdline)
|
||||
call a:cmdline.setline(self.old_line)
|
||||
call a:cmdline.setpos(self.old_pos)
|
||||
let char = a:cmdline.input_key()
|
||||
if char =~ '^[0-9a-zA-z.%#:/"\-*+]$'
|
||||
let register = tr(getreg(char), "\n", "\r")
|
||||
call a:cmdline.setchar(register)
|
||||
if char =~ '^[0-9a-zA-z.%#:/"\-*]$'
|
||||
execute "let regist = @" . char
|
||||
call a:cmdline.setchar(regist)
|
||||
elseif char == "="
|
||||
call a:cmdline.setchar(s:input(a:cmdline))
|
||||
elseif char == "\<C-w>"
|
||||
|
@ -9,8 +9,7 @@ let s:module = {
|
||||
|
||||
function! s:module.on_char_pre(cmdline)
|
||||
if a:cmdline.is_input("<Over>(paste)")
|
||||
let register = v:register == "" ? '"' : v:register
|
||||
call a:cmdline.insert(tr(getreg("*"), "\n", "\r"))
|
||||
call a:cmdline.insert(@*)
|
||||
call a:cmdline.setchar('')
|
||||
endif
|
||||
endfunction
|
||||
|
@ -1,5 +1,5 @@
|
||||
easymotion
|
||||
d3dafa1
|
||||
39d8e9c
|
||||
|
||||
Over.Commandline.Base
|
||||
Over.Commandline.Modules.Cancel
|
||||
|
Loading…
Reference in New Issue
Block a user