Neovim
With one Lua module, Neovim 0.10+ runs vibelang --lsp --stdio in its built-in LSP client. .vibe and .vibex files get vibe/vibex filetypes, TypeScript/TSX highlighting, and the project's node_modules/.bin/vibelang (falling back to vibelang on PATH).
1. Check Neovim
Run nvim --version; the first line must be NVIM v0.10.0 or later.
2. Add the module
Save as ~/.config/nvim/lua/vibelang.lua:
-- VibeLang for Neovim 0.10 or later, with the built-in LSP client.
--
-- Copy this file to ~/.config/nvim/lua/vibelang.lua and add
--
-- require("vibelang").setup()
--
-- to init.lua. .vibe files then get the vibe filetype, TypeScript
-- highlighting, and `vibelang --lsp --stdio` as their language server: the
-- project's node_modules/.bin/vibelang, else vibelang on PATH.
--
-- setup({ typescript = true }) also runs vibelang for .ts and .js files. Turn off
-- your other TypeScript server (ts_ls, vtsls) in those projects first, or
-- both report every .ts file.
local M = {}
local typescript_filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact" }
-- esc_command returns the vibelang that serves a project rooted at root.
local function esc_command(root)
if root then
local local_esc = vim.fs.joinpath(root, "node_modules", ".bin", "vibelang")
if vim.fn.executable(local_esc) == 1 then
return local_esc
end
end
return "vibelang"
end
function M.setup(opts)
opts = opts or {}
vim.filetype.add({ extension = { vibe = "vibe", vibex = "vibex" } })
vim.treesitter.language.register("typescript", "vibe")
vim.treesitter.language.register("tsx", "vibex")
local filetypes = { "vibe", "vibex" }
if opts.typescript then
vim.list_extend(filetypes, typescript_filetypes)
end
vim.api.nvim_create_autocmd("FileType", {
group = vim.api.nvim_create_augroup("vibelang", { clear = true }),
pattern = filetypes,
callback = function(args)
local ft = vim.bo[args.buf].filetype
local lang = ft == "vibex" and "tsx" or "typescript"
if (ft == "vibe" or ft == "vibex") and not pcall(vim.treesitter.start, args.buf, lang) then
-- No tree-sitter parser for TypeScript: use Vim's TypeScript syntax.
vim.bo[args.buf].syntax = ft == "vibex" and "typescriptreact" or "typescript"
end
local root = vim.fs.root(args.buf, { "vibe.config.json", "tsconfig.json", "jsconfig.json", "package.json", ".git" })
vim.lsp.start({
name = "vibelang",
cmd = { opts.cmd or esc_command(root), "--lsp", "--stdio" },
root_dir = root,
}, { bufnr = args.buf })
end,
})
end
return MAdd to ~/.config/nvim/init.lua:
require("vibelang").setup()Pass setup({ typescript = true }) to also attach to .ts/.js files (disable ts_ls/vtsls for those projects first to avoid duplicate diagnostics), or setup({ cmd = "/path/to/vibelang" }) to override the compiler path.
3. Check the filetype and the server
nvim --headless "+lua io.write((vim.filetype.match({ filename = 'main.vibe' })))" +qaExpected output: vibe. Next, from the project directory, open a .vibe file (e.g., src/main.vibe):
nvim --headless src/main.vibe "+lua vim.wait(5000, function() return #vim.lsp.get_clients({ name = 'vibelang' }) > 0 end)" "+lua io.write(#vim.lsp.get_clients({ name = 'vibelang' }) .. ' vibelang client')" +qaExpected output: 1 vibelang client. A spawn error means Neovim could not find vibelang; install project dependencies.
Tree-sitter grammars: editors/nvim/vibelang.lua also registers the VibeLang tree-sitter grammars. With nvim-treesitter on master, run :TSInstall vibe vibex for VibeLang forms inside JSX containers (vibex queries inherit TSX and VibeLang highlights). JSX tag names—including member tags like <catch.Box/>—follow JSX rules in .vibex while keywords remain reserved in ordinary code.