@@ -22,18 +22,6 @@ function! denite#get_status(name) abort
2222 return ! exists (' b:denite_statusline' ) ? ' ' :
2323 \ get (b: denite_statusline , a: name , ' ' )
2424endfunction
25- function ! denite#get_status_mode () abort
26- return denite#get_status (' mode' )
27- endfunction
28- function ! denite#get_status_sources () abort
29- return denite#get_status (' sources' )
30- endfunction
31- function ! denite#get_status_path () abort
32- return denite#get_status (' path' )
33- endfunction
34- function ! denite#get_status_linenr () abort
35- return denite#get_status (' linenr' )
36- endfunction
3725
3826function ! s: start (sources, user_context) abort
3927 if denite#initialize ()
@@ -46,10 +34,52 @@ function! s:start(sources, user_context) abort
4634 call setpos (' .' , pos)
4735
4836 let args = [a: sources , a: user_context ]
49- return denite#util#rpcrequest (' _denite_start' , args )
37+ return denite#util#rpcrequest (' _denite_start' , args , v: false )
5038endfunction
5139
5240function ! denite#do_action (context, action_name, targets) abort
5341 let args = [a: context , a: action_name , a: targets ]
54- return denite#util#rpcrequest (' _denite_do_action' , args )
42+ return denite#util#rpcrequest (' _denite_do_action' , args , v: false )
43+ endfunction
44+
45+ function ! denite#do_map (name, ... ) abort
46+ let args = denite#util#convert2list (get (a: 000 , 0 , []))
47+ let esc = (mode () == # ' i' ? " \<C-o> " : ' ' )
48+ return printf (esc . " :\<C-u> call denite#_call_map(%s, %s, %s)\<CR> " ,
49+ \ string (a: name ), ' v:false' , string (args ))
50+ endfunction
51+ function ! denite#_call_map (name, is_async, args ) abort
52+ let is_filter = &l: filetype == # ' denite-filter'
53+
54+ if is_filter
55+ call denite#filter#_move_to_parent (a: is_async )
56+ endif
57+
58+ if &l: filetype !=# ' denite'
59+ return
60+ endif
61+
62+ let args = denite#util#convert2list (a: args )
63+
64+ call denite#util#rpcrequest (
65+ \ (a: is_async ? ' _denite_do_async_map' : ' _denite_do_map' ),
66+ \ [bufnr (' %' ), a: name , args ], a: is_async )
67+
68+ if is_filter
69+ let denite_statusline = get (b: , ' denite_statusline' , {})
70+
71+ call win_gotoid (g: denite #_filter_winid)
72+
73+ if &l: filetype == # ' denite-filter'
74+ let b: denite_statusline = denite_statusline
75+ else
76+ stopinsert
77+ endif
78+ endif
79+ endfunction
80+ function ! denite#call_map (name, ... ) abort
81+ call denite#_call_map (a: name , v: false , get (a: 000 , 0 , []))
82+ endfunction
83+ function ! denite#call_async_map (name, ... ) abort
84+ call denite#_call_map (a: name , v: true , get (a: 000 , 0 , []))
5585endfunction
0 commit comments