Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 1.17 KB

File metadata and controls

30 lines (25 loc) · 1.17 KB

vibe.lua - Neovim Spotify Lyrics Plugin

Build & Test

  • No build step required (pure Lua plugin)
  • Test manually: nvim --cmd "set rtp+=." then :lua require('vibe').setup({})
  • Lint: luacheck lua/ (if installed)

Architecture

Neovim plugin displaying synchronized Spotify lyrics in a floating window.

lua/vibe/
  init.lua      # Public API: setup(), start(), stop(), toggle()
  config.lua    # Configuration defaults and validation
  auth.lua      # OAuth2 flow with auto token refresh
  spotify.lua   # Spotify Web API (currently-playing endpoint)
  lyrics.lua    # LRCLIB API + LRC timestamp parsing
  ui.lua        # Floating window rendering
  poller.lua    # Dual-timer loop (5s network, 100ms render)

Dependencies: plenary.nvim, curl, Spotify API credentials

Code Style

  • Lua 5.1/LuaJIT syntax for Neovim compatibility
  • APIs: vim.api.*, vim.uv.* for timers, vim.fn.* for Vimscript
  • Async HTTP via require('plenary.curl')
  • Module pattern: local M = {} with return M
  • Error handling: validate buffer/window with nvim_buf_is_valid(), handle HTTP 4xx gracefully
  • Time: milliseconds internally, convert vim.uv.hrtime() (nanoseconds) as needed