imprv: search enable/disable, some keys, comments
This commit is contained in:
@@ -78,7 +78,7 @@ fzf_handle_load() {
|
|||||||
;;
|
;;
|
||||||
"$VIEW_LIST_ALBUMS") ;;
|
"$VIEW_LIST_ALBUMS") ;;
|
||||||
esac
|
esac
|
||||||
[ "${DISABLE_SEARCH:-}" ] && printf "+disable-search+change-query(%s)" "${QUERY:-"$FZF_QUERY"}" || printf "+enable-search+change-query(%s)" "${QUERY:-}"
|
[ "${DISABLE_SEARCH:-}" ] && printf "+disable-search+change-query(%s)+disable-search" "${QUERY:-"$FZF_QUERY"}" || printf "+enable-search+change-query(%s)+enable-search" "${QUERY:-}"
|
||||||
[ "${SHOW_PREVIEW:-}" ] && printf "+show-preview" || printf "+hide-preview"
|
[ "${SHOW_PREVIEW:-}" ] && printf "+show-preview" || printf "+hide-preview"
|
||||||
[ "${ENABLE_CHANGE:-}" ] && printf "+rebind(change)" || printf "+unbind(change)"
|
[ "${ENABLE_CHANGE:-}" ] && printf "+rebind(change)" || printf "+unbind(change)"
|
||||||
__set_prompt "$view" "$mode"
|
__set_prompt "$view" "$mode"
|
||||||
@@ -547,6 +547,7 @@ fzf_handle_key() {
|
|||||||
if [ "${VIEW_NEXT:-}" ]; then
|
if [ "${VIEW_NEXT:-}" ]; then
|
||||||
[ "$VIEW_NEXT" = "$VIEW_PLAYLIST" ] && MODE_NEXT="$MODE_NORMAL"
|
[ "$VIEW_NEXT" = "$VIEW_PLAYLIST" ] && MODE_NEXT="$MODE_NORMAL"
|
||||||
state_update "$VIEW_NEXT" "${MODE_NEXT:-"$mode"}" "${VIEW_NEXT_ARGS:-}"
|
state_update "$VIEW_NEXT" "${MODE_NEXT:-"$mode"}" "${VIEW_NEXT_ARGS:-}"
|
||||||
|
[ "$MODE_NEXT" = "$MODE_INSERT" ] && printf "+enable-search" || printf "+disable-search"
|
||||||
[ "${ACCEPT:-}" ] && printf "+accept" || printf "+reload:%s" "$0 --fzf-reload"
|
[ "${ACCEPT:-}" ] && printf "+accept" || printf "+reload:%s" "$0 --fzf-reload"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@@ -1,3 +1,25 @@
|
|||||||
|
# Key bindings
|
||||||
|
#
|
||||||
|
# Some key-bindings are used exclusively in the normal mode, others exclusively
|
||||||
|
# in the insert mode, others in both modes.
|
||||||
|
# Some key-bindings are universal in the sense that they do not depend on the
|
||||||
|
# state of the player (view, mode, arguments), others are not universal.
|
||||||
|
#
|
||||||
|
# For fast processing, we propose the following.
|
||||||
|
# The mode (normal or insert) is stored in the FZF_INPUT_STATE variable. All
|
||||||
|
# key-bindings that are independent of the `view` and of the `arguments` are
|
||||||
|
# directly processed using a `--bind` with inline transform element. Keys that
|
||||||
|
# depend on `view` or `arguments` are processed through `$0 --fzf-key`. In a
|
||||||
|
# future step, we may also store the `view` part of the state as hidden fields
|
||||||
|
# in the list (the list generator makes that). Then, it may be possible to
|
||||||
|
# completely get rid of the state files. Even beter, we may store the view part
|
||||||
|
# in FZF_HEADER_LABEL.
|
||||||
|
#
|
||||||
|
# Switching between the modes (normal <-> insert) is done using two fzf `--bind`
|
||||||
|
# arguments. We make sure that only one is active.
|
||||||
|
KEYS_I_NORMAL="${KEYS_I_NORMAL:-"esc"}"
|
||||||
|
KEYS_N_INSERT="${KEYS_N_INSERT:-"a,i,/"}"
|
||||||
|
|
||||||
KEYS_INPUT_SINGLE='0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,!,",#,$,%,&,\,(,),*,+,,,-,.,/,:,;,<,=,>,?,@,[,\,\,],^,_,`,{,|,},~'
|
KEYS_INPUT_SINGLE='0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,!,",#,$,%,&,\,(,),*,+,,,-,.,/,:,;,<,=,>,?,@,[,\,\,],^,_,`,{,|,},~'
|
||||||
KEYS_INPUT_SINGLE="$KEYS_INPUT_SINGLE,'"
|
KEYS_INPUT_SINGLE="$KEYS_INPUT_SINGLE,'"
|
||||||
KEYS_INPUT_SPECIAL="space,backspace,delete,left,right"
|
KEYS_INPUT_SPECIAL="space,backspace,delete,left,right"
|
||||||
@@ -21,6 +43,8 @@ KEYS_SWITCH_LOCAL_REMOTE="${KEYS_SWITCH_LOCAL_REMOTE:-"ctrl-/"}"
|
|||||||
KEYS_PLAY="${KEYS_PLAY:-"enter"}"
|
KEYS_PLAY="${KEYS_PLAY:-"enter"}"
|
||||||
KEYS_QUEUE="${KEYS_QUEUE:-"ctrl-alt-m"}"
|
KEYS_QUEUE="${KEYS_QUEUE:-"ctrl-alt-m"}"
|
||||||
KEYS_SHOW_PLAYLIST="${KEYS_SHOW_PLAYLIST:-"ctrl-p"}"
|
KEYS_SHOW_PLAYLIST="${KEYS_SHOW_PLAYLIST:-"ctrl-p"}"
|
||||||
|
KEYS_NI="$KEYS_HALFPAGE_DOWN,$KEYS_HALFPAGE_UP,$KEYS_BROWSE,$KEYS_OPEN,$KEYS_OUT,$KEYS_IN,$KEYS_SELECT_ARTIST,$KEYS_FILTER_LOCAL,$KEYS_FILTER_1,$KEYS_FILTER_2,$KEYS_FILTER_3,$KEYS_FILTER_4,$KEYS_SWITCH_ARTIST_ALBUM,$KEYS_SWITCH_LOCAL_REMOTE,$KEYS_PLAY,$KEYS_QUEUE,$KEYS_SHOW_PLAYLIST"
|
||||||
|
export KEYS_NI
|
||||||
|
|
||||||
# Keys in normal mode only
|
# Keys in normal mode only
|
||||||
KEYS_N_DOWN="${KEYS_N_DOWN:-"j"}"
|
KEYS_N_DOWN="${KEYS_N_DOWN:-"j"}"
|
||||||
@@ -36,23 +60,21 @@ KEYS_N_PLAY_NEXT="${KEYS_N_PLAY_NEXT:-"right"}"
|
|||||||
KEYS_N_PLAY_PREV="${KEYS_N_PLAY_PREV:-"left"}"
|
KEYS_N_PLAY_PREV="${KEYS_N_PLAY_PREV:-"left"}"
|
||||||
KEYS_N_SEEK_FORWARD="${KEYS_N_SEEK_FORWARD:-"shift-right"}"
|
KEYS_N_SEEK_FORWARD="${KEYS_N_SEEK_FORWARD:-"shift-right"}"
|
||||||
KEYS_N_SEEK_BACKWARD="${KEYS_N_SEEK_BACKWARD:-"shift-left"}"
|
KEYS_N_SEEK_BACKWARD="${KEYS_N_SEEK_BACKWARD:-"shift-left"}"
|
||||||
|
KEYS_N="$KEYS_N_DOWN,$KEYS_N_UP,$KEYS_N_OUT,$KEYS_N_IN,$KEYS_N_TOP,$KEYS_N_BOT,$KEYS_N_QUIT,$KEYS_N_INSERT,$KEYS_N_TOGGLE_PLAY_PAUSE,$KEYS_N_PLAY_NEXT,$KEYS_N_PLAY_PREV,$KEYS_N_SEEK_FORWARD,$KEYS_N_SEEK_BACKWARD"
|
||||||
# Special playlist keys
|
export KEYS_N
|
||||||
KEYS_PLAYLIST_RELOAD="${KEYS_PLAYLIST_RELOAD:-"r"}"
|
|
||||||
|
|
||||||
# Keys in insert mode only
|
# Keys in insert mode only
|
||||||
KEYS_I_NORMAL="${KEYS_I_NORMAL:-"esc"}"
|
KEYS_I_NORMAL="${KEYS_I_NORMAL:-"esc"}"
|
||||||
|
KEYS_I="$KEYS_I_NORMAL"
|
||||||
|
export KEYS_I
|
||||||
|
|
||||||
|
# Special playlist keys
|
||||||
|
KEYS_PLAYLIST_RELOAD="${KEYS_PLAYLIST_RELOAD:-"r"}"
|
||||||
|
KEYS_PLAYLIST="$KEYS_PLAYLIST_RELOAD"
|
||||||
|
export KEYS_PLAYLIST
|
||||||
|
|
||||||
# Grouping
|
# Grouping
|
||||||
KEYS_GROUP_NI="$KEYS_HALFPAGE_DOWN,$KEYS_HALFPAGE_UP,$KEYS_OPEN,$KEYS_BROWSE,$KEYS_OUT,$KEYS_IN,$KEYS_SELECT_ARTIST,$KEYS_FILTER_LOCAL,$KEYS_FILTER_1,$KEYS_FILTER_2,$KEYS_FILTER_3,$KEYS_FILTER_4,$KEYS_SWITCH_ARTIST_ALBUM,$KEYS_SWITCH_LOCAL_REMOTE,$KEYS_PLAY,$KEYS_QUEUE,$KEYS_SHOW_PLAYLIST"
|
KEYS_ALL="$KEYS_NI,$KEYS_N,$KEYS_I,$KEYS_INPUT_SINGLE,$KEYS_INPUT_SPECIAL,$KEYS_PLAYLIST"
|
||||||
|
|
||||||
KEYS_GROUP_N="$KEYS_N_DOWN,$KEYS_N_UP,$KEYS_N_OUT,$KEYS_N_IN,$KEYS_N_TOP,$KEYS_N_BOT,$KEYS_N_QUIT,$KEYS_N_INSERT,$KEYS_N_TOGGLE_PLAY_PAUSE,$KEYS_N_PLAY_NEXT,$KEYS_N_PLAY_PREV,$KEYS_N_SEEK_FORWARD,$KEYS_N_SEEK_BACKWARD"
|
|
||||||
|
|
||||||
KEYS_GROUP_I="$KEYS_I_NORMAL"
|
|
||||||
|
|
||||||
KEYS_PLAYLIST="$KEYS_PLAYLIST_RELOAD"
|
|
||||||
|
|
||||||
KEYS_ALL="$KEYS_GROUP_NI,$KEYS_GROUP_N,$KEYS_GROUP_I,$KEYS_INPUT_SINGLE,$KEYS_INPUT_SPECIAL,$KEYS_PLAYLIST"
|
|
||||||
|
|
||||||
export KEYS_HALFPAGE_DOWN KEYS_HALFPAGE_UP KEYS_OPEN KEYS_BROWSE KEYS_OUT KEYS_IN \
|
export KEYS_HALFPAGE_DOWN KEYS_HALFPAGE_UP KEYS_OPEN KEYS_BROWSE KEYS_OUT KEYS_IN \
|
||||||
KEYS_SELECT_ARTIST KEYS_FILTER_LOCAL KEYS_FILTER_1 KEYS_FILTER_2 KEYS_FILETER_3 KEYS_FILTER_4 \
|
KEYS_SELECT_ARTIST KEYS_FILTER_LOCAL KEYS_FILTER_1 KEYS_FILTER_2 KEYS_FILETER_3 KEYS_FILTER_4 \
|
||||||
|
Reference in New Issue
Block a user