File tree Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -131,3 +131,13 @@ Set the default position of the runner pane.
131
131
``` viml
132
132
let VimuxOrientation = "h"
133
133
```
134
+
135
+ ### VimuxUseNearestPane
136
+ Use nearest pane (not used by vim) if found instead of running
137
+ split-window.
138
+ Useful if you always have two panes opened and you want Vimux to use the
139
+ existing one.
140
+
141
+ ``` viml
142
+ let VimuxUseNearestPane = 1
143
+ ```
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ The percent of the screen the split pane Vimux will spawn should take up.
37
37
Default: "20"
38
38
39
39
------------------------------------------------------------------------------
40
- 2.2 g:VimuxOrientation *VimuxConfiguration_oriengation *
40
+ 2.2 g:VimuxOrientation *VimuxConfiguration_orientation *
41
41
42
42
The default orientation of the split tmux pane. This tells tmux to make the
43
43
pane either vertically or horizontally, which is backward from how Vim handles
@@ -50,3 +50,12 @@ Options:
50
50
"h": horizontal
51
51
52
52
Default: "v"
53
+
54
+ ------------------------------------------------------------------------------
55
+ 2.3 g:VimuxUseNearestPane *VimuxConfiguration_use_nearest_pane*
56
+
57
+ Use exising pane (not used by vim) if found instead of running split-window.
58
+
59
+ let VimuxUseNearestPane = 1
60
+
61
+ Default: 0
Original file line number Diff line number Diff line change @@ -130,7 +130,12 @@ class TmuxSession
130
130
def runner_pane
131
131
if @r unner_pane.nil?
132
132
type = Vim.evaluate (' exists("g:_VimTmuxInspecting")' ) != 0
133
- _run (" split-window -p #{height} #{orientation}" )
133
+ use_nearest_pane = Vim.evaluate (' exists("g:VimuxUseNearestPane")' ) != 0
134
+ if use_nearest_pane && nearest_inactive_pane_id
135
+ _run (" select-pane -t #{target(:pane => nearest_inactive_pane_id)}" )
136
+ else
137
+ _run (" split-window -p #{height} #{orientation}" )
138
+ end
134
139
@r unner_pane = active_pane_id
135
140
Vim.command (" let g:_VimTmuxRunnerPane = '#{@runner_pane}'" )
136
141
end
@@ -162,6 +167,12 @@ class TmuxSession
162
167
end
163
168
end
164
169
170
+ def nearest_inactive_pane_id
171
+ panes = _run (" list-pane" ).split (" \n " )
172
+ pane = panes.find { |p | p !~ /active/ }
173
+ pane ? pane.split (' :' ).first : nil
174
+ end
175
+
165
176
def _move_up_pane
166
177
_run (" select-pane -t #{target}" )
167
178
end
You can’t perform that action at this time.
0 commit comments