Skip to content

stuckinforloop/vibe.lua

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vibe.lua

Display synchronized Spotify lyrics in a floating Neovim window.

vibe.lua demo

Features

  • 🎵 Real-time synchronized lyrics from LRCLIB
  • 🔄 Automatic token refresh (authenticate once, use forever)
  • 🎨 Customizable floating window with song title
  • ⚡ Smooth scrolling with minimal API calls

Requirements

  • Neovim >= 0.10.0
  • plenary.nvim
  • curl (system)
  • Spotify account (Free or Premium)

Installation

{
    "stuckinforloop/vibe.lua",
    dependencies = { "nvim-lua/plenary.nvim" },
    config = function()
        require("vibe").setup({
            client_id = os.getenv("SPOTIFY_CLIENT_ID"),
            client_secret = os.getenv("SPOTIFY_CLIENT_SECRET"),
        })
    end,
}
use {
    "stuckinforloop/vibe.lua",
    requires = { "nvim-lua/plenary.nvim" },
    config = function()
        require("vibe").setup({
            client_id = "your_spotify_client_id",
            client_secret = "your_spotify_client_secret",
        })
    end,
}
Plug 'nvim-lua/plenary.nvim'
Plug 'stuckinforloop/vibe.lua'

lua << EOF
require("vibe").setup({
    client_id = "your_spotify_client_id",
    client_secret = "your_spotify_client_secret",
})
EOF

Spotify Setup

  1. Go to Spotify Developer Dashboard
  2. Create a new app
  3. In app settings, add this Redirect URI:
    http://127.0.0.1:8888/callback
    
  4. Copy your Client ID and Client Secret

Usage

Commands

Command Description
:VibeAuth Authenticate with Spotify (once)
:VibeStart Start displaying lyrics
:VibeStop Stop displaying lyrics
:VibeToggle Toggle lyrics display
:VibeLogout Log out and clear stored tokens

Quick Start

  1. Run :VibeAuth - browser opens for Spotify authorization
  2. Authorize the app
  3. Play a song on Spotify
  4. Run :VibeToggle

Keymaps

vim.keymap.set("n", "<leader>vt", "<cmd>VibeToggle<cr>", { desc = "Toggle lyrics" })
vim.keymap.set("n", "<leader>va", "<cmd>VibeAuth<cr>", { desc = "Spotify auth" })

Configuration

require("vibe").setup({
    -- Spotify credentials (required)
    client_id = "",
    client_secret = "",

    -- Timing
    update_interval = 100,            -- UI refresh rate (ms)
    spotify_api_poll_interval = 5000, -- Spotify API poll interval (ms)

    -- Window appearance
    window = {
        width = 40,
        height = 6,
        relative = "editor",
        anchor = "NE",        -- NE = top-right
        row = 1,
        col = 1,
        border = "rounded",
        style = "minimal",
    },

    -- Highlight groups
    styles = {
        highlight = "String",  -- Current line
        dim = "Comment",       -- Other lines
    },
})

How It Works

  1. Dual-timer architecture: Network timer polls Spotify every 5s, render timer updates UI every 100ms
  2. Time interpolation: Smooth scrolling without hammering the API
  3. LRCLIB integration: Fetches synchronized lyrics by artist/track name
  4. OAuth2 flow: Built-in authentication with automatic token refresh

Troubleshooting

"Invalid redirect URI"

Make sure you added http://127.0.0.1:8888/callback (not localhost) in your Spotify app settings.

"No lyrics found"

Not all songs have synchronized lyrics on LRCLIB. The plugin will display a message for instrumental tracks.

License

MIT

Credits

  • Lyrics provided by LRCLIB
  • Inspired by the love for music and code

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages