# 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 ```lua { "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 ```lua use { "your-org/lux", config = function() require("lux").setup() end, ft = "lux", } ``` ### Manual Installation Copy the contents of this directory to your Neovim config: ```bash # 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: ```lua -- 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 ``): | Mapping | Action | |---------|--------| | `r` | Run current file | | `f` | Format current file | | `t` | Run tests | LSP mappings (when LSP is active): | Mapping | Action | |---------|--------| | `gd` | Go to definition | | `K` | Hover information | | `gr` | Find references | | `rn` | Rename symbol | | `ca` | Code actions | | `[d` / `]d` | Previous/next diagnostic | ## Configuration ```lua 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, }, }) ```