1- " ___vital___
2- " NOTE: lines between '" ___vital___' is generated by :Vitalize.
3- " Do not modify the code nor insert new lines before '" ___vital___'
4- function ! s: _SID () abort
5- return matchstr (expand (' <sfile>' ), ' <SNR>\zs\d\+\ze__SID$' )
6- endfunction
7- execute join ([' function! vital#_fern#Prompt#import() abort' , printf (" return map({'select': '', 'ask': '', 'confirm': '', 'input': ''}, \" vital#_fern#function('<SNR>%s_' . v:key)\" )" , s: _SID ()), ' endfunction' ], " \n " )
8- delfunction s: _SID
9- " ___vital___
101let s: ESCAPE_MARKER = sha256 (expand (' <sfile>' ))
112
12- function ! s: input (prompt , ... ) abort
3+ function ! fern#internal#prompt# input (prompt , ... ) abort
134 let text = a: 0 > 0 ? a: 1 : ' '
145 let comp = a: 0 > 1
156 \ ? type (a: 2 ) is # v: t_func ? ' customlist,' . get (a: 2 , ' name' ) : a: 2
@@ -28,26 +19,23 @@ function! s:input(prompt, ...) abort
2819 endtry
2920endfunction
3021
31- function ! s: ask (... ) abort
32- call inputsave ()
22+ function ! fern#internal#prompt#ask (... ) abort
3323 try
3424 echohl Question
35- return call (' s: input' , a: 000 )
25+ return call (' fern#internal#prompt# input' , a: 000 )
3626 finally
3727 echohl None
38- call inputrestore ()
3928 redraw | echo
4029 endtry
4130endfunction
4231
43- function ! s: confirm (prompt , ... ) abort
32+ function ! fern#internal#prompt# confirm (prompt , ... ) abort
4433 let default = a: 0 ? (a: 1 ? ' yes' : ' no' ) : v: null
45- call inputsave ()
4634 echohl Question
4735 try
4836 let r = ' '
4937 while r !~? ' ^\%(y\%[es]\|n\%[o]\)$'
50- let r = s: input (a: prompt , ' ' , funcref (' s:_confirm_complete' ))
38+ let r = fern#internal#prompt# input (a: prompt , ' ' , funcref (' s:_confirm_complete' ))
5139 if r is # v: null
5240 return v: null
5341 endif
@@ -56,17 +44,15 @@ function! s:confirm(prompt, ...) abort
5644 return r = ~? ' y\%[es]'
5745 finally
5846 echohl None
59- call inputrestore ()
6047 redraw | echo
6148 endtry
6249endfunction
6350
64- function ! s: select (prompt , ... ) abort
51+ function ! fern#internal#prompt# select (prompt , ... ) abort
6552 let max = a: 0 > 0 ? a: 1 : 1
6653 let min = a: 0 > 1 ? a: 2 : 1
6754 let pat = a: 0 > 2 ? a: 3 : ' \d'
6855 let buffer = ' '
69- call inputsave ()
7056 echohl Question
7157 try
7258 while len (buffer ) < max
@@ -84,7 +70,6 @@ function! s:select(prompt, ...) abort
8470 return buffer
8571 finally
8672 echohl None
87- call inputrestore ()
8873 endtry
8974endfunction
9075
0 commit comments