- Add tree-sitter grammar for syntax highlighting - Add Neovim plugin with syntax, LSP integration, and commands - Add code formatter (lux fmt) with check mode - Add CLI commands: fmt, check, test, watch, init - Add project initialization with lux.toml template Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2.6 KiB
2.6 KiB
Lux Neovim Plugin
Neovim support for the Lux programming language.
Features
- Syntax highlighting (vim regex and tree-sitter)
- LSP integration (diagnostics, hover, completions, go-to-definition)
- Commands for running, formatting, and testing
- REPL integration
Installation
Using lazy.nvim
{
"your-org/lux",
config = function()
require("lux").setup({
-- Optional: specify path to lux binary
-- lux_binary = "/path/to/lux",
lsp = {
enabled = true,
autostart = true,
},
format = {
on_save = false,
},
})
end,
ft = "lux",
}
Using packer.nvim
use {
"your-org/lux",
config = function()
require("lux").setup()
end,
ft = "lux",
}
Manual Installation
Copy the contents of this directory to your Neovim config:
# Copy to nvim config
cp -r editors/nvim/* ~/.config/nvim/
# Or symlink
ln -s /path/to/lux/editors/nvim/ftdetect ~/.config/nvim/ftdetect
ln -s /path/to/lux/editors/nvim/ftplugin ~/.config/nvim/ftplugin
ln -s /path/to/lux/editors/nvim/syntax ~/.config/nvim/syntax
ln -s /path/to/lux/editors/nvim/lua/lux ~/.config/nvim/lua/lux
Tree-sitter Support
For tree-sitter based highlighting, install the grammar:
-- In your tree-sitter config
require("nvim-treesitter.configs").setup({
ensure_installed = { "lux" },
highlight = { enable = true },
})
-- Register the parser
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.lux = {
install_info = {
url = "/path/to/lux/editors/tree-sitter-lux",
files = { "src/parser.c" },
},
filetype = "lux",
}
Commands
| Command | Description |
|---|---|
:LuxRun |
Run the current file |
:LuxFormat |
Format the current file |
:LuxTest |
Run tests |
:LuxRepl |
Start the REPL in a terminal |
Key Mappings
Default mappings in Lux files (using <localleader>):
| Mapping | Action |
|---|---|
<localleader>r |
Run current file |
<localleader>f |
Format current file |
<localleader>t |
Run tests |
LSP mappings (when LSP is active):
| Mapping | Action |
|---|---|
gd |
Go to definition |
K |
Hover information |
gr |
Find references |
<leader>rn |
Rename symbol |
<leader>ca |
Code actions |
[d / ]d |
Previous/next diagnostic |
Configuration
require("lux").setup({
-- Path to lux binary (searches PATH if not set)
lux_binary = nil,
lsp = {
-- Enable LSP support
enabled = true,
-- Auto-start LSP when opening .lux files
autostart = true,
},
format = {
-- Format on save
on_save = false,
},
})