feat: update .bashrc and symlink configuration for improved shell functionality
Some checks failed
Nix Format Check / check-format (push) Failing after 38s

This commit is contained in:
2025-03-10 20:57:26 +01:00
parent f7787c592b
commit 6eac725e9d
4 changed files with 21 additions and 46 deletions

62
.bashrc
View File

@@ -109,52 +109,28 @@ if [ -f "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" ]; then
. "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
fi
# Check if we are running from zellij, if not then launch it
launch_zellij_conditionally() {
if [ -z "$ZELLIJ" ]; then
# Don't launch zellij in tmux, vscode, screen or zeditor.
if [ ! -t 1 ] || [ -n "$TMUX" ] || [ -n "$VSCODE_STABLE" ] || [ -n "$STY" ] || [ -n "$ZED_TERM" ]; then
return
fi
# Launch zellij
zellij
# Exit if zellij exits properly with a zero exit code
if [ $? -eq 0 ]; then
exit $?
fi
echo "Zellij exited with a non-zero exit code, falling back to regular shell."
return
fi
}
# Disabled for now, I don't like the way it behaves but I don't want to remove it either
# launch_zellij_conditionally
# Source ble.sh if it exists
# if [[ -f "${HOME}/.nix-profile/share/blesh/ble.sh" ]]; then
# source "${HOME}/.nix-profile/share/blesh/ble.sh"
if [[ -f "${HOME}/.nix-profile/share/blesh/ble.sh" ]]; then
source "${HOME}/.nix-profile/share/blesh/ble.sh"
# # Custom function for fzf history search
# function fzf_history_search() {
# local selected
# selected=$(history | fzf --tac --height=40% --layout=reverse --border --info=inline \
# --query="$READLINE_LINE" \
# --color 'fg:#ebdbb2,bg:#282828,hl:#fabd2f,fg+:#ebdbb2,bg+:#3c3836,hl+:#fabd2f' \
# --color 'info:#83a598,prompt:#bdae93,spinner:#fabd2f,pointer:#83a598,marker:#fe8019,header:#665c54' \
# | sed 's/^ *[0-9]* *//')
# if [[ -n "$selected" ]]; then
# READLINE_LINE="$selected"
# READLINE_POINT=${#selected}
# fi
# ble-redraw-prompt
# }
# Custom function for fzf history search
function fzf_history_search() {
local selected
selected=$(history | fzf --tac --height=40% --layout=reverse --border --info=inline \
--query="$READLINE_LINE" \
--color 'fg:#ebdbb2,bg:#282828,hl:#fabd2f,fg+:#ebdbb2,bg+:#3c3836,hl+:#fabd2f' \
--color 'info:#83a598,prompt:#bdae93,spinner:#fabd2f,pointer:#83a598,marker:#fe8019,header:#665c54' \
| sed 's/^ *[0-9]* *//')
if [[ -n "$selected" ]]; then
READLINE_LINE="$selected"
READLINE_POINT=${#selected}
fi
ble-redraw-prompt
}
# # Bind Ctrl+R to our custom function
# bind -x '"\C-r": fzf_history_search'
# fi
# Bind Ctrl+R to our custom function
bind -x '"\C-r": fzf_history_search'
fi
# Display a welcome message for interactive shells
if [ -t 1 ]; then