[Linux] Add history to rofi command

This commit is contained in:
Ivan Malison 2017-03-25 14:22:23 -07:00
parent 6d69064904
commit 994f4dfb13
No known key found for this signature in database
GPG Key ID: 62530EFBE99DC2F8

View File

@ -15,8 +15,14 @@ get_all_aliases () {
alias | cut -d = -f 1
}
get_all_history () {
cat ~/.zsh_history | cut -d ';' -f 2- | awk '!a[$0]++'
}
selected=$({ get_all_executables; get_all_aliases; get_all_functions; get_all_history; } |
rofi -dmenu -i -kb-custom-1 "Alt+c" -kb-custom-2 "Alt+t")
selected=$({ get_all_executables; get_all_aliases; get_all_functions; } | rofi -dmenu -i -kb-custom-1 "Alt+c")
rofi_exit="$?"
args=""
case "$rofi_exit" in
@ -25,5 +31,9 @@ case "$rofi_exit" in
;;
10)
args=$(echo "" | rofi -dmenu)
;;
11)
urxvt --hold -e "$selected"
;;
esac
eval "$selected $args"