moved tmux before sourcing
This commit is contained in:
parent
802196aaa8
commit
ac5ce1fbe6
10
.bashrc
10
.bashrc
|
@ -10,6 +10,16 @@ esac
|
||||||
chmod 700 ~/.bashrc.d
|
chmod 700 ~/.bashrc.d
|
||||||
chmod 600 ~/.bashrc ~/.bashrc.d/*
|
chmod 600 ~/.bashrc ~/.bashrc.d/*
|
||||||
|
|
||||||
|
# check if we are already in a Tmux session or open/attach the default one
|
||||||
|
if [[ "${TERM-}" != tmux* ]] && [[ -z "${TMUX}" ]] && [[ -z "${SSH_CONNECTION}" ]] && command -v tmux 1> /dev/null; then
|
||||||
|
# open/attach the local default Tmux session
|
||||||
|
systemd-run -q --scope --user --unit tmux-session-local tmux new-session -A -s local && exit
|
||||||
|
elif [[ -z "${TMUX}" ]] && [[ -n "${SSH_CONNECTION}" ]] && command -v tmux 1> /dev/null; then
|
||||||
|
# open/attach the SSH default Tmux session
|
||||||
|
systemd-run -q --scope --user --unit tmux-session-ssh tmux new-session -A -s ssh && exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if Tmux is not installed or if we are inside a Tmux session continue the sourcing
|
||||||
for file in ~/.bashrc.d/*.bashrc;
|
for file in ~/.bashrc.d/*.bashrc;
|
||||||
do
|
do
|
||||||
source "${file}"
|
source "${file}"
|
||||||
|
|
|
@ -23,7 +23,7 @@ else
|
||||||
alias grep='grep -a'
|
alias grep='grep -a'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# most common usage of df/du
|
# most common usage of df/du
|
||||||
if command -v hl 1> /dev/null; then
|
if command -v hl 1> /dev/null; then
|
||||||
alias df='df -Tha --total | hlauto --df'
|
alias df='df -Tha --total | hlauto --df'
|
||||||
else
|
else
|
||||||
|
@ -31,7 +31,7 @@ else
|
||||||
fi
|
fi
|
||||||
alias du='du -ach'
|
alias du='du -ach'
|
||||||
|
|
||||||
# better ncdu
|
# better ncdu
|
||||||
if command -v ncdu 1> /dev/null; then
|
if command -v ncdu 1> /dev/null; then
|
||||||
alias ncdu='ncdu -e --exclude-kernfs --color dark'
|
alias ncdu='ncdu -e --exclude-kernfs --color dark'
|
||||||
fi
|
fi
|
||||||
|
@ -100,7 +100,7 @@ if command -v xclip 1> /dev/null; then
|
||||||
# shortcuts to copy/paste text contents
|
# shortcuts to copy/paste text contents
|
||||||
alias xclip-in-txt='xclip -in -rmlastnl -selection clipboard'
|
alias xclip-in-txt='xclip -in -rmlastnl -selection clipboard'
|
||||||
alias xclip-txt-out='xclip -out -rmlastnl -selection clipboard'
|
alias xclip-txt-out='xclip -out -rmlastnl -selection clipboard'
|
||||||
# shortcuts to copy/paste other contents
|
# shortcuts to copy/paste other contents
|
||||||
alias xclip-in-png='xclip -in -selection clipboard -t image/png'
|
alias xclip-in-png='xclip -in -selection clipboard -t image/png'
|
||||||
alias xclip-in-jpeg='xclip -in -selection clipboard -t image/jpeg'
|
alias xclip-in-jpeg='xclip -in -selection clipboard -t image/jpeg'
|
||||||
alias xclip-in-gif='xclip -in -selection clipboard -t image/gif'
|
alias xclip-in-gif='xclip -in -selection clipboard -t image/gif'
|
||||||
|
@ -137,9 +137,10 @@ if command -v et 1> /dev/null; then
|
||||||
alias etmotd='et --ssh-option SetEnv=SSH_MOTD=1'
|
alias etmotd='et --ssh-option SetEnv=SSH_MOTD=1'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# open a new tmux session named ssh_tmux or attach to it
|
# open/attach to a default tmux session named local or ssh
|
||||||
if command -v tmux 1> /dev/null; then
|
if command -v tmux 1> /dev/null; then
|
||||||
alias tmuxs='tmux new-session -A -s ssh_tmux && exit'
|
alias tmux-local='systemd-run -q --scope --user --unit tmux-session-local tmux new-session -A -s local && exit'
|
||||||
|
alias tmux-ssh='systemd-run -q --scope --user --unit tmux-session-ssh tmux new-session -A -s ssh && exit'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# vifm: tui file explorer
|
# vifm: tui file explorer
|
||||||
|
|
|
@ -86,16 +86,6 @@ c() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
# shortcut for tmux to open a new default session with a name or attach if it exist
|
|
||||||
# an alias tmuxs exist too for ssh sessions
|
|
||||||
if command -v tmux 1> /dev/null; then
|
|
||||||
tmuxa() {
|
|
||||||
systemd-run -q --scope --user tmux new-session -A -s default "$@"
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ==============================
|
# ==============================
|
||||||
# Utils
|
# Utils
|
||||||
# ==============================
|
# ==============================
|
||||||
|
|
|
@ -5,13 +5,7 @@
|
||||||
# AUTOSTART
|
# AUTOSTART
|
||||||
# ==============================
|
# ==============================
|
||||||
|
|
||||||
# run tmux if TMUX variable is null
|
# run MOTD at login only in an ssh session containing the env $SSH_MOTD=1
|
||||||
if [[ "${TERM-}" != tmux* ]] && [[ -z "${TMUX}" ]] && [[ -z "${SSH_CONNECTION}" ]]; then
|
|
||||||
tmuxa
|
|
||||||
elif [[ -z "${TMUX}" ]] && [[ -n "${SSH_CONNECTION}" ]]; then
|
|
||||||
tmuxs
|
|
||||||
fi
|
|
||||||
# run MOTD at login only in an ssh session
|
|
||||||
if [[ -n "${TMUX}" ]] && [[ -n "${SSH_CONNECTION}" ]] && [[ "${SSH_MOTD-}" == 1 ]] && [[ -f "/etc/update-motd.d/00-motdfetch" ]]; then
|
if [[ -n "${TMUX}" ]] && [[ -n "${SSH_CONNECTION}" ]] && [[ "${SSH_MOTD-}" == 1 ]] && [[ -f "/etc/update-motd.d/00-motdfetch" ]]; then
|
||||||
motd
|
motd
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue