dic: fix edge case
This commit is contained in:
parent
d400aaba20
commit
1f7cd8cfa7
|
@ -394,8 +394,9 @@ hex() { hexyl "$@" | "${PAGER:-less}"; }
|
||||||
|
|
||||||
export DICT="$XDG_DATA_HOME/dictcc"
|
export DICT="$XDG_DATA_HOME/dictcc"
|
||||||
dic() {
|
dic() {
|
||||||
result=$(cat $DICT/dict.txt | sed '/#/d;/&/d;/^$/d' | fzf --tiebreak=chunk,length --bind='alt-bspace:clear-query' --print-query --query="$1") &&
|
result=$(cat $DICT/dict.txt | sed '/#/d;/&/d;/^$/d' | FZF_DEFAULT_OPTS=${FZF_DEFAULT_OPTS#--exit-0} fzf --tiebreak=chunk,length --bind='alt-bspace:clear-query' --print-query --query="$1") &&
|
||||||
dic "$(echo "$result" | tail -1 | sed 's/\t/\n/g' | head -2 | grep --invert-match --ignore-case "$(echo "$result" | head -1)" || echo "$result" | head -1 | sed 's/ \W.*//')"
|
dic "$(echo "$result" | tail -1 | sed 's/\t/\n/g' | head -2 | grep --invert-match --ignore-case "$(echo "$result" | head -1)" --max-count 1 || echo "$result" | head -1 | sed 's/ \W.*//')"
|
||||||
|
# Could be slightly improved using fzf -f to reproduce selection
|
||||||
}
|
}
|
||||||
#fzf --tiebreak=length --bind='alt-bspace:clear-query'
|
#fzf --tiebreak=length --bind='alt-bspace:clear-query'
|
||||||
alias dict="rlwrap rdictcc --directory $DICT"
|
alias dict="rlwrap rdictcc --directory $DICT"
|
||||||
|
|
Loading…
Reference in New Issue