{ config, flake, pkgs, ... }: let psCfg = config.pub-solar; xdg = config.home-manager.users."${psCfg.user.name}".xdg; in { enable = true; historyControl = ["ignoredups" "ignorespace"]; historyFileSize = 300000; # Run when initializing a login shell profileExtra = if config.programs.sway.enable then '' [ "$(tty)" = "/dev/tty1" ] && exec systemd-cat --identifier=sway ${pkgs.sway}/bin/sway '' else ""; # Run when initializing an interactive shell initExtra = '' # Use fzf's CTRL-R history widget source ${pkgs.fzf}/share/fzf/key-bindings.bash # Show current directory at the top in Alacritty PROMPT_COMMAND='echo -e -n "\e]2;$(basename "$PWD" | sed "s/${psCfg.user.name}/~/")\e\\"' # Used for git aliases defined in modules/terminal-life/git/default.nix export REVIEW_BASE=main # If a command is not found, show me where it is source ${pkgs.nix-index}/etc/profile.d/command-not-found.bash # Helps you navigate directories faster # https://github.com/gsamokovarov/jump eval "$(${pkgs.jump}/bin/jump shell --bind=z)" eval "$(${pkgs.direnv}/bin/direnv hook bash)" bind 'set show-all-if-ambiguous on' # Syntax highlighting, auto suggestions, vim modes, etc. # https://github.com/akinomyoga/ble.sh/wiki/Manual-A1-Installation#user-content-nixpkgs source "$(blesh-share)"/ble.sh --attach=none # ctrl + space to accept autocomplete suggestion ble-bind -m 'auto_complete' -f 'C-@' 'auto_complete/insert-on-end' # Meta (Alt) + Backspace to delete a word ble-bind -m 'vi_imap' -f 'M-C-?' 'kill-backward-cword' # Meta (Alt) + p to jump one word backwards ble-bind -m 'vi_imap' -f M-p '@nomarked backward-uword' ble-bind -m 'vi_imap' -f M-left '@nomarked backward-uword' # Meta (Alt) + n to jump one word forwards ble-bind -m 'vi_imap' -f M-n '@nomarked forward-uword' ble-bind -m 'vi_imap' -f M-right '@nomarked forward-uword' # Arrow up and Ctrl + p searches history for entered input ble-bind -m 'vi_imap' -f up 'history-search-backward hide-status:immediate-accept:empty=emulate-readline:point=end' ble-bind -m 'vi_imap' -f C-p 'history-search-backward hide-status:immediate-accept:empty=emulate-readline:point=end' # Arrow down and Ctrl + n searches history for entered input ble-bind -m 'vi_imap' -f down 'history-search-forward hide-status:immediate-accept:empty=emulate-readline:point=end' ble-bind -m 'vi_imap' -f C-n 'history-search-forward hide-status:immediate-accept:empty=emulate-readline:point=end' ble-face region_insert='fg=black,bg=navy' function my/complete-load-hook { bleopt complete_auto_delay=250 } blehook/eval-after-load complete my/complete-load-hook bleopt exec_elapsed_mark= bleopt exec_errexit_mark= bleopt filename_ls_colors="$LS_COLORS" bleopt complete_menu_style=desc # Bash vim mode keybindings if [[ $- == *i* ]]; then # in interactive session set -o vi fi # Don't show a mode name in the normal mode function ferdinandyb/set-up-mode-indicator { # Define \q{ferdinandyb/mode-indicator} function ble/prompt/backslash:ferdinandyb/mode-indicator { if local mode; ble/keymap:vi/script/get-mode; [[ $mode != i ]]; then # call the built-in mode indicator ble/prompt/process-prompt-string '\q{keymap:vi/mode-indicator}' fi } # Specify \q{ferdinandyb/mode-indicator} in the mode-indicator prompt bleopt prompt_vi_mode_indicator='\q{ferdinandyb/mode-indicator}' } blehook/eval-after-load keymap_vi ferdinandyb/set-up-mode-indicator function blerc/vim-mode-hook { # Write your settings for vi/vim mode here ble-bind -m vi_imap -f 'ENTER' 'vi_imap/complete' ble-bind -m vi_imap -f 'TAB' 'vi_imap/complete' ble-bind -m vi_imap -f 'j j' 'vi_imap/normal-mode' ble-bind -m vi_imap -f 'ESC' 'vi_imap/normal-mode' ble-bind -m vi_nmap -f 'h' 'vi_nmap/insert-mode' ble-bind -m vi_nmap -f 'i' 'vi-command/backward-line' ble-bind -m vi_nmap -f 'j' 'vi-command/backward-char' ble-bind -m vi_nmap -f 'k' 'vi-command/forward-line' ble-bind -m vi_nmap -f 'l' 'vi-command/forward-char' ble-bind -m vi_imap -f 'C-c' discard-line } blehook/eval-after-load keymap_vi blerc/vim-mode-hook # end of .bashrc # Somehow we need to ensure starship starts later than ble.sh # (possible packaging issue?) # https://github.com/akinomyoga/ble.sh/issues/333 eval "$(${pkgs.starship}/bin/starship init bash)" [[ ''${BLE_VERSION-} ]] && ble-attach ''; shellAliases = { nano = "nvim"; vi = "nvim"; vim = "nvim"; mutt = "neomutt"; ls = "eza"; la = "eza --group-directories-first -lag"; wget = "wget --hsts-file=$XDG_CACHE_HOME/wget-hsts"; irssi = "irssi --config=$XDG_CONFIG_HOME/irssi/config --home=$XDG_DATA_HOME/irssi"; drone = "DRONE_TOKEN=$(secret-tool lookup drone token) drone"; no = "manix \"\" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --preview=\"manix '{}'\" | xargs manix"; # fix nixos-option nixos-option = "nixos-option -I nixpkgs=${flake.self}/lib/compat"; myip = "dig +short myip.opendns.com @208.67.222.222 2>&1"; nnn = "nnn -d -e -H -r"; tmate = ''tmate -f "''${XDG_CONFIG_HOME}/tmate/tmate.conf"''; }; }