Commit 9c8aa52b authored by AdminXVII's avatar AdminXVII

Fix TMUX

parent a186147d
......@@ -34,26 +34,26 @@ alias tkss = 'tmux kill-session -t'
# CONFIGURATION VARIABLES
# Automatically start tmux
let TMUX_AUTOSTART ?= 0
export TMUX_AUTOSTART ?= 0
# Only autostart once. If set to false, tmux will attempt to
# autostart every time your zsh configs are reloaded.
let TMUX_AUTOSTART_ONCE ?= 1
export TMUX_AUTOSTART_ONCE ?= 1
# Automatically connect to a previous session if it exists
let TMUX_AUTOCONNECT ?= 1
export TMUX_AUTOCONNECT ?= 1
# Automatically close the terminal when tmux exits
let TMUX_AUTOQUIT ?= $TMUX_AUTOSTART
export TMUX_AUTOQUIT ?= $TMUX_AUTOSTART
# Set term to screen or screen-256color based on current terminal support
let TMUX_FIXTERM ?= 1
export TMUX_FIXTERM ?= 1
# Set '-CC' option for iTerm2 tmux integration
let TMUX_ITERM2 ?= 0
export TMUX_ITERM2 ?= 0
# The TERM to use for non-256 color terminals.
# Tmux states this should be screen, but you may need to change it on
# systems without the proper terminfo
let TMUX_FIXTERM_WITHOUT_256COLOR ?= screen
export TMUX_FIXTERM_WITHOUT_256COLOR ?= screen
# The TERM to use for 256 color terminals.
# Tmux states this should be screen-256color, but you may need to change it on
# systems without the proper terminfo
let TMUX_FIXTERM_WITH_256COLOR ?= screen-256color
export TMUX_FIXTERM_WITH_256COLOR ?= screen-256color
# Determine if the terminal supports 256 colors
# Currently not supported with Ion
......@@ -65,14 +65,14 @@ let TMUX_FIXTERM_WITH_256COLOR ?= screen-256color
# Set the correct local config file to use.
if not bool $TMUX_ITERM2 && test -e "$HOME/.tmux.conf"
export _TMUX_FIXED_CONFIG = "$(dirname $(readlink -f @args[0]))/tmux/extra.conf"
export ION_PLUGINS_TMUX_FIXED_CONFIG = "~/.config/ion/plugins/tools/tmux/extra.conf"
else
export _TMUX_FIXED_CONFIG = "$(dirname $(readlink -f @args[0]))/tmux/only.conf"
export ION_PLUGINS_TMUX_FIXED_CONFIG = "~/.config/ion/plugins/tools/tmux/tmux.conf"
end
# Wrapper function for tmux.
fn _tmux_plugin_run args:[str]
let tmux = $(which tmux)
let tmux = $(/usr/bin/env which tmux)
if not eq $len(@args) 0
$tmux @args
return $?
......@@ -85,15 +85,16 @@ fn _tmux_plugin_run args:[str]
# Try to connect to an existing session.
if bool $TMUX_AUTOCONNECT
$tmux_cmd attach
@tmux_cmd attach
end
# If failed, just run tmux, fixing the TERM variable if requested.
if not eq $? -ne 0
if not eq $? 0
if bool $TMUX_FIXTERM
let tmux_cmd ::= [ -f $_TMUX_FIXED_CONFIG ]
let tmux_cmd ++= [ -f $ION_PLUGINS_TMUX_FIXED_CONFIG ]
end
$tmux_cmd new-session
echo @tmux_cmd
@tmux_cmd new-session
end
if bool $TMUX_AUTOQUIT
......@@ -105,10 +106,10 @@ end
alias tmux = '_tmux_plugin_run'
# Autostart if not already in tmux and enabled.
if not test -z ${env::TMUX} && bool $TMUX_AUTOSTART && test -z ${env::INSIDE_EMACS} && test -z ${env::EMACS} && test -z ${env::VIM}
if not exists -s env::TMUX && bool $TMUX_AUTOSTART && not exists -s env::INSIDE_EMACS && not exists -s env::EMACS && not exists -s env::VIM
# Actually don't autostart if we already did and multiple autostarts are disabled.
if not bool $TMUX_AUTOSTART_ONCE || not bool $TMUX_AUTOSTARTED
if not bool $TMUX_AUTOSTART_ONCE || not exists -s env::TMUX_AUTOSTARTED
export TMUX_AUTOSTARTED = 1
_tmux_plugin_run
_tmux_plugin_run []
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment