Skip to content

Commit b9684aa

Browse files
committed
Add a VimuxResetSequence option so plugins can override
1 parent e925b0e commit b9684aa

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

README.mkd

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,17 @@ let VimuxOrientation = "h"
133133
```
134134

135135
### 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.
136+
Use nearest pane (not used by vim) if found instead of running split-window. Useful if you always have two panes opened and you want Vimux to use the existing one.
140137

141138
```viml
142139
let VimuxUseNearestPane = 1
143140
```
141+
142+
### VimuxResetSequence
143+
The keys sent to the runner pane before running a command. By default it sends `q` to make sure the pane is not in scroll-mode and `C-u` to clear the line.
144+
145+
**Default: `"q C-u"`
146+
147+
```viml
148+
let VimuxResetSequence = ""
149+
```

doc/vimux.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,13 @@ Use exising pane (not used by vim) if found instead of running split-window.
5959
let VimuxUseNearestPane = 1
6060

6161
Default: 0
62+
63+
------------------------------------------------------------------------------
64+
2.4 g:VimuxResetSequence *VimuxConfiguration_reset_sequence*
65+
66+
The keys sent to the runner pane before running a command. By default it sends
67+
`q` to make sure the pane is not in scroll-mode and `C-u` to clear the line.
68+
69+
let VimuxUseNearestPane = ""
70+
71+
Default: "q C-u"

plugin/vimux.vim

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ class TmuxSession
9898
end
9999
end
100100

101+
def reset_sequence
102+
if Vim.evaluate('exists("g:VimuxResetSequence")') != 0
103+
"#{Vim.evaluate('g:VimuxResetSequence')}"
104+
else
105+
"q C-u"
106+
end
107+
end
108+
101109
def inspect_runner
102110
_run("select-pane -t #{target(:pane => runner_pane)}")
103111
_run("copy-mode")
@@ -145,7 +153,7 @@ class TmuxSession
145153
end
146154

147155
def run_shell_command(command)
148-
_run("send-keys -t #{target(:pane => runner_pane)} q C-u")
156+
reset_shell
149157
_send_command(command, target(:pane => runner_pane))
150158
_move_up_pane
151159
end
@@ -156,6 +164,10 @@ class TmuxSession
156164
end
157165
end
158166

167+
def reset_shell
168+
_run("send-keys -t #{target(:pane => runner_pane)} #{reset_sequence}")
169+
end
170+
159171
def nearest_inactive_pane_id
160172
panes = _run("list-pane").split("\n")
161173
pane = panes.find { |p| p !~ /active/ }

0 commit comments

Comments
 (0)