A Neovim plugin for ChucK offering granular control and a WebChucK-like layout built with NUI.
An example session recorded with asciinema. For some reason colors were not recorded. The UI looks like this
- Set icon for
.ck
filetype (until nerd-font native support)
To use chuck-nvim
, you need to have:
- Neovim 0.10 or up.
- The
tail
command in your path. - ChucK installed on your system.
To download and install ChucK, visit the official ChucK release page. For more information, including documentation, examples, research publications, and community resources, visit the ChucK homepage.
brew install chuck
{
"gacallea/chuck-nvim",
version = "*",
dependencies = {
{ "MunifTanjim/nui.nvim" },
{ -- until https://github.com/gacallea/chuck-nvim/issues/3
"nvim-tree/nvim-web-devicons",
opts = {
override_by_extension = {
["ck"] = {
icon = "",
color = "#80ff00",
name = "ChucK",
},
},
},
},
},
ft = { "chuck" },
opts = {}, -- see configuration
cmd = {
"ChuckLoop",
"ChuckStatus",
"ChuckTime",
"ChuckAddShred",
"ChuckRemoveShreds",
"ChuckReplaceShred",
"ChuckClearShreds",
"ChuckClearVM",
"ChuckExit",
},
keys = {}, -- see key mappings
}
chuck-nvim
options to configure this plugin, and a subset of ChucK VM's
command-line
options.
-- default values:
opts = {
autorun = false,
layout = "webchuck", -- or "chuck_on_top"
chuck_vm = {
log_level = 1,
srate = 44100,
bufsize = 512,
dac = 0,
adc = 0,
channels = 2,
input = 2,
output = 2,
remote = "127.0.0.1",
port = 8888,
},
},
chuck-nvim
provides the following functions to interact with the ChucK VM.
Starts ChucK in loop mode with chuck --loop
using the configuration values.
Tip
You can enable autorun
to launch ChucK and the UI automatically.
Prints current time
and active shreds
status in the ChucK VM.
Prints the ChucK VM's full time
information in the ChucK VM.
Adds the current saved buffer to the ChucK VM, as an active shred.
Note
You must save file changes beforehand.
Prompts the user for shred(s) number(s), then removes them from ChucK.
Tip
To remove more than one shred, enter the numbers separated by spaces.
Prompts the user for a shred number, then replaces it with the current buffer.
Removes all active shreds.
Removes all active shreds and resets the type system.
Cleanly exits the VM, cleans out logs, and quits ChucK.
chuck-nvim
doesn't set any key mappings by default. Below, an example
configuration for LazyVim.
Warning
Make sure these don't conflict with existing mappings.
Tip
You could map the commands to function keys to speed up operations.
return {
{
"folke/which-key.nvim",
opts = {
defaults = {
["<leader>C"] = { name = "+chuck" },
},
},
},
{
"gacallea/chuck-nvim",
version = "*",
dependencies = {
{ "MunifTanjim/nui.nvim" },
{ -- until https://github.com/gacallea/chuck-nvim/issues/3
"nvim-tree/nvim-web-devicons",
opts = {
override_by_extension = {
["ck"] = {
icon = "",
color = "#80ff00",
name = "ChucK",
},
},
},
},
},
ft = { "chuck" },
opts = {},
cmd = {
"ChuckLoop",
"ChuckStatus",
"ChuckTime",
"ChuckAddShred",
"ChuckRemoveShreds",
"ChuckReplaceShred",
"ChuckClearShreds",
"ChuckClearVM",
"ChuckExit",
},
keys = {
{ mode = "n", "<leader>Cl", "<cmd>ChuckLoop<cr>", desc = "Chuck Loop" },
{ mode = "n", "<leader>Cs", "<cmd>ChuckStatus<cr>", desc = "Chuck Status" },
{ mode = "n", "<leader>Ct", "<cmd>ChuckTime<cr>", desc = "Chuck Time" },
{ mode = "n", "<leader>Ca", "<cmd>ChuckAddShred<cr>", desc = "Add Shred" },
{ mode = "n", "<leader>Cd", "<cmd>ChuckRemoveShreds<cr>", desc = "Remove Shred(s)" },
{ mode = "n", "<leader>Cr", "<cmd>ChuckReplaceShred<cr>", desc = "Replace Shred" },
{ mode = "n", "<leader>Cc", "<cmd>ChuckClearShreds<cr>", desc = "Clear Shreds" },
{ mode = "n", "<leader>Cv", "<cmd>ChuckClearVM<cr>", desc = "Clear VM" },
{ mode = "n", "<leader>Ce", "<cmd>ChuckExit<cr>", desc = "Exit ChucK" },
},
},
}
The code of this repository is licensed under the GPLv2 for compatibility with ChucK licensing.