imprv: colors
This commit is contained in:
30
src/main.sh
30
src/main.sh
@@ -73,9 +73,8 @@ FZF_DEFAULT_THREAD_LINE="{1} {3} ({4})"
|
||||
if [ "${1:-}" = "--show-thread" ]; then
|
||||
shift
|
||||
thread="$1"
|
||||
res=$(__notmuch_thread "$thread" | fzf \
|
||||
res=$(__notmuch_thread "$thread" | $FZF \
|
||||
--raw \
|
||||
--ansi \
|
||||
--reverse \
|
||||
--multi \
|
||||
--delimiter="$(printf '\t')" \
|
||||
@@ -106,9 +105,8 @@ CMD_EDIT_QUERY="edit-query"
|
||||
while true; do
|
||||
nmquery="${nmquery:-tag:inbox}"
|
||||
[ "$(tail -1 "$NMFHIST")" = "$nmquery" ] || echo "$nmquery" >> "$NMFHIST"
|
||||
cmd=$(__notmuch_search "$nmquery" | fzf \
|
||||
cmd=$(__notmuch_search "$nmquery" | $FZF \
|
||||
--header="Query: $nmquery" \
|
||||
--ansi \
|
||||
--tiebreak=index \
|
||||
--reverse \
|
||||
--multi \
|
||||
@@ -131,32 +129,33 @@ while true; do
|
||||
[ -n "$cmd" ] || exit 0
|
||||
case "$cmd" in
|
||||
$CMD_SEARCH_TAG*)
|
||||
tag=$(__notmuch_list_tags | fzf \
|
||||
--ansi \
|
||||
--cycle \
|
||||
tag=$(__notmuch_list_tags | $FZF \
|
||||
--color="border:$ANSICOLORTAGS" \
|
||||
--color="label:$ANSICOLORTAGS" \
|
||||
--tac \
|
||||
--bind='ctrl-d:half-page-down,ctrl-u:half-page-up' \
|
||||
--margin='20%' \
|
||||
--bind='enter:accept-or-print-query' \
|
||||
--border=double \
|
||||
--border-label='Select tag' || true)
|
||||
--border-label=" Select tag " || true)
|
||||
[ -n "$tag" ] || continue
|
||||
[ "$cmd" = "$CMD_SEARCH_TAG$APPEND" ] && nmquery="$nmquery and tag:$tag" || nmquery="tag:$tag"
|
||||
;;
|
||||
$CMD_SEARCH_ADDRESS*)
|
||||
case "$cmd" in
|
||||
*$ADDRESS_FROM*)
|
||||
label_text='Select sender'
|
||||
label_text=" Select sender "
|
||||
field='from'
|
||||
;;
|
||||
*)
|
||||
label_text='Select recipient'
|
||||
label_text=" Select recipient "
|
||||
field='to'
|
||||
;;
|
||||
esac
|
||||
address=$(__notmuch_list_address | fzf \
|
||||
--ansi \
|
||||
address=$(__notmuch_list_address | $FZF \
|
||||
--color="border:$ANSICOLORFROM" \
|
||||
--color="label:$ANSICOLORFROM" \
|
||||
--tiebreak=index \
|
||||
--cycle \
|
||||
--bind='ctrl-d:half-page-down,ctrl-u:half-page-up' \
|
||||
--margin='20%' \
|
||||
--bind='enter:accept-or-print-query' \
|
||||
@@ -173,8 +172,9 @@ while true; do
|
||||
esac
|
||||
;;
|
||||
$CMD_EDIT_QUERY*)
|
||||
nmquery=$(fzf \
|
||||
--ansi \
|
||||
nmquery=$($FZF \
|
||||
--color="border:$ANSICOLORSUBJ" \
|
||||
--color="label:$ANSICOLORSUBJ" \
|
||||
--tac \
|
||||
--bind='ctrl-d:half-page-down,ctrl-u:half-page-up' \
|
||||
--margin='20%' \
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
# Default theme
|
||||
if [ ! "${THEME_LOADED:-}" ]; then
|
||||
COLDATE="$(printf '\033[38;5;195m')"
|
||||
COLCNTS="$(printf '\033[38;5;244m')"
|
||||
COLFROM="$(printf '\033[38;5;208m')"
|
||||
COLSUBJ="$(printf '\033[38;5;179m\033[3m')"
|
||||
COLTAGS="$(printf '\033[38;5;106m\033[2m')"
|
||||
ANSICOLORDATE="${ANSICOLORDATE:-195}"
|
||||
ANSICOLORCNTS="${ANSICOLORCNTS:-244}"
|
||||
ANSICOLORFROM="${ANSICOLORFROM:-208}"
|
||||
ANSICOLORSUBJ="${ANSICOLORSUBJ:-179}"
|
||||
ANSICOLORTAGS="${ANSICOLORTAGS:-106}"
|
||||
COLDATE="$(printf '\033[38;5;%sm' "$ANSICOLORDATE")"
|
||||
COLCNTS="$(printf '\033[38;5;%sm' "$ANSICOLORCNTS")"
|
||||
COLFROM="$(printf '\033[38;5;%sm' "$ANSICOLORFROM")"
|
||||
COLSUBJ="$(printf '\033[38;5;%sm\033[3m' "$ANSICOLORSUBJ")"
|
||||
COLTAGS="$(printf '\033[38;5;%sm\033[2m' "$ANSICOLORTAGS")"
|
||||
COLRESET="$(printf '\033[0m')"
|
||||
|
||||
export ANSICOLORDATE ANSICOLORCNTS ANSICOLORFROM ANSICOLORSUBJ ANSICOLORTAGS
|
||||
export COLDATE COLCNTS COLFROM COLSUBJ COLTAGS COLRESET
|
||||
|
||||
export THEME_LOADED=1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
if [ ! "${TOOLS_LOADED:-}" ]; then
|
||||
if command -v "fzf" >/dev/null; then
|
||||
FZF="fzf --black --ansi --cycle --tiebreak=chunk,index"
|
||||
FZF="fzf --black --ansi --cycle --info=inline-right"
|
||||
else
|
||||
err "Did not find the command-line fuzzy finder fzf."
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user