2023-01-28 21:05:02 +00:00
|
|
|
{
|
|
|
|
config,
|
2023-11-10 18:48:06 +00:00
|
|
|
flake,
|
2023-01-28 21:05:02 +00:00
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
psCfg = config.pub-solar;
|
|
|
|
xdg = config.home-manager.users."${psCfg.user.name}".xdg;
|
|
|
|
in {
|
|
|
|
enable = true;
|
|
|
|
|
2024-04-15 11:22:24 +00:00
|
|
|
historyControl = ["ignoredups" "ignorespace"];
|
|
|
|
historyFileSize = 300000;
|
2023-01-28 21:05:02 +00:00
|
|
|
|
|
|
|
# Run when initializing a login shell
|
2024-04-13 00:05:59 +00:00
|
|
|
profileExtra = if config.programs.sway.enable then ''
|
2024-03-06 17:42:25 +00:00
|
|
|
[ "$(tty)" = "/dev/tty1" ] && exec systemd-cat --identifier=sway ${pkgs.sway}/bin/sway
|
2024-04-13 00:05:59 +00:00
|
|
|
'' else "";
|
2023-01-28 21:05:02 +00:00
|
|
|
|
|
|
|
# Run when initializing an interactive shell
|
|
|
|
initExtra = ''
|
2023-11-10 18:48:06 +00:00
|
|
|
# Use fzf's CTRL-R history widget
|
|
|
|
source ${pkgs.fzf}/share/fzf/key-bindings.bash
|
2023-06-20 21:35:15 +00:00
|
|
|
# Show current directory at the top in Alacritty
|
2023-07-02 11:14:08 +00:00
|
|
|
PROMPT_COMMAND='echo -e -n "\e]2;$(basename "$PWD" | sed "s/${psCfg.user.name}/~/")\e\\"'
|
2023-05-31 18:54:31 +00:00
|
|
|
|
2024-02-02 22:27:44 +00:00
|
|
|
# Used for git aliases defined in modules/terminal-life/git/default.nix
|
|
|
|
export REVIEW_BASE=main
|
|
|
|
|
2023-01-28 21:05:02 +00:00
|
|
|
# If a command is not found, show me where it is
|
2023-12-04 11:34:44 +00:00
|
|
|
source ${pkgs.nix-index}/etc/profile.d/command-not-found.bash
|
2023-01-28 21:05:02 +00:00
|
|
|
|
|
|
|
# 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)"
|
|
|
|
|
2023-02-24 16:56:17 +00:00
|
|
|
bind 'set show-all-if-ambiguous on'
|
|
|
|
|
2023-01-28 21:05:02 +00:00
|
|
|
# Syntax highlighting, auto suggestions, vim modes, etc.
|
|
|
|
# https://github.com/akinomyoga/ble.sh/wiki/Manual-A1-Installation#user-content-nixpkgs
|
2023-05-17 22:04:39 +00:00
|
|
|
source "$(blesh-share)"/ble.sh --attach=none
|
2023-01-28 21:05:02 +00:00
|
|
|
# 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
|
2023-02-24 16:56:17 +00:00
|
|
|
ble-bind -m 'vi_imap' -f 'M-C-?' 'kill-backward-cword'
|
2023-01-28 21:05:02 +00:00
|
|
|
# Meta (Alt) + p to jump one word backwards
|
2023-05-31 18:54:31 +00:00
|
|
|
ble-bind -m 'vi_imap' -f M-p '@nomarked backward-uword'
|
|
|
|
ble-bind -m 'vi_imap' -f M-left '@nomarked backward-uword'
|
2023-01-28 21:05:02 +00:00
|
|
|
# Meta (Alt) + n to jump one word forwards
|
2023-05-31 18:54:31 +00:00
|
|
|
ble-bind -m 'vi_imap' -f M-n '@nomarked forward-uword'
|
|
|
|
ble-bind -m 'vi_imap' -f M-right '@nomarked forward-uword'
|
2023-01-28 21:05:02 +00:00
|
|
|
# Arrow up and Ctrl + p searches history for entered input
|
2023-02-24 16:56:17 +00:00
|
|
|
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'
|
2023-01-28 21:05:02 +00:00
|
|
|
# Arrow down and Ctrl + n searches history for entered input
|
2023-02-24 16:56:17 +00:00
|
|
|
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'
|
2023-01-28 21:05:02 +00:00
|
|
|
|
2023-05-31 18:54:31 +00:00
|
|
|
ble-face region_insert='fg=black,bg=navy'
|
|
|
|
|
2023-02-02 16:28:43 +00:00
|
|
|
function my/complete-load-hook {
|
2023-05-05 16:37:18 +00:00
|
|
|
bleopt complete_auto_delay=250
|
2023-02-02 16:28:43 +00:00
|
|
|
}
|
|
|
|
blehook/eval-after-load complete my/complete-load-hook
|
|
|
|
|
2023-02-25 23:19:17 +00:00
|
|
|
bleopt exec_elapsed_mark=
|
2023-02-02 16:28:43 +00:00
|
|
|
bleopt exec_errexit_mark=
|
2023-01-28 21:05:02 +00:00
|
|
|
bleopt filename_ls_colors="$LS_COLORS"
|
|
|
|
|
2023-02-24 17:23:36 +00:00
|
|
|
bleopt complete_menu_style=desc
|
2023-02-24 16:56:17 +00:00
|
|
|
|
2023-02-07 12:14:30 +00:00
|
|
|
# Bash vim mode keybindings
|
|
|
|
if [[ $- == *i* ]]; then # in interactive session
|
|
|
|
set -o vi
|
2024-04-15 11:23:10 +00:00
|
|
|
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
|
2023-02-07 12:14:30 +00:00
|
|
|
|
2024-04-15 11:23:10 +00:00
|
|
|
function blerc/vim-mode-hook {
|
|
|
|
# Write your settings for vi/vim mode here
|
2023-02-07 12:14:30 +00:00
|
|
|
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'
|
2023-04-15 10:44:45 +00:00
|
|
|
|
|
|
|
ble-bind -m vi_imap -f 'C-c' discard-line
|
2024-04-15 11:23:10 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
blehook/eval-after-load keymap_vi blerc/vim-mode-hook
|
2023-02-07 12:14:30 +00:00
|
|
|
|
2023-02-02 16:28:43 +00:00
|
|
|
# end of .bashrc
|
2023-06-20 21:36:07 +00:00
|
|
|
# Somehow we need to ensure starship starts later than ble.sh
|
|
|
|
# (possible packaging issue?)
|
2023-07-02 14:16:11 +00:00
|
|
|
# https://github.com/akinomyoga/ble.sh/issues/333
|
2023-06-20 21:36:07 +00:00
|
|
|
eval "$(${pkgs.starship}/bin/starship init bash)"
|
|
|
|
|
2023-02-02 16:28:43 +00:00
|
|
|
[[ ''${BLE_VERSION-} ]] && ble-attach
|
2023-01-28 21:05:02 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
shellAliases = {
|
|
|
|
nano = "nvim";
|
|
|
|
vi = "nvim";
|
|
|
|
vim = "nvim";
|
|
|
|
mutt = "neomutt";
|
2023-11-12 18:06:07 +00:00
|
|
|
ls = "eza";
|
|
|
|
la = "eza --group-directories-first -lag";
|
2023-01-28 21:05:02 +00:00
|
|
|
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
|
2023-11-10 18:48:06 +00:00
|
|
|
nixos-option = "nixos-option -I nixpkgs=${flake.self}/lib/compat";
|
2023-01-28 21:05:02 +00:00
|
|
|
myip = "dig +short myip.opendns.com @208.67.222.222 2>&1";
|
2023-07-13 13:53:10 +00:00
|
|
|
nnn = "nnn -d -e -H -r";
|
2024-02-07 18:10:03 +00:00
|
|
|
tmate = ''tmate -f "''${XDG_CONFIG_HOME}/tmate/tmate.conf"'';
|
2023-01-28 21:05:02 +00:00
|
|
|
};
|
|
|
|
}
|