Skip to content

Commit

Permalink
Implement restart for supported players
Browse files Browse the repository at this point in the history
  • Loading branch information
alyosha committed Sep 26, 2020
1 parent f324880 commit 364d728
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ experimental until all base functionality has been implemented.
- `:Skip` => Skip to next song
- `:Prev` => Go back to previous song
- `:Seek {duration}` => Seek forward/backward `x` seconds
- `:Restart` => Seek to beginning of current track
- `:Shuffle` => Toggle shuffle for the media player
- `:Mute` => Mute audio for all media players
- `:Unmute` => Unmute audio for all media players
Expand Down
3 changes: 3 additions & 0 deletions doc/vimedia.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ COMMANDS *vimedia-commands*
:Seek {duration} *:Seek*
Seek backward/forward for the specified duration (unit = seconds).

:Restart *:Restart*
Seek to begining of current song.

:Shuffle *:Shuffle*
Toggle shuffle status for the active media player.

Expand Down
4 changes: 4 additions & 0 deletions plugin/vimedia.vim
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ fu! s:Seek(duration_seconds) abort
call job_start(s:SeekCmd(s:selected_player, l:duration_microseconds))
endfu

fu! s:Restart() abort
call job_start(s:SeekCmd(s:selected_player, -1 * s:ticker_microseconds))
endfu

fu! s:Shuffle() abort
call job_start(s:GetPropertyCmd(s:selected_player, "Shuffle"), {"out_cb": function("s:ShuffleCallback")})
endfu
Expand Down

0 comments on commit 364d728

Please sign in to comment.