Skip to content

Commit dbdee1c

Browse files
committed
Rename all commands to have "Vimux" as prefix.
There are still alias functions.
1 parent 1bc5f5b commit dbdee1c

File tree

1 file changed

+106
-27
lines changed

1 file changed

+106
-27
lines changed

plugin/vimux.vim

Lines changed: 106 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,47 @@ if !has("ruby")
77
finish
88
end
99

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()
1710

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
1833

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
2637

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
2746

47+
" deprecated!
2848
function RunVimTmuxCommand(command, ...)
49+
" TODO replace me with the direct function call!
50+
echoerr "RunVimTmuxCommand is deprecated, use VimuxRunCommand instead."
2951
let l:autoreturn = 1
3052

3153
if exists("a:1")
@@ -41,49 +63,106 @@ function RunVimTmuxCommand(command, ...)
4163
endif
4264
endfunction
4365

44-
function RunLastVimTmuxCommand()
66+
67+
function VimuxRunLastCommand()
4568
if exists("g:_VimTmuxCmd")
4669
ruby CurrentTmuxSession.new.run_shell_command(Vim.evaluate("g:_VimTmuxCmd"))
4770
else
4871
echo "No last command"
4972
endif
5073
endfunction
5174

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()
5383
if exists("g:_VimTmuxRunnerPane")
5484
unlet g:_VimTmuxRunnerPane
5585
end
5686
endfunction
5787

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()
5996
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."
6299
endfunction
63100

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()
65109
ruby CurrentTmuxSession.new.close_runner_pane
66-
call ClearVimTmuxWindow()
110+
call VimuxClearWindow()
67111
endfunction
68112

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()
70121
ruby CurrentTmuxSession.new.close_other_panes
71-
call ClearVimTmuxWindow()
122+
call VimuxClearWindow()
72123
endfunction
73124

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()
75133
ruby CurrentTmuxSession.new.interrupt_runner
76134
endfunction
77135

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()
79144
ruby CurrentTmuxSession.new.inspect_runner
80145
endfunction
81146

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()
83155
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()
85163
endfunction
86164

165+
87166
ruby << EOF
88167
class TmuxSession
89168
def initialize(session, window, pane)

0 commit comments

Comments
 (0)