mirror of
https://github.com/preservim/vimux
synced 2024-11-12 01:11:10 +00:00
don't explode if you aren't in a tmux session
This commit is contained in:
parent
62ded6f281
commit
de99c54046
@ -190,11 +190,15 @@ end
|
||||
|
||||
class CurrentTmuxSession < TmuxSession
|
||||
def initialize
|
||||
session = self.get_session
|
||||
window = self.get_property(:active, :window)
|
||||
pane = self.get_property(:active, :pane)
|
||||
if tmux?
|
||||
session = self.get_session
|
||||
window = self.get_property(:active, :window)
|
||||
pane = self.get_property(:active, :pane)
|
||||
|
||||
super(session, window, pane)
|
||||
super(session, window, pane)
|
||||
else
|
||||
raise "You are not in a tmux session"
|
||||
end
|
||||
end
|
||||
|
||||
def get_property(match, type)
|
||||
@ -206,5 +210,9 @@ class CurrentTmuxSession < TmuxSession
|
||||
def get_session
|
||||
_run("display -p '#S'").strip
|
||||
end
|
||||
|
||||
def tmux?
|
||||
`echo $TMUX` =~ /.+/ ? true : false
|
||||
end
|
||||
end
|
||||
EOF
|
||||
|
Loading…
Reference in New Issue
Block a user