Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
1 files changed, 24 insertions, 14 deletions
-rw-r--r--.bashrc38
diff --git a/.bashrc b/.bashrc
index c1ca23c..911203e 100644
--- a/.bashrc
+++ b/.bashrc
@@ -225,24 +225,31 @@ export PROMPT_COMMAND="shell_var_fix;"
# }}}
# vi mode {{{
- bind 'set editing-mode vi'
- bind 'set show-mode-in-prompt on'
- bind "set vi-ins-mode-string \"$(left_cap)i$(right_cap)\""
- bind "set vi-cmd-mode-string \"$(left_cap $PS_WARN)n$(right_cap $PS_WARN)\""
+ if [[ $- =~ i ]]
+ then
+ bind 'set editing-mode vi'
+ bind 'set show-mode-in-prompt on'
+ bind "set vi-ins-mode-string \"$(left_cap)i$(right_cap)\""
+ bind "set vi-cmd-mode-string \"$(left_cap $PS_WARN)n$(right_cap $PS_WARN)\""
+
+ # Huge thanks to: https://lists.gnu.org/archive/html/help-bash/2022-02/msg00023.html
+ bind -x "\"\xC0\a\":set_tab_title \"\$READLINE_LINE\";printf \"$(left_cap $PS_DBG)%(%T)T$(right_cap $PS_DBG)\""
+ bind '"\xC0\r":accept-line'
+ bind '"\r":"\xC0\a\xC0\r"'
+ fi
# Thanks https://stackoverflow.com/a/13773343
set_tab_title() {
printf '\e]2;%s\a' "$*"
}
- # Huge thanks to: https://lists.gnu.org/archive/html/help-bash/2022-02/msg00023.html
- bind -x "\"\xC0\a\":set_tab_title \"\$READLINE_LINE\";printf \"$(left_cap $PS_DBG)%(%T)T$(right_cap $PS_DBG)\""
- bind '"\xC0\r":accept-line'
- bind '"\r":"\xC0\a\xC0\r"'
# }}}
# History {{{
- bind '"\e[A":history-search-backward'
- bind '"\e[B":history-search-forward'
+ if [[ $- =~ i ]]
+ then
+ bind '"\e[A":history-search-backward'
+ bind '"\e[B":history-search-forward'
+ fi
# Thanks to https://stackoverflow.com/a/19533853
shopt -s histappend
export HISTCONTROL=ignoredups HISTFILESIZE= HISTSIZE= HISTFILE=~/bash_history
@@ -386,10 +393,13 @@ EOF
# }}}
# Bindings {{{
- bind '"\C-l":clear-screen'
- bind -x '"\C-g":lazygit'
- bind -x '"\C-f":fg'
- bind '"\C-h": backward-kill-word'
+ if [[ $- =~ i ]]
+ then
+ bind '"\C-l":clear-screen'
+ bind -x '"\C-g":lazygit'
+ bind -x '"\C-f":fg'
+ bind '"\C-h": backward-kill-word'
+ fi
# }}}
# ANSI tests {{{