jump to pos
This commit is contained in:
26
src/main.sh
26
src/main.sh
@@ -330,6 +330,11 @@ case "${1:-}" in
|
||||
esac
|
||||
exit 0
|
||||
;;
|
||||
"--playlist-place-cursor")
|
||||
pos=$(mpv_playlist_position)
|
||||
printf "pos(%s)" $((pos + 1))
|
||||
exit 0
|
||||
;;
|
||||
"--playlist")
|
||||
list_playlist
|
||||
exit 0
|
||||
@@ -455,6 +460,8 @@ IN_SEARCH_ARTIST_VIEW="$(printf "$IN_VIEW_PATTERN" "$VIEW_SEARCH_ARTIST")"
|
||||
IN_SEARCH_ALBUM_VIEW="$(printf "$IN_VIEW_PATTERN" "$VIEW_SEARCH_ALBUM")"
|
||||
FZF_CURRENT_MODE="\$FZF_INPUT_STATE"
|
||||
FZF_CURRENT_VIEW="\$FZF_BORDER_LABEL"
|
||||
FZF_RELOAD_PLAYLIST="reload-sync($0 --playlist)"
|
||||
FZF_POS_PLAYLIST="transform:$0 --playlist-place-cursor"
|
||||
PUT_FZF_KEY_LOGIC="case \$FZF_KEY in space) echo \"put( )\";; left) echo backward-char;; right) echo forward-char;; backspace|bspace|bs) echo backward-delete-char;; delete|del) echo delete-char;; *) echo \"put(\$FZF_KEY)\";; esac"
|
||||
while true; do
|
||||
case "$VIEW" in
|
||||
@@ -504,14 +511,14 @@ $KEYS_FILTER_LOCAL:transform:$0 --fzf-key {2} {3} {4}" \
|
||||
--bind="$KEYS_SEARCH_ALBUM:print($VIEW_SEARCH_ALBUM)+accept" \
|
||||
--bind="$KEYS_BROWSE:execute-silent:open \"https://musicbrainz.org/\track/{r3}\"" \
|
||||
--bind="$KEYS_OPEN:execute-silent:open \"\$(dirname {4})\"" \
|
||||
--bind="$KEYS_PLAYBACK,$KEYS_N_PLAYBACK:transform($0 --playback $VIEW_PLAYLIST {2} {3} {4})+reload-sync:$0 --playlist" \
|
||||
--bind="$KEYS_PLAYLIST_RELOAD:reload-sync:$0 --playlist" \
|
||||
--bind="$KEYS_PLAYLIST_REMOVE:execute-silent($0 --playlistcmd $PLAYLIST_CMD_REMOVE)+reload-sync:$0 --playlist" \
|
||||
--bind="$KEYS_PLAYLIST_UP:execute-silent($0 --playlistcmd $PLAYLIST_CMD_UP)+up+reload-sync:$0 --playlist" \
|
||||
--bind="$KEYS_PLAYLIST_DOWN:execute-silent($0 --playlistcmd $PLAYLIST_CMD_DOWN)+down+reload-sync:$0 --playlist" \
|
||||
--bind="$KEYS_PLAYLIST_CLEAR:execute-silent($0 --playlistcmd $PLAYLIST_CMD_CLEAR)+reload-sync:$0 --playlist" \
|
||||
--bind="$KEYS_PLAYLIST_CLEAR_ABOVE:execute-silent($0 --playlistcmd $PLAYLIST_CMD_CLEAR_ABOVE)+reload-sync:$0 --playlist" \
|
||||
--bind="$KEYS_PLAYLIST_CLEAR_BELOW:execute-silent($0 --playlistcmd $PLAYLIST_CMD_CLEAR_BELOW)+reload-sync:$0 --playlist" \
|
||||
--bind="$KEYS_PLAYBACK,$KEYS_N_PLAYBACK:transform($0 --playback $VIEW_PLAYLIST {2} {3} {4})+$FZF_RELOAD_PLAYLIST+$FZF_POS_PLAYLIST" \
|
||||
--bind="$KEYS_PLAYLIST_RELOAD:$FZF_RELOAD_PLAYLIST+$FZF_POS_PLAYLIST" \
|
||||
--bind="$KEYS_PLAYLIST_REMOVE:execute-silent($0 --playlistcmd $PLAYLIST_CMD_REMOVE)+$FZF_RELOAD_PLAYLIST" \
|
||||
--bind="$KEYS_PLAYLIST_UP:execute-silent($0 --playlistcmd $PLAYLIST_CMD_UP)+up+$FZF_RELOAD_PLAYLIST" \
|
||||
--bind="$KEYS_PLAYLIST_DOWN:execute-silent($0 --playlistcmd $PLAYLIST_CMD_DOWN)+down+$FZF_RELOAD_PLAYLIST" \
|
||||
--bind="$KEYS_PLAYLIST_CLEAR:execute-silent($0 --playlistcmd $PLAYLIST_CMD_CLEAR)+$FZF_RELOAD_PLAYLIST" \
|
||||
--bind="$KEYS_PLAYLIST_CLEAR_ABOVE:execute-silent($0 --playlistcmd $PLAYLIST_CMD_CLEAR_ABOVE)+$FZF_RELOAD_PLAYLIST" \
|
||||
--bind="$KEYS_PLAYLIST_CLEAR_BELOW:execute-silent($0 --playlistcmd $PLAYLIST_CMD_CLEAR_BELOW)+$FZF_RELOAD_PLAYLIST" \
|
||||
--bind="$KEYS_PLAYLIST_GOTO_RELEASE:print($VIEW_RELEASE)+accept" \
|
||||
--bind="$KEYS_PLAYLIST_QUIT:print($VIEW_LIST_ARTISTS)+accept" \
|
||||
--delimiter="\t" \
|
||||
@@ -521,10 +528,8 @@ $KEYS_FILTER_LOCAL:transform:$0 --fzf-key {2} {3} {4}" \
|
||||
VIEW="$(echo "$sel" | head -1)"
|
||||
ARGS="$(echo "$sel" | head -2 | tail -1)"
|
||||
MBID=$ARGS
|
||||
debug "playlist terminated: view=$VIEW, ARGS=$ARGS"
|
||||
;;
|
||||
"$VIEW_QUIT")
|
||||
debug "Quitting..."
|
||||
break
|
||||
;;
|
||||
*)
|
||||
@@ -605,7 +610,6 @@ open \"\$(dirname {4})\"" \
|
||||
)
|
||||
VIEW="$(echo "$sel" | head -1)"
|
||||
ARGS="$(echo "$sel" | head -2 | tail -1)"
|
||||
debug "FZF terminated: view=$VIEW, ARGS=$ARGS"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
Reference in New Issue
Block a user