Aggiornato layout, inserito stub configurazione tmux.

This commit is contained in:
Emiliano Vavassori 2023-04-29 15:32:22 +02:00
parent 23b66b5aa6
commit 099625169d
12 changed files with 84 additions and 21 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
zsh/distro.base.zsh

40
prepare.sh Normal file
View File

@ -0,0 +1,40 @@
#!/bin/sh
# copying all the needed stuff in place.
DOTFILES=${HOME}/.dotfiles
# copying zshrc file
if [[ ! -f "$HOME/.zshrc" ]]; then
# no first setup done
# Determining operating system so we can quickly setup basic configuration
if uname -a | grep -qi 'debian'; then
# Debian
sudo apt install -y zsh-autosuggestions zsh-syntax-highlighting
ln -sf ${DOTFILES}/zsh/distro/debian.base.zsh ${DOTFILES}/zsh/distro.base.zsh
fi
if uname -a | grep -qi 'ubuntu'; then
# TODO: complete instructions for Ubuntu
ln -sf ${DOTFILES}/zsh/distro/ubuntu.base.zsh ${DOTFILES}/zsh/distro.base.zsh
fi
if uname -a | grep -qi 'manjaro'; then
# TODO: complete instructions for Manjaro
pamac install manjaro-zsh-config
ln -sf ${DOTFILES}/zsh/distro/manjaro.base.zsh ${DOTFILES}/zsh/distro.base.zsh
fi
if uname -a | grep -qi 'archlinux'; then
pacman -S zsh-autosuggestions zsh-syntax-highlighting
ln -sf ${DOTFILES}/zsh/distro/archlinux.base.zsh ${DOTFILES}/zsh/distro.base.zsh
fi
if [[ -f /etc/redhat-release ]] && grep -qi centos /etc/redhat-release; then
# TODO: installation on centos.
ln -sf ${DOTFILES}/zsh/distro/centos.base.zsh ${DOTFILES}/zsh/distro.base.zsh
fi
cp "${DOTFILES}/zshrc" "$HOME/.zshrc"
fi
# Copying tmux configuration file and initialize plugins.
if [[ ! -f "$HOME/.tmux.conf" ]]; then
cp "${DOTFILES}/tmux.conf" "$HOME/.tmux.conf"
fi

17
tmux.conf Normal file
View File

@ -0,0 +1,17 @@
# Set tmux to use correct colors
set-option -sa terminal-overrides ",xterm*:Tc"
# Using mouse
set -g mouse on
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'wfxr/tmux-power'
#set -g @tmux_power_theme 'sky'
set -g @tmux_power_theme '#3385ff'
set -g @tmux_power_date_format '%d/%m/%Y'
set -g @tmux_power_time_format '%H:%M'
set -g @tmux_power_date_icon ''
set -g @tmux_power_time_icon ''
run '~/.tmux/plugins/tpm/tpm'

View File

@ -0,0 +1,3 @@
# Configurations for Manjaro
source /usr/share/zsh/manjaro-zsh-config
source /usr/share/zsh/manjaro-zsh-prompt

View File

@ -0,0 +1 @@
source /usr/share/powerlevel9k/powerlevel9k.zsh-theme

View File

@ -0,0 +1,2 @@
set -g default-terminal $ZSH_TMUX_TERM
source-file $ZSH_TMUX_CONFIG

View File

@ -0,0 +1 @@
set -g default-terminal $ZSH_TMUX_TERM

View File

@ -1,20 +1,8 @@
# vim:sts=2:sw=2:ft=zsh
# Taken from: https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/plugins/tmux/tmux.plugin.zsh
#
if ! (( $+commands[tmux] )); then
print "zsh tmux plugin: tmux not found. Please install tmux before using this plugin." >&2
return 1
fi
# ALIASES
alias ta='tmux attach -t'
alias tad='tmux attach -d -t'
alias ts='tmux new-session -s'
alias tl='tmux list-sessions'
alias tksv='tmux kill-server'
alias tkss='tmux kill-session -t'
# CONFIGURATION VARIABLES
# Automatically start tmux
: ${ZSH_TMUX_AUTOSTART:=false}
@ -42,6 +30,16 @@ alias tkss='tmux kill-session -t'
# Set -u option to support unicode
: ${ZSH_TMUX_UNICODE:=false}
# ALIASES
alias ta='tmux attach -t'
alias tad='tmux attach -d -t'
alias ts='tmux new-session -s'
alias tl='tmux list-sessions'
alias tksv='tmux kill-server'
alias tkss='tmux kill-session -t'
alias tmuxconf='$EDITOR $ZSH_TMUX_CONFIG'
# Determine if the terminal supports 256 colors
if [[ $terminfo[colors] == 256 ]]; then
export ZSH_TMUX_TERM=$ZSH_TMUX_FIXTERM_WITH_256COLOR
@ -75,7 +73,11 @@ function _zsh_tmux_plugin_run() {
[[ "$ZSH_TMUX_UNICODE" == "true" ]] && tmux_cmd+=(-u)
# Try to connect to an existing session.
[[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach
if [[ -n "$ZSH_TMUX_DEFAULT_SESSION_NAME" ]]; then
[[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach -t $ZSH_TMUX_DEFAULT_SESSION_NAME
else
[[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach
fi
# If failed, just run tmux, fixing the TERM variable if requested.
if [[ $? -ne 0 ]]; then
@ -85,9 +87,9 @@ function _zsh_tmux_plugin_run() {
tmux_cmd+=(-f "$ZSH_TMUX_CONFIG")
fi
if [[ -n "$ZSH_TMUX_DEFAULT_SESSION_NAME" ]]; then
$tmux_cmd new-session -s $ZSH_TMUX_DEFAULT_SESSION_NAME
$tmux_cmd new-session -s $ZSH_TMUX_DEFAULT_SESSION_NAME
else
$tmux_cmd new-session
$tmux_cmd new-session
fi
fi

8
zshrc
View File

@ -1,7 +1,7 @@
# vim:sts=2:sw=2:ft=zsh
# Base directories for dotfiles.
export DOTFILES=~/.dotfiles
export DOTFILES=${HOME}/.dotfiles
# Autocompletion
export FPATH=${DOTFILES}/zsh/functions:${FPATH}
@ -10,11 +10,7 @@ autoload -Uz compaudit compinit
compinit
# zsh packages from system
uname -a | grep -qi 'debian' && source ${DOTFILES}/zsh/debian.base.zsh
uname -a | grep -qi 'ubuntu' && source /usr/share/powerlevel9k/powerlevel9k.zsh-theme
uname -a | grep -qi 'manjaro' && source /usr/share/zsh/manjaro-zsh-config && source /usr/share/zsh/manjaro-zsh-prompt
uname -a | grep -qi 'archlinux' && source ${DOTFILES}/zsh/archlinux.base.zsh
test -f /etc/redhat-release && grep -qi centos /etc/redhat-release && source ${DOTFILES}/zsh/centos.base.zsh
source ${DOTFILES}/zsh/distro.base.zsh
# Plugins
for plugin in `find $DOTFILES/zsh/plugins -type f -iname \*.plugin.zsh -print`; do