forked from vim-ctrlspace/vim-ctrlspace
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathui.vim
More file actions
49 lines (39 loc) · 1.04 KB
/
Copy pathui.vim
File metadata and controls
49 lines (39 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
let s:config = ctrlspace#context#Configuration()
let s:modes = ctrlspace#modes#Modes()
function! ctrlspace#ui#Msg(message)
echo s:config.Symbols.CS . " " . a:message
endfunction
function! ctrlspace#ui#DelayedMsg(...)
if !empty(a:000)
let s:delayedMessage = a:1
elseif exists("s:delayedMessage") && !empty(s:delayedMessage)
redraw
call ctrlspace#ui#Msg(s:delayedMessage)
unlet s:delayedMessage
endif
endfunction
function! ctrlspace#ui#GetInput(msg, ...)
let msg = s:config.Symbols.CS . " " . a:msg
call inputsave()
if a:0 >= 2
let answer = input(msg, a:1, a:2)
elseif a:0 == 1
let answer = input(msg, a:1)
else
let answer = input(msg)
endif
call inputrestore()
redraw!
return answer
endfunction
function! ctrlspace#ui#Confirmed(msg)
return ctrlspace#ui#GetInput(a:msg . " (yN): ") =~? "y"
endfunction
function! ctrlspace#ui#ProceedIfModified()
for i in range(1, bufnr("$"))
if getbufvar(i, "&modified")
return ctrlspace#ui#Confirmed("Some buffers not saved. Proceed anyway?")
endif
endfor
return 1
endfunction