diff --git a/scripts/reshctl.sh b/scripts/reshctl.sh index a3b0775..6e85bfd 100644 --- a/scripts/reshctl.sh +++ b/scripts/reshctl.sh @@ -10,12 +10,15 @@ __resh_nop() { } __resh_bind_control_R() { + bindfunc --revert '\C-r' __resh_widget_control_R_compat if [ "${__RESH_control_R_bind_enabled-0}" != 0 ]; then - echo "RESH SEARCH app Ctrl+R binding is already enabled!" - return 1 + # Re-binding is a valid usecase but it shouldn't happen much + # so this is a warning + echo "Re-binding RESH SEARCH app to Ctrl+R ..." + else + # Only save original binding if resh binding was not enabled + __RESH_bindfunc_revert_control_R_bind=$_bindfunc_revert fi - bindfunc --revert '\C-r' __resh_widget_control_R_compat - __RESH_bindfunc_revert_control_R_bind=$_bindfunc_revert __RESH_control_R_bind_enabled=1 if [ -n "${BASH_VERSION-}" ]; then # fuck bash diff --git a/scripts/shellrc.sh b/scripts/shellrc.sh index 3a78610..c21f335 100644 --- a/scripts/shellrc.sh +++ b/scripts/shellrc.sh @@ -73,6 +73,8 @@ __resh_set_xdg_home_paths __resh_run_daemon +[ "$(resh-config --key BindControlR)" = true ] && __resh_bind_control_R + # block for anything we only want to do once per session # NOTE: nested shells are still the same session if [ -z "${__RESH_SESSION_ID+x}" ]; then @@ -90,7 +92,5 @@ if [ -z "${__RESH_INIT_DONE+x}" ]; then __resh_reset_variables - [ "$(resh-config --key BindControlR)" = true ] && __resh_bind_control_R - __RESH_INIT_DONE=1 -fi +fi \ No newline at end of file