plugin/percol: `shellcheck` & `shfmt`

According to `shellcheck`, the `_tac` alias simply doesn't work. At all. Ever. See SC2262 and SC2263.
pull/1956/head
John D Pell 2021-09-24 00:39:07 -07:00
parent 2ada414266
commit 92282c4795
2 changed files with 9 additions and 13 deletions

View File

@ -92,6 +92,7 @@ plugins/available/hub.plugin.bash
plugins/available/jump.plugin.bash
plugins/available/node.plugin.bash
plugins/available/nodenv.plugin.bash
plugins/available/percol.plugin.bash
plugins/available/plenv.plugin.bash
plugins/available/pyenv.plugin.bash
plugins/available/rbenv.plugin.bash

View File

@ -25,14 +25,9 @@ fi
function _replace_by_history() {
local HISTTIMEFORMAT= # Ensure we can parse history properly
if _command_exists tac
then
alias _tac=tac
else
alias _tac="tail -r"
fi
#TODO: "${histlines[@]/*( )+([[:digit:]])*( )/}"
local l="$(history | _tac | sed -e 's/^\ *[0-9]*\ *//' | percol --query "${READLINE_LINE:-}")"
local l
l="$(history | tail -r | sed -e 's/^\ *[0-9]*\ *//' | percol --query "${READLINE_LINE:-}")"
READLINE_LINE="${l}"
READLINE_POINT=${#l}
}