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:
Menno van Leeuwen 2025-03-10 20:57:26 +01:00
parent f7787c592b
commit 6eac725e9d
Signed by: vleeuwenmenno
SSH Key Fingerprint: SHA256:OJFmjANpakwD3F2Rsws4GLtbdz1TJ5tkQF0RZmF0TRE
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

View File

@ -14,6 +14,7 @@
- { src: "$DOTFILES_PATH/config/ssh/config", dest: "~/.ssh/config" }
- { src: "$DOTFILES_PATH/config/ssh/config.d", dest: "~/.ssh/config.d" }
- { src: "$DOTFILES_PATH/config/starship.toml", dest: "~/.config/starship.toml" }
- { src: "$DOTFILES_PATH/.bashrc", dest: "~/.bashrc.extra" }
- name: Create gitconfig symlink
ansible.builtin.file:

View File

@ -4,8 +4,6 @@ let
dotfilesPath = builtins.getEnv "DOTFILES_PATH";
in
{
home.file.".bashrc.extra".source = "${dotfilesPath}/.bashrc";
programs.bash = {
enable = true;
enableCompletion = true;

View File

@ -1,5 +1,5 @@
Host *
IdentityFile $DOTFILES_PATH/secrets/ssh_keys/mennos-2025.pem
IdentityFile ~/.dotfiles/secrets/ssh_keys/mennos-2025.pem
IdentityAgent ~/.1password/agent.sock
AddKeysToAgent yes
ForwardAgent yes