Control Spotify from Neovim.
Showing status using nvim-notify
- Linux operating system (this plugin doesn't work on Windows, and I not sure about Mac).
- pydbus (see requirements).
- If you are using pyenv to manage your Python provider, make sure you use:
pyenv virtualenv --system-site-packages system neovim
to create it.
- If you are using pyenv to manage your Python provider, make sure you use:
- wmctrl (optional, required only for the
show
command)sudo apt-get install wmctrl
sudo dnf install wmctrl
Install using vim-plug.
Put this on your init.vim
.
Plug 'stsewd/spotify.nvim', { 'do': ':UpdateRemotePlugins' }
- Start Spotify.
- Call
:Spotify {option}
. Where option can be:play/pause
next
prev
play
pause
stop
show
: Focus Spotify windowstatus
: Show current song and player statusvolume [value]
: Set the volume tovalue
. The value is a number from 0 to 100, you can prefix the value with+
or-
to change the volume relatively to the current value.time [value]
: Set the time of the current song tovalue
. The value is given in seconds, you can prefix the value with+
or-
to change the time relatively to the current value.shuffle [value]
: De/activate shuffle. The value can beon
oroff
,
g:spotify_show_status = 1
let g:spotify_symbols = {
\ "playing": "โถ",
\ "paused": "โธ",
\ "stopped": "โ ",
\ "volume.high": "๐",
\ "volume.medium": "๐",
\ "volume.low": "๐",
\ "volume.muted": "๐",
\ "shuffle.enabled": "โคฎ on",
\ "shuffle.disabled": "โคฎ off",
\ "progress.mark": "โ",
\ "progress.complete": "โ",
\ "progress.missing": "โ",
\}
The template is given by a list, where each element represents a line. And each element can be a template block or a list of of template blocks.
A template block is a dictionary with the folloing options:
template
: A string that would be evaluated using the.format()
Python method.align
: Alignment of the template, can be empty, left or center.shorten
: A boolean value, if it'strue
and the evaluated template is larger thanwidth
, the value will be truncated.
The variables you can use inside a template are:
status
: the current status (playing, paused, stopped).status_symbol
: the symbol fromspotify_symbols
.title
: the title of the song.artists
: comma separated artists.album_name
: the name of the album.album_artists
: comma separated artists.shuffle_symbol
: the symbol fromspotify_symbols
.volume
: the current volume level (0 to 100).volume_symbol
: the symbol fromspotify_symbols
.time
: the current time of the song in mm:ss format.length
: the length of the song in mm:ss format.progress_bar
: progress bar.
let g:spotify_template = [
\ {
\ "template": " ๐ถ {title}",
\ "shorten": v:true,
\ },
\ {
\ "template": " ๐จ {artists}",
\ "shorten": v:true,
\ },
\ {
\ "template": " ๐ฟ {album_name}",
\ "shorten": v:true,
\ },
\ {},
\ [
\ {
\ "template": " {shuffle_symbol}",
\ "align": "center",
\ },
\ {
\ "template": "{status_symbol}",
\ "align": "center",
\ },
\ {
\ "template": "{volume_symbol} {volume}% ",
\ "align": "center",
\ }
\ ],
\ {},
\ {
\ "template": "{time} / {length}",
\ "align": "center",
\ },
\ {
\ "template": "{progress_bar}",
\ "align": "center",
\ }
\]
Used when rendering the template from spotify_template
.
g:spotify_width = 34
The width of the progress bar used when rendering the template from spotify_template
.
g:spotify_progress_bar_width = 32
Time in milliseconds to wait to show the player status after each command.
This is needed, since DBus/Spotify takes some time applying a change.
g:spotify_wait_time = 0.2
nmap <leader>ss <Plug>(spotify-play/pause)
nmap <leader>sj <Plug>(spotify-next)
nmap <leader>sk <Plug>(spotify-prev)
nmap <leader>so <Plug>(spotify-show)
nmap <leader>sc <Plug>(spotify-status)
- playing: โถ
โถ๏ธ - paused: โธ โธ๏ธ
- stopped: โ โน๏ธ
- album: ๐ฟ๏ธ๐ฟ
- artist: ยฉ ๐จ
- music: โซโช ๐ถ
- volume: โ ๐จ ๐ฉ ๐ช ๐ ๐ ๐ ๐
- shuffle: โคฎ ๐