File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -190,11 +190,15 @@ end
190
190
191
191
class CurrentTmuxSession < TmuxSession
192
192
def initialize
193
- session = self .get_session
194
- window = self .get_property (:active, :window )
195
- 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)
196
197
197
- super (session, window , pane)
198
+ super (session, window , pane)
199
+ else
200
+ raise " You are not in a tmux session"
201
+ end
198
202
end
199
203
200
204
def get_property (match , type )
@@ -206,5 +210,9 @@ class CurrentTmuxSession < TmuxSession
206
210
def get_session
207
211
_run (" display -p '#S'" ).strip
208
212
end
213
+
214
+ def tmux?
215
+ `echo $TMUX ` = ~ /.+/ ? true : false
216
+ end
209
217
end
210
218
EOF
You can’t perform that action at this time.
0 commit comments