A simple type-safe programming language.
Examples here.
Important
WIP; No 0.1.0 release yet, check back later!
Install using Cargo (requires nightly rust):
cargo install --git https://github.com/drewxs/coal.git
Build from source (also requires nightly rust):
git clone https://github.com/drewxs/coal.git
cd coal
make
# Start the REPL
coal
# Create a new project
coal new PROJECT_NAME
# Run the current project or a given program
coal run [PROGRAM_PATH]
# Evaluate a string
coal eval STRING
# Format all files in the current project or from a given path
coal fmt [PATH]
Run coal --help
for more information.
Example configuration using lazy.nvim: init.lua
Add anywhere that's loaded by init.lua
:
vim.filetype.add({
extension = {
coal = "coal",
},
})
Add to your treesitter config:
vim.treesitter.language.register("rust", "coal")
Using Rust grammar (for now) as it's the closest thing to Coal's syntax.
Using no plugins:
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = "*.coal",
callback = function()
local view = vim.fn.winsaveview()
vim.cmd("%!coal fmt")
vim.fn.winrestview(view)
end,
})
This is basic and won't handle things like preserving cursor positions when formatting extra newlines. For a more robust solution, you can use a formatter plugin like conform.nvim.
Using conform.nvim:
Add the following to your conform config:
{
formatters = {
coal_fmt = {
command = "coal",
args = { "fmt" },
stdin = true,
},
},
formatters_by_ft = {
coal = { "coal_fmt" },
},
}
Install the Coal
language extension locally (requires Node.js):
make vsc
A marketplace release will be available with v0.1.0.
Prerequisites:
Run make help
to print a list of available commands: