2023-01-28 21:05:02 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
psCfg = config.pub-solar;
|
|
|
|
xdg = config.home-manager.users."${psCfg.user.name}".xdg;
|
|
|
|
in {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
historyControl = ["ignorespace"];
|
|
|
|
|
|
|
|
# Run when initializing a login shell
|
|
|
|
profileExtra = ''
|
|
|
|
[ "$(tty)" = "/dev/tty1" ] && exec ${pkgs.sway-service}/bin/sway-service
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Run when initializing an interactive shell
|
|
|
|
initExtra = ''
|
2023-05-31 18:54:31 +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
|
|
|
|
2023-01-28 21:05:02 +00:00
|
|
|
# If a command is not found, show me where it is
|
|
|
|
source ${pkgs.nix-index}/etc/profile.d/command-not-found.sh
|
|
|
|
|
|
|
|
# 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-07-02 14:16:11 +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-07-02 14:16:11 +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
|
|
|
|
|
|
|
|
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-02-07 23:35:10 +00:00
|
|
|
|
2023-04-15 10:44:45 +00:00
|
|
|
ble-bind -m vi_imap -f 'C-c' discard-line
|
2023-02-07 12:14:30 +00:00
|
|
|
fi
|
|
|
|
|
2023-02-02 16:28:43 +00:00
|
|
|
# end of .bashrc
|
2023-07-02 14:16:11 +00:00
|
|
|
# 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)"
|
|
|
|
|
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";
|
2024-09-12 15:05:20 +00:00
|
|
|
cat = "bat";
|
2023-12-17 16:14:19 +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";
|
|
|
|
no = "manix \"\" | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --preview=\"manix '{}'\" | xargs manix";
|
2023-07-13 13:53:10 +00:00
|
|
|
nnn = "nnn -d -e -H -r";
|
2023-01-28 21:05:02 +00:00
|
|
|
};
|
|
|
|
}
|