update vital
This commit is contained in:
parent
0adc9b4668
commit
aa79397f9b
@ -39,21 +39,37 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Wrapper functions for type().
|
" Wrapper functions for type().
|
||||||
let [
|
" NOTE: __TYPE_FLOAT = -1 when -float.
|
||||||
\ s:__TYPE_NUMBER,
|
" this doesn't match to anything.
|
||||||
\ s:__TYPE_STRING,
|
if has('patch-7.4.2071')
|
||||||
\ s:__TYPE_FUNCREF,
|
let [
|
||||||
\ s:__TYPE_LIST,
|
\ s:__TYPE_NUMBER,
|
||||||
\ s:__TYPE_DICT,
|
\ s:__TYPE_STRING,
|
||||||
\ s:__TYPE_FLOAT] = [
|
\ s:__TYPE_FUNCREF,
|
||||||
\ type(3),
|
\ s:__TYPE_LIST,
|
||||||
\ type(''),
|
\ s:__TYPE_DICT,
|
||||||
\ type(function('tr')),
|
\ s:__TYPE_FLOAT] = [
|
||||||
\ type([]),
|
\ v:t_number,
|
||||||
\ type({}),
|
\ v:t_string,
|
||||||
\ has('float') ? type(str2float('0')) : -1]
|
\ v:t_func,
|
||||||
" __TYPE_FLOAT = -1 when -float
|
\ v:t_list,
|
||||||
" This doesn't match to anything.
|
\ v:t_dict,
|
||||||
|
\ v:t_float]
|
||||||
|
else
|
||||||
|
let [
|
||||||
|
\ s:__TYPE_NUMBER,
|
||||||
|
\ s:__TYPE_STRING,
|
||||||
|
\ s:__TYPE_FUNCREF,
|
||||||
|
\ s:__TYPE_LIST,
|
||||||
|
\ s:__TYPE_DICT,
|
||||||
|
\ s:__TYPE_FLOAT] = [
|
||||||
|
\ type(3),
|
||||||
|
\ type(''),
|
||||||
|
\ type(function('tr')),
|
||||||
|
\ type([]),
|
||||||
|
\ type({}),
|
||||||
|
\ has('float') ? type(str2float('0')) : -1]
|
||||||
|
endif
|
||||||
|
|
||||||
" Number or Float
|
" Number or Float
|
||||||
function! s:is_numeric(Value) abort
|
function! s:is_numeric(Value) abort
|
||||||
@ -67,27 +83,32 @@ function! s:is_number(Value) abort
|
|||||||
return type(a:Value) ==# s:__TYPE_NUMBER
|
return type(a:Value) ==# s:__TYPE_NUMBER
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Float
|
|
||||||
function! s:is_float(Value) abort
|
|
||||||
return type(a:Value) ==# s:__TYPE_FLOAT
|
|
||||||
endfunction
|
|
||||||
" String
|
" String
|
||||||
function! s:is_string(Value) abort
|
function! s:is_string(Value) abort
|
||||||
return type(a:Value) ==# s:__TYPE_STRING
|
return type(a:Value) ==# s:__TYPE_STRING
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Funcref
|
" Funcref
|
||||||
function! s:is_funcref(Value) abort
|
function! s:is_funcref(Value) abort
|
||||||
return type(a:Value) ==# s:__TYPE_FUNCREF
|
return type(a:Value) ==# s:__TYPE_FUNCREF
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" List
|
" List
|
||||||
function! s:is_list(Value) abort
|
function! s:is_list(Value) abort
|
||||||
return type(a:Value) ==# s:__TYPE_LIST
|
return type(a:Value) ==# s:__TYPE_LIST
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Dictionary
|
" Dictionary
|
||||||
function! s:is_dict(Value) abort
|
function! s:is_dict(Value) abort
|
||||||
return type(a:Value) ==# s:__TYPE_DICT
|
return type(a:Value) ==# s:__TYPE_DICT
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Float
|
||||||
|
function! s:is_float(Value) abort
|
||||||
|
return type(a:Value) ==# s:__TYPE_FLOAT
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! s:truncate_skipping(str, max, footer_width, separator) abort
|
function! s:truncate_skipping(str, max, footer_width, separator) abort
|
||||||
call s:_warn_deprecated('truncate_skipping', 'Data.String.truncate_skipping')
|
call s:_warn_deprecated('truncate_skipping', 'Data.String.truncate_skipping')
|
||||||
|
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
" Do not mofidify the code nor insert new lines before '" ___vital___'
|
" Do not mofidify the code nor insert new lines before '" ___vital___'
|
||||||
if v:version > 703 || v:version == 703 && has('patch1170')
|
if v:version > 703 || v:version == 703 && has('patch1170')
|
||||||
function! vital#_easymotion#Vim#Buffer#import() abort
|
function! vital#_easymotion#Vim#Buffer#import() abort
|
||||||
return map({'_vital_depends': '', 'read_content': '', 'get_selected_text': '', 'is_cmdwin': '', 'edit_content': '', 'open': '', 'get_last_selected': '', '_vital_loaded': ''}, 'function("s:" . v:key)')
|
return map({'parse_cmdarg': '', '_vital_depends': '', 'read_content': '', 'get_selected_text': '', 'is_cmdwin': '', 'edit_content': '', 'open': '', 'get_last_selected': '', '_vital_loaded': ''}, 'function("s:" . v:key)')
|
||||||
endfunction
|
endfunction
|
||||||
else
|
else
|
||||||
function! s:_SID() abort
|
function! s:_SID() abort
|
||||||
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
|
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
|
||||||
endfunction
|
endfunction
|
||||||
execute join(['function! vital#_easymotion#Vim#Buffer#import() abort', printf("return map({'_vital_depends': '', 'read_content': '', 'get_selected_text': '', 'is_cmdwin': '', 'edit_content': '', 'open': '', 'get_last_selected': '', '_vital_loaded': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n")
|
execute join(['function! vital#_easymotion#Vim#Buffer#import() abort', printf("return map({'parse_cmdarg': '', '_vital_depends': '', 'read_content': '', 'get_selected_text': '', 'is_cmdwin': '', 'edit_content': '', 'open': '', 'get_last_selected': '', '_vital_loaded': ''}, \"function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n")
|
||||||
delfunction s:_SID
|
delfunction s:_SID
|
||||||
endif
|
endif
|
||||||
" ___vital___
|
" ___vital___
|
||||||
@ -114,6 +114,7 @@ function! s:read_content(content, ...) abort
|
|||||||
\ 'nobinary': 0,
|
\ 'nobinary': 0,
|
||||||
\ 'bad': '',
|
\ 'bad': '',
|
||||||
\ 'edit': 0,
|
\ 'edit': 0,
|
||||||
|
\ 'line': '',
|
||||||
\}, get(a:000, 0, {}))
|
\}, get(a:000, 0, {}))
|
||||||
let tempfile = empty(options.tempfile) ? tempname() : options.tempfile
|
let tempfile = empty(options.tempfile) ? tempname() : options.tempfile
|
||||||
let optnames = [
|
let optnames = [
|
||||||
@ -127,7 +128,8 @@ function! s:read_content(content, ...) abort
|
|||||||
let optname = join(filter(optnames, '!empty(v:val)'))
|
let optname = join(filter(optnames, '!empty(v:val)'))
|
||||||
try
|
try
|
||||||
call writefile(a:content, tempfile)
|
call writefile(a:content, tempfile)
|
||||||
execute printf('keepalt keepjumps read %s%s',
|
execute printf('keepalt keepjumps %sread %s%s',
|
||||||
|
\ options.line,
|
||||||
\ empty(optname) ? '' : optname . ' ',
|
\ empty(optname) ? '' : optname . ' ',
|
||||||
\ fnameescape(tempfile),
|
\ fnameescape(tempfile),
|
||||||
\)
|
\)
|
||||||
@ -155,6 +157,30 @@ function! s:edit_content(content, ...) abort
|
|||||||
setlocal nomodified
|
setlocal nomodified
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:parse_cmdarg(...) abort
|
||||||
|
let cmdarg = get(a:000, 0, v:cmdarg)
|
||||||
|
let options = {}
|
||||||
|
if cmdarg =~# '++enc='
|
||||||
|
let options.encoding = matchstr(cmdarg, '++enc=\zs[^ ]\+\ze')
|
||||||
|
endif
|
||||||
|
if cmdarg =~# '++ff='
|
||||||
|
let options.fileformat = matchstr(cmdarg, '++ff=\zs[^ ]\+\ze')
|
||||||
|
endif
|
||||||
|
if cmdarg =~# '++bad='
|
||||||
|
let options.bad = matchstr(cmdarg, '++bad=\zs[^ ]\+\ze')
|
||||||
|
endif
|
||||||
|
if cmdarg =~# '++bin'
|
||||||
|
let options.binary = 1
|
||||||
|
endif
|
||||||
|
if cmdarg =~# '++nobin'
|
||||||
|
let options.nobinary = 1
|
||||||
|
endif
|
||||||
|
if cmdarg =~# '++edit'
|
||||||
|
let options.edit = 1
|
||||||
|
endif
|
||||||
|
return options
|
||||||
|
endfunction
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
|
|
||||||
|
@ -100,7 +100,12 @@ function! s:_new_register(name) abort
|
|||||||
return register
|
return register
|
||||||
endfunction
|
endfunction
|
||||||
function! s:register.restore() abort
|
function! s:register.restore() abort
|
||||||
call setreg(self.name, self.value, self.type)
|
" https://github.com/vim/vim/commit/5a50c2255c447838d08d3b4895a3be3a41cd8eda
|
||||||
|
if has('patch-7.4.243') || self.name !=# '='
|
||||||
|
call setreg(self.name, self.value, self.type)
|
||||||
|
else
|
||||||
|
let @= = self.value
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
let s:environment = {}
|
let s:environment = {}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
easymotion
|
easymotion
|
||||||
3404e200ca6b5f371811606e8399fefdf4595529
|
882de6964d10595e839ccbcc0fb20b7ff14e43cb
|
||||||
|
|
||||||
Over.Commandline.Base
|
Over.Commandline.Base
|
||||||
Over.Commandline.Modules.Cancel
|
Over.Commandline.Modules.Cancel
|
||||||
|
Loading…
Reference in New Issue
Block a user