@@ -7,25 +7,47 @@ if !has("ruby")
7
7
finish
8
8
end
9
9
10
- command RunLastVimTmuxCommand :call RunLastVimTmuxCommand ()
11
- command CloseVimTmuxRunner :call CloseVimTmuxRunner ()
12
- command CloseVimTmuxPanes :call CloseVimTmuxPanes ()
13
- command CloseVimTmuxWindows :call CloseVimTmuxWindows ()
14
- command InspectVimTmuxRunner :call InspectVimTmuxRunner ()
15
- command InterruptVimTmuxRunner :call InterruptVimTmuxRunner ()
16
- command PromptVimTmuxCommand :call PromptVimTmuxCommand ()
17
10
11
+ " New style commands with 'normalized' names
12
+ command VimuxRunLastCommand :call VimuxRunLastCommand ()
13
+ command VimuxCloseRunner :call VimuxCloseRunner ()
14
+ command VimuxClosePanes :call VimuxClosePanes ()
15
+ command VimuxCloseWindows :call VimuxCloseWindows ()
16
+ command VimuxInspectRunner :call VimuxInspectRunner ()
17
+ command VimuxInterruptRunner :call VimuxInterruptRunner ()
18
+ command VimuxPromptCommand :call VimuxPromptCommand ()
19
+
20
+ " DEPRECATED
21
+ command RunLastVimTmuxCommand :call VimuxRunLastCommand ()
22
+ command CloseVimTmuxRunner :call VimuxCloseRunner ()
23
+ command CloseVimTmuxPanes :call VimuxClosePanes ()
24
+ command CloseVimTmuxWindows :call VimuxCloseWindows ()
25
+ command InspectVimTmuxRunner :call VimuxInspectRunner ()
26
+ command InterruptVimTmuxRunner :call VimuxInterruptRunner ()
27
+ command PromptVimTmuxCommand :call VimuxPromptCommand ()
28
+
29
+
30
+ " new style functions
31
+ function VimuxRunCommand (command , ... )
32
+ let l: autoreturn = 1
18
33
19
- command VimuxRunLastCommand :call RunLastVimTmuxCommand ()
20
- command VimuxCloseRunner :call CloseVimTmuxRunner ()
21
- command VimuxClosePanes :call CloseVimTmuxPanes ()
22
- command VimuxCloseWindows :call CloseVimTmuxWindows ()
23
- command VimuxInspectRunner :call InspectVimTmuxRunner ()
24
- command VimuxInterruptRunner :call InterruptVimTmuxRunner ()
25
- command VimuxPromptCommand :call PromptVimTmuxCommand ()
34
+ if exists (" a:1" )
35
+ let l: autoreturn = a: 1
36
+ endif
26
37
38
+ let g: _VimTmuxCmd = a: command
39
+
40
+ if l: autoreturn == 1
41
+ ruby CurrentTmuxSession.new .run_shell_command (Vim.evaluate (" g:_VimTmuxCmd" ))
42
+ else
43
+ ruby CurrentTmuxSession.new .run_shell_command (Vim.evaluate (" g:_VimTmuxCmd" ), false)
44
+ endif
45
+ endfunction
27
46
47
+ " deprecated!
28
48
function RunVimTmuxCommand (command , ... )
49
+ " TODO replace me with the direct function call!
50
+ echoerr " RunVimTmuxCommand is deprecated, use VimuxRunCommand instead."
29
51
let l: autoreturn = 1
30
52
31
53
if exists (" a:1" )
@@ -41,49 +63,106 @@ function RunVimTmuxCommand(command, ...)
41
63
endif
42
64
endfunction
43
65
44
- function RunLastVimTmuxCommand ()
66
+
67
+ function VimuxRunLastCommand ()
45
68
if exists (" g:_VimTmuxCmd" )
46
69
ruby CurrentTmuxSession.new .run_shell_command (Vim.evaluate (" g:_VimTmuxCmd" ))
47
70
else
48
71
echo " No last command"
49
72
endif
50
73
endfunction
51
74
52
- function ClearVimTmuxWindow ()
75
+ " deprecated!
76
+ function RunLastVimTmuxCommand ()
77
+ echoerr " RunLastVimTmuxCommand is deprecated, use VimuxRunLastCommand instead."
78
+ call VimuxRunLastCommand ()
79
+ endfunction
80
+
81
+
82
+ function VimuxClearWindow ()
53
83
if exists (" g:_VimTmuxRunnerPane" )
54
84
unlet g: _VimTmuxRunnerPane
55
85
end
56
86
endfunction
57
87
58
- function CloseVimTmuxWindows ()
88
+ " deprecated!
89
+ function ClearVimTmuxWindow ()
90
+ echoerr " ClearVimTmuxWindow is deprecated, use VimuxClearWindow instead."
91
+ call VimuxClearWindow ()
92
+ endfunction
93
+
94
+
95
+ function VimuxCloseWindows ()
59
96
ruby CurrentTmuxSession.new .close_other_panes
60
- call ClearVimTmuxWindow ()
61
- echoerr " CloseVimTmuxWindows is deprecated, use CloseVimTmuxPanes "
97
+ call VimuxClearWindow ()
98
+ echoerr " CloseVimTmuxWindows is deprecated, use VimuxClosePanes instead. "
62
99
endfunction
63
100
64
- function CloseVimTmuxRunner ()
101
+ " deprecated!
102
+ function CloseVimTmuxWindows ()
103
+ echoerr " ClearVimTmuxWindow is deprecated, use VimuxClosePanes instead."
104
+ call VimuxCloseWindows ()
105
+ endfunction
106
+
107
+
108
+ function VimuxCloseRunner ()
65
109
ruby CurrentTmuxSession.new .close_runner_pane
66
- call ClearVimTmuxWindow ()
110
+ call VimuxClearWindow ()
67
111
endfunction
68
112
69
- function CloseVimTmuxPanes ()
113
+ " deprecated!
114
+ function CloseVimTmuxRunner ()
115
+ echoerr " CloseVimTmuxRunner is deprecated, use VimuxCloseRunner instead."
116
+ call VimuxCloseRunner ()
117
+ endfunction
118
+
119
+
120
+ function VimuxClosePanes ()
70
121
ruby CurrentTmuxSession.new .close_other_panes
71
- call ClearVimTmuxWindow ()
122
+ call VimuxClearWindow ()
72
123
endfunction
73
124
74
- function InterruptVimTmuxRunner ()
125
+ " deprecated!
126
+ function CloseVimTmuxPanes ()
127
+ echoerr " CloseVimTmuxPanes is deprecated, use VimuxClosePanes instead."
128
+ call VimuxClosePanes ()
129
+ endfunction
130
+
131
+
132
+ function VimuxInterruptRunner ()
75
133
ruby CurrentTmuxSession.new .interrupt_runner
76
134
endfunction
77
135
78
- function InspectVimTmuxRunner ()
136
+ " deprecated!
137
+ function InterruptVimTmuxRunner ()
138
+ echoerr " InterruptVimTmuxRunner is deprecated, use VimuxInterruptRunner instead."
139
+ call VimuxInterruptRunner ()
140
+ endfunction
141
+
142
+
143
+ function VimuxInspectRunner ()
79
144
ruby CurrentTmuxSession.new .inspect_runner
80
145
endfunction
81
146
82
- function PromptVimTmuxCommand ()
147
+ " deprecated!
148
+ function InspectVimTmuxRunner ()
149
+ echoerr " InspectVimTmuxRunner is deprecated, use VimuxInspectRunner instead."
150
+ call VimuxInspectRunner ()
151
+ endfunction
152
+
153
+
154
+ function VimuxPromptCommand ()
83
155
let l: command = input (" Command? " )
84
- call RunVimTmuxCommand (l: command )
156
+ call VimuxRunCommand (l: command )
157
+ endfunction
158
+
159
+ " deprecated!
160
+ function PromptVimTmuxCommand ()
161
+ echoerr " PromptVimTmuxCommand is deprecated, use VimuxPromptCommand instead."
162
+ call VimuxPromptCommand ()
85
163
endfunction
86
164
165
+
87
166
ruby << EOF
88
167
class TmuxSession
89
168
def initialize (session, window , pane)
0 commit comments