Skip to content

feat(neovim): add vim-tidal plugin for TidalCycles live coding#365

Open
etrobert-bot wants to merge 5 commits into
mainfrom
tidal-nvim-plugin
Open

feat(neovim): add vim-tidal plugin for TidalCycles live coding#365
etrobert-bot wants to merge 5 commits into
mainfrom
tidal-nvim-plugin

Conversation

@etrobert-bot

Copy link
Copy Markdown
Collaborator

What

Adds a tidal plugin module to neovim-wrapped that packages vim-tidal (not in nixpkgs) and wires it into the plugin set.

  • Pins vim-tidal to its latest commit (e440fe5) via buildVimPlugin + fetchFromGitHub — the v1.x tags are old; it's a stable vimscript plugin.
  • Sets g:tidal_target = "tmux" so pattern lines are pasted into a tmux pane running GHCi+Tidal (pairs with the existing vim-tmux-navigator workflow).

Why

Companion to a TidalCycles flake in the electronic-music project. The split is deliberate:

  • Pattern language (GHCi + tidal) and audio engine (SuperDirt) live in that project's nix develop.
  • The editor integration lives here, matching the per-plugin module pattern.

In tmux mode vim-tidal only ships lines to a running GHCi — it does not boot one — so the workflow is: superdirt in one pane, tidal (GHCi booted with Tidal) in another, send lines from a .tidal buffer.

Verification

  • nix build .#neovim-wrapped succeeds; vim-tidal builds.
  • Headless nvim: g:tidal_target == "tmux", :TidalSend exists, .tidal files get filetype tidal.

🤖 Generated with Claude Code

Packages vim-tidal (not in nixpkgs) from GitHub and wires it into the
neovim-wrapped plugin set. Sets g:tidal_target = "tmux" so pattern lines
are pasted into a tmux pane running GHCi+Tidal.

The pattern language and audio engine come from a project's nix devShell
(see the electronic-music TidalCycles flake), not from the editor; this
plugin only ships lines to a running GHCi.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@etrobert-bot etrobert-bot left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed thoroughly — checked out the branch, ran nix build .#neovim-wrapped, exercised the built nvim headlessly, and verified every claim against the vim-tidal upstream source. Everything holds up:

  • vim-tidal really isn't in nixpkgs (nix eval nixpkgs#vimPlugins finds no tidal plugin).
  • e440fe5 is the current HEAD of the default branch, dated 2023-06-02 (matches the version).
  • The v1.x tags are indeed old — latest tag 1.4.8 is from 2020-04-01, ~3 years older than the pinned commit.
  • g:tidal_target = "tmux" is a genuine behavior change, not a no-op: on nvim the upstream default is "terminal" (if has('nvim')…), so this is necessary for the tmux workflow.
  • Build succeeds; headless nvim confirms g:tidal_target == "tmux", :TidalSend exists, and .tidal files get filetype tidal. <localleader>s maps to TidalLineSend/TidalRegionSend per ftplugin/tidal.vim.
  • extraPackages = [ tmux ] is required (tmux-mode shells out to tmux); the overlap with vim-tmux-navigator's tmux dep is harmless and per-plugin self-containment matches the repo convention.

No correctness issues and nothing extraneous in the derivation. Just three optional consistency nits below — all non-blocking.

Comment thread pkgs/neovim-wrapped/plugins/tidal/default.nix Outdated
Comment thread pkgs/neovim-wrapped/plugins/tidal/default.nix Outdated
Comment thread pkgs/neovim-wrapped/plugins/tidal/default.nix
etrobert-bot and others added 4 commits June 26, 2026 12:33
…comment

Address review on the tidal plugin:
- Use SRI `hash = "sha256-..."` instead of base32 `sha256` (algorithm-explicit,
  matches the existing cmp third-party fetch).
- Use the modern nixpkgs `<version>-unstable-<date>` version scheme for both
  unpinned GitHub fetches: vim-tidal -> 1.4.8-unstable-2023-06-02, and migrate
  tailwindcss-colorizer-cmp-nvim from the bare-date 2024-01-01 (also wrong: the
  pinned rev is dated 2024-03-23) to 0-unstable-2024-03-23.
- Trim the verbose config comment.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Tidal patterns are Haskell expressions, so reuse the Haskell tooling:
- conform runs ormolu over the 'tidal' filetype (ormolu reformats bare
  pattern lines; stylish-haskell leaves operator spacing untouched, and
  haskell-language-server needs a cabal/stack project so it can't drive
  standalone .tidal buffers).
- register the 'tidal' filetype against the haskell treesitter grammar for
  highlighting, and add the grammar to nvim-treesitter.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Bare ormolu parses the whole file as one Haskell module, which fails on
real Tidal: multi-line patterns put a closing ] or # at column 1 (illegal
mid-declaration in a module, but fine as a standalone GHCi expression), and
one unformattable block makes ormolu bail on the entire file so nothing
formats.

Add a tidal-fmt wrapper that treats the file as what it is -- a sequence of
blank-line-separated GHCi statements -- and formats each block independently:
bare ormolu first (correct for simple/adjacent statements), else wrap the
block as an indented binding so column-1 continuations parse, else pass the
block through untouched (GHCi :t/:set lines, anything unparseable). Idempotent.

Wire it into conform as a custom formatter for the tidal filetype, replacing
the bare ormolu entry.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants