Skip to content

Commit a84412c

Browse files
authored
Merge pull request #314 from easymotion/fix-doautocmd
Fix doautocmd
2 parents 20e5b05 + aa79397 commit a84412c

File tree

5 files changed

+78
-26
lines changed

5 files changed

+78
-26
lines changed

autoload/vital/_easymotion/HitAHint/Motion.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,15 @@ function! s:move_to_winpos(winpos) abort
135135
let is_win_moved = !(winnr is# winnr())
136136
if is_win_moved
137137
if exists('#WinLeave')
138-
doautocmd WinLeave *
138+
doautocmd WinLeave
139139
endif
140140
call s:move_to_win(winnr)
141141
else
142142
normal! m`
143143
endif
144144
call cursor(pos)
145145
if is_win_moved && exists('#WinEnter')
146-
doautocmd WinEnter *
146+
doautocmd WinEnter
147147
endif
148148
endfunction
149149

autoload/vital/_easymotion/Prelude.vim

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,37 @@ else
3939
endif
4040

4141
" Wrapper functions for type().
42-
let [
43-
\ s:__TYPE_NUMBER,
44-
\ s:__TYPE_STRING,
45-
\ s:__TYPE_FUNCREF,
46-
\ s:__TYPE_LIST,
47-
\ s:__TYPE_DICT,
48-
\ s:__TYPE_FLOAT] = [
49-
\ type(3),
50-
\ type(''),
51-
\ type(function('tr')),
52-
\ type([]),
53-
\ type({}),
54-
\ has('float') ? type(str2float('0')) : -1]
55-
" __TYPE_FLOAT = -1 when -float
56-
" This doesn't match to anything.
42+
" NOTE: __TYPE_FLOAT = -1 when -float.
43+
" this doesn't match to anything.
44+
if has('patch-7.4.2071')
45+
let [
46+
\ s:__TYPE_NUMBER,
47+
\ s:__TYPE_STRING,
48+
\ s:__TYPE_FUNCREF,
49+
\ s:__TYPE_LIST,
50+
\ s:__TYPE_DICT,
51+
\ s:__TYPE_FLOAT] = [
52+
\ v:t_number,
53+
\ v:t_string,
54+
\ v:t_func,
55+
\ v:t_list,
56+
\ v:t_dict,
57+
\ v:t_float]
58+
else
59+
let [
60+
\ s:__TYPE_NUMBER,
61+
\ s:__TYPE_STRING,
62+
\ s:__TYPE_FUNCREF,
63+
\ s:__TYPE_LIST,
64+
\ s:__TYPE_DICT,
65+
\ s:__TYPE_FLOAT] = [
66+
\ type(3),
67+
\ type(''),
68+
\ type(function('tr')),
69+
\ type([]),
70+
\ type({}),
71+
\ has('float') ? type(str2float('0')) : -1]
72+
endif
5773

5874
" Number or Float
5975
function! s:is_numeric(Value) abort
@@ -67,27 +83,32 @@ function! s:is_number(Value) abort
6783
return type(a:Value) ==# s:__TYPE_NUMBER
6884
endfunction
6985

70-
" Float
71-
function! s:is_float(Value) abort
72-
return type(a:Value) ==# s:__TYPE_FLOAT
73-
endfunction
7486
" String
7587
function! s:is_string(Value) abort
7688
return type(a:Value) ==# s:__TYPE_STRING
7789
endfunction
90+
7891
" Funcref
7992
function! s:is_funcref(Value) abort
8093
return type(a:Value) ==# s:__TYPE_FUNCREF
8194
endfunction
95+
8296
" List
8397
function! s:is_list(Value) abort
8498
return type(a:Value) ==# s:__TYPE_LIST
8599
endfunction
100+
86101
" Dictionary
87102
function! s:is_dict(Value) abort
88103
return type(a:Value) ==# s:__TYPE_DICT
89104
endfunction
90105

106+
" Float
107+
function! s:is_float(Value) abort
108+
return type(a:Value) ==# s:__TYPE_FLOAT
109+
endfunction
110+
111+
91112
function! s:truncate_skipping(str, max, footer_width, separator) abort
92113
call s:_warn_deprecated('truncate_skipping', 'Data.String.truncate_skipping')
93114

autoload/vital/_easymotion/Vim/Buffer.vim

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
" Do not mofidify the code nor insert new lines before '" ___vital___'
44
if v:version > 703 || v:version == 703 && has('patch1170')
55
function! vital#_easymotion#Vim#Buffer#import() abort
6-
return map({'_vital_depends': '', 'read_content': '', 'get_selected_text': '', 'is_cmdwin': '', 'edit_content': '', 'open': '', 'get_last_selected': '', '_vital_loaded': ''}, 'function("s:" . v:key)')
6+
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)')
77
endfunction
88
else
99
function! s:_SID() abort
1010
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
1111
endfunction
12-
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")
12+
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")
1313
delfunction s:_SID
1414
endif
1515
" ___vital___
@@ -114,6 +114,7 @@ function! s:read_content(content, ...) abort
114114
\ 'nobinary': 0,
115115
\ 'bad': '',
116116
\ 'edit': 0,
117+
\ 'line': '',
117118
\}, get(a:000, 0, {}))
118119
let tempfile = empty(options.tempfile) ? tempname() : options.tempfile
119120
let optnames = [
@@ -127,7 +128,8 @@ function! s:read_content(content, ...) abort
127128
let optname = join(filter(optnames, '!empty(v:val)'))
128129
try
129130
call writefile(a:content, tempfile)
130-
execute printf('keepalt keepjumps read %s%s',
131+
execute printf('keepalt keepjumps %sread %s%s',
132+
\ options.line,
131133
\ empty(optname) ? '' : optname . ' ',
132134
\ fnameescape(tempfile),
133135
\)
@@ -155,6 +157,30 @@ function! s:edit_content(content, ...) abort
155157
setlocal nomodified
156158
endfunction
157159

160+
function! s:parse_cmdarg(...) abort
161+
let cmdarg = get(a:000, 0, v:cmdarg)
162+
let options = {}
163+
if cmdarg =~# '++enc='
164+
let options.encoding = matchstr(cmdarg, '++enc=\zs[^ ]\+\ze')
165+
endif
166+
if cmdarg =~# '++ff='
167+
let options.fileformat = matchstr(cmdarg, '++ff=\zs[^ ]\+\ze')
168+
endif
169+
if cmdarg =~# '++bad='
170+
let options.bad = matchstr(cmdarg, '++bad=\zs[^ ]\+\ze')
171+
endif
172+
if cmdarg =~# '++bin'
173+
let options.binary = 1
174+
endif
175+
if cmdarg =~# '++nobin'
176+
let options.nobinary = 1
177+
endif
178+
if cmdarg =~# '++edit'
179+
let options.edit = 1
180+
endif
181+
return options
182+
endfunction
183+
158184
let &cpo = s:save_cpo
159185
unlet s:save_cpo
160186

autoload/vital/_easymotion/Vim/Guard.vim

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,12 @@ function! s:_new_register(name) abort
100100
return register
101101
endfunction
102102
function! s:register.restore() abort
103-
call setreg(self.name, self.value, self.type)
103+
" https://github.com/vim/vim/commit/5a50c2255c447838d08d3b4895a3be3a41cd8eda
104+
if has('patch-7.4.243') || self.name !=# '='
105+
call setreg(self.name, self.value, self.type)
106+
else
107+
let @= = self.value
108+
endif
104109
endfunction
105110

106111
let s:environment = {}

autoload/vital/easymotion.vital

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
easymotion
2-
3404e200ca6b5f371811606e8399fefdf4595529
2+
882de6964d10595e839ccbcc0fb20b7ff14e43cb
33

44
Over.Commandline.Base
55
Over.Commandline.Modules.Cancel

0 commit comments

Comments
 (0)