dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit cd89f63b65c4939632903adcfc602d6da8e7f479
parent c7700ee48e74f08f58e0ff02b0c11dfa42a737b6
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Thu,  2 Jul 2020 13:21:06 +0200

Increase history size and show most recent first in selection menu

Diffstat:
M.local/bin/define | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.local/bin/define b/.local/bin/define @@ -1,7 +1,7 @@ #!/bin/sh set -e history_file=~/.cache/define.hist -history_length=20 +history_length=100 show_help() { echo "usage: ${0##*/} [OPTIONS] TERM[S]" @@ -26,7 +26,7 @@ trim_history_file() { } add_to_history() { - echo "$1" >> "$history_file" + printf '%s\n' "$1" >> "$history_file" } define() { @@ -75,7 +75,7 @@ done prepare_history_file if [ "$gui" = 1 ]; then - suggestions="$(xclip -o || :; echo; cat "$history_file")" + suggestions="$(xclip -o || :; tail -r "$history_file")" word=$(echo "$suggestions" | dmenu -i -p "Dictionary lookup:") || exit 1 notify-send -t 10000 "define: $word" "$(define "$word" | remove_comm_msgs)" exit 0