64 lines
1.2 KiB
Bash
64 lines
1.2 KiB
Bash
# set zellij tab title
|
|
function current_dir() {
|
|
local current_dir=$PWD
|
|
if [[ $current_dir == $HOME ]]; then
|
|
current_dir="~"
|
|
else
|
|
current_dir=${current_dir##*/}
|
|
fi
|
|
|
|
echo $current_dir
|
|
}
|
|
|
|
function change_tab_title() {
|
|
local title=$1
|
|
command nohup zellij action rename-tab $title >/dev/null 2>&1
|
|
}
|
|
|
|
function set_tab_to_working_dir() {
|
|
local result=$?
|
|
local title=$(current_dir)
|
|
|
|
change_tab_title $title
|
|
}
|
|
|
|
function set_tab_to_command_line() {
|
|
local cmdline=$1
|
|
change_tab_title $cmdline
|
|
}
|
|
|
|
if [[ -n $ZELLIJ ]]; then
|
|
autoload -Uz add-zsh-hook
|
|
add-zsh-hook precmd set_tab_to_working_dir
|
|
add-zsh-hook preexec set_tab_to_command_line
|
|
fi
|
|
|
|
# load Cargo
|
|
if [ -f "$HOME/.cargo/env" ]; then
|
|
. "$HOME/.cargo/env"
|
|
fi
|
|
|
|
# load Guix
|
|
export GUIX_PROFILE="/home/nora/.config/guix/current"
|
|
if [ -f "$GUIX_PROFILE/etc/profile" ]; then
|
|
. "$GUIX_PROFILE/etc/profile"
|
|
fi
|
|
|
|
# load Guix stuff, if it exists
|
|
if [[ -d "$HOME/.zsh/functions" ]]; then
|
|
export fpath=(~/.zsh/functions $fpath)
|
|
autoload -U compinit && compinit
|
|
fi
|
|
|
|
export NOTESDIR="$HOME/Notes"
|
|
export PATH="$HOME/.bin:$HOME/.local/bin:$NOTESDIR/bin:$PATH"
|
|
|
|
function set_win_title(){
|
|
echo -ne "\033]0;\007"
|
|
}
|
|
|
|
precmd_functions+=(set_win_title)
|
|
|
|
fortune
|
|
|