feature: init bash+blesh+starship #166

Merged
teutat3s merged 19 commits from feature/bash-blesh-starship into main 2023-06-28 17:07:36 +00:00
Showing only changes of commit db3af3c76a - Show all commits

View file

@ -27,33 +27,53 @@ in {
eval "$(${pkgs.direnv}/bin/direnv hook bash)" eval "$(${pkgs.direnv}/bin/direnv hook bash)"
bind 'set show-all-if-ambiguous on'
# Syntax highlighting, auto suggestions, vim modes, etc. # Syntax highlighting, auto suggestions, vim modes, etc.
# https://github.com/akinomyoga/ble.sh/wiki/Manual-A1-Installation#user-content-nixpkgs # https://github.com/akinomyoga/ble.sh/wiki/Manual-A1-Installation#user-content-nixpkgs
source "$(blesh-share)" --attach=none source "$(blesh-share)" --attach=none
# ctrl + space to accept autocomplete suggestion # ctrl + space to accept autocomplete suggestion
ble-bind -m 'auto_complete' -f 'C-@' 'auto_complete/insert-on-end' ble-bind -m 'auto_complete' -f 'C-@' 'auto_complete/insert-on-end'
# Meta (Alt) + Backspace to delete a word # Meta (Alt) + Backspace to delete a word
ble-bind -m 'emacs' -f 'M-C-?' 'kill-backward-cword' ble-bind -m 'vi_imap' -f 'M-C-?' 'kill-backward-cword'
# Meta (Alt) + p to jump one word backwards # Meta (Alt) + p to jump one word backwards
ble-bind -m 'emacs' -f M-p '@nomarked backward-cword' ble-bind -m 'vi_imap' -f M-p '@nomarked backward-cword'
# Meta (Alt) + n to jump one word forwards # Meta (Alt) + n to jump one word forwards
ble-bind -m 'emacs' -f M-n '@nomarked forward-cword' ble-bind -m 'vi_imap' -f M-n '@nomarked forward-cword'
# Arrow up and Ctrl + p searches history for entered input # Arrow up and Ctrl + p searches history for entered input
ble-bind -f up 'history-search-backward hide-status:immediate-accept:empty=emulate-readline:point=end' ble-bind -m 'vi_imap' -f up 'history-search-backward hide-status:immediate-accept:empty=emulate-readline:point=end'
ble-bind -f C-p '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 # Arrow down and Ctrl + n searches history for entered input
ble-bind -f down 'history-search-forward hide-status:immediate-accept:empty=emulate-readline:point=end' ble-bind -m 'vi_imap' -f down 'history-search-forward hide-status:immediate-accept:empty=emulate-readline:point=end'
ble-bind -f C-n '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'
function my/complete-load-hook { function my/complete-load-hook {
bleopt complete_auto_delay=300 bleopt complete_auto_delay=500
} }
blehook/eval-after-load complete my/complete-load-hook blehook/eval-after-load complete my/complete-load-hook
bleopt exec_errexit_mark= bleopt exec_errexit_mark=
bleopt history_share=1
bleopt filename_ls_colors="$LS_COLORS" bleopt filename_ls_colors="$LS_COLORS"
bleopt complete_menu_style=desc-raw
# 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'
fi
# end of .bashrc # end of .bashrc
[[ ''${BLE_VERSION-} ]] && ble-attach [[ ''${BLE_VERSION-} ]] && ble-attach
''; '';