diff --git a/docs/navi.cheat b/docs/navi.cheat index f83b3e23..94b52b3e 100644 --- a/docs/navi.cheat +++ b/docs/navi.cheat @@ -29,6 +29,12 @@ navi --tldr "" navi --cheatsh "" +% widget + +# Load shell widget +shell="$(basename $SHELL)"; eval "$(navi widget $shell)" + + % help # Read command-line help text diff --git a/shell/navi.plugin.bash b/shell/navi.plugin.bash index e0bbbf6f..851b8961 100644 --- a/shell/navi.plugin.bash +++ b/shell/navi.plugin.bash @@ -12,11 +12,12 @@ _navi_widget() { if [ -z "${last_command}" ]; then local -r output="$(_navi_call --print)" else - local -r find="$last_command" + local -r find="${last_command}_NAVIEND" local -r replacement="$(_navi_call --print --query "$last_command")" local output="$input" if [ -n "$replacement" ]; then - output="${input//$find/$replacement}" + output="${input}_NAVIEND" + output="${output//$find/$replacement}" fi fi diff --git a/shell/navi.plugin.zsh b/shell/navi.plugin.zsh index 99e95984..f94ee775 100644 --- a/shell/navi.plugin.zsh +++ b/shell/navi.plugin.zsh @@ -8,7 +8,6 @@ _navi_call() { _navi_widget() { local -r input="${LBUFFER}" local -r last_command="$(echo "${input}" | navi fn widget::last_command)" - local find="$last_command" local replacement="$last_command" if [ -z "$last_command" ]; then @@ -20,7 +19,9 @@ _navi_widget() { fi if [ -n "$replacement" ]; then - previous_output="${input//$find/$replacement}" + local -r find="${last_command}_NAVIEND" + previous_output="${input}_NAVIEND" + previous_output="${previous_output//$find/$replacement}" else previous_output="$input" fi