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

60
.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" . "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
fi fi
# Check if we are running from zellij, if not then launch it # Source ble.sh if it exists
launch_zellij_conditionally() { if [[ -f "${HOME}/.nix-profile/share/blesh/ble.sh" ]]; then
if [ -z "$ZELLIJ" ]; then source "${HOME}/.nix-profile/share/blesh/ble.sh"
# 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 # Custom function for fzf history search
zellij function fzf_history_search() {
local selected
# Exit if zellij exits properly with a zero exit code selected=$(history | fzf --tac --height=40% --layout=reverse --border --info=inline \
if [ $? -eq 0 ]; then --query="$READLINE_LINE" \
exit $? --color 'fg:#ebdbb2,bg:#282828,hl:#fabd2f,fg+:#ebdbb2,bg+:#3c3836,hl+:#fabd2f' \
fi --color 'info:#83a598,prompt:#bdae93,spinner:#fabd2f,pointer:#83a598,marker:#fe8019,header:#665c54' \
| sed 's/^ *[0-9]* *//')
echo "Zellij exited with a non-zero exit code, falling back to regular shell." if [[ -n "$selected" ]]; then
return READLINE_LINE="$selected"
READLINE_POINT=${#selected}
fi fi
ble-redraw-prompt
} }
# Disabled for now, I don't like the way it behaves but I don't want to remove it either # Bind Ctrl+R to our custom function
# launch_zellij_conditionally bind -x '"\C-r": fzf_history_search'
fi
# Source ble.sh if it exists
# 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
# }
# # Bind Ctrl+R to our custom function
# bind -x '"\C-r": fzf_history_search'
# fi
# Display a welcome message for interactive shells # Display a welcome message for interactive shells
if [ -t 1 ]; then 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", dest: "~/.ssh/config" }
- { src: "$DOTFILES_PATH/config/ssh/config.d", dest: "~/.ssh/config.d" } - { src: "$DOTFILES_PATH/config/ssh/config.d", dest: "~/.ssh/config.d" }
- { src: "$DOTFILES_PATH/config/starship.toml", dest: "~/.config/starship.toml" } - { src: "$DOTFILES_PATH/config/starship.toml", dest: "~/.config/starship.toml" }
- { src: "$DOTFILES_PATH/.bashrc", dest: "~/.bashrc.extra" }
- name: Create gitconfig symlink - name: Create gitconfig symlink
ansible.builtin.file: ansible.builtin.file:

View File

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

View File

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