@@ -137,6 +137,7 @@ class TmuxSession
137
137
_run (" split-window -p #{height} #{orientation}" )
138
138
end
139
139
@r unner_pane = active_pane_id
140
+ _send_command (" cd #{`pwd`}" , target (:pane = > runner_pane))
140
141
Vim.command (" let g:_VimTmuxRunnerPane = '#{@runner_pane}'" )
141
142
end
142
143
@@ -189,11 +190,15 @@ end
189
190
190
191
class CurrentTmuxSession < TmuxSession
191
192
def initialize
192
- session = self .get_session
193
- window = self .get_property (:active, :window )
194
- pane = self .get_property (:active, :pane)
193
+ if tmux?
194
+ session = self .get_session
195
+ window = self .get_property (:active, :window )
196
+ pane = self .get_property (:active, :pane)
195
197
196
- super (session, window , pane)
198
+ super (session, window , pane)
199
+ else
200
+ raise " You are not in a tmux session"
201
+ end
197
202
end
198
203
199
204
def get_property (match , type )
@@ -205,5 +210,9 @@ class CurrentTmuxSession < TmuxSession
205
210
def get_session
206
211
_run (" display -p '#S'" ).strip
207
212
end
213
+
214
+ def tmux?
215
+ `echo $TMUX ` = ~ /.+/ ? true : false
216
+ end
208
217
end
209
218
EOF
0 commit comments