{"id":25407222,"url":"https://github.com/jinzhongjia/zig-lamp","last_synced_at":"2025-09-10T23:47:47.805Z","repository":{"id":277089486,"uuid":"928121061","full_name":"jinzhongjia/zig-lamp","owner":"jinzhongjia","description":"Improve the zig experience in neovim","archived":false,"fork":false,"pushed_at":"2025-07-09T17:01:41.000Z","size":141,"stargazers_count":21,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-10T01:55:24.711Z","etag":null,"topics":["neovim","neovim-lua-plugin","neovim-plugin","zig","zig-library","zig-package","ziglang"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jinzhongjia.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-06T05:05:07.000Z","updated_at":"2025-07-09T17:01:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"65c4eb27-c822-46cd-81ea-1217c5dfa64e","html_url":"https://github.com/jinzhongjia/zig-lamp","commit_stats":null,"previous_names":["jinzhongjia/zig-lamp"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/jinzhongjia/zig-lamp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jinzhongjia%2Fzig-lamp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jinzhongjia%2Fzig-lamp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jinzhongjia%2Fzig-lamp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jinzhongjia%2Fzig-lamp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jinzhongjia","download_url":"https://codeload.github.com/jinzhongjia/zig-lamp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jinzhongjia%2Fzig-lamp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274549835,"owners_count":25306360,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-10T02:00:12.551Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["neovim","neovim-lua-plugin","neovim-plugin","zig","zig-library","zig-package","ziglang"],"created_at":"2025-02-16T06:26:47.169Z","updated_at":"2025-09-10T23:47:47.799Z","avatar_url":"https://github.com/jinzhongjia.png","language":"Lua","funding_links":[],"categories":["Programming Languages Support","Lua","Fundamentals"],"sub_categories":["(requires Neovim 0.5)","Text Editors"],"readme":"# zig-lamp\n\nA comprehensive Neovim plugin and Zig library for enhanced Zig development experience.\n\n**zig-lamp** provides seamless ZLS (Zig Language Server) management for Neovim and powerful build.zig.zon parsing capabilities for Zig projects.\n\n## Features\n\n### For Neovim Users\n- **Automatic ZLS Management**: Download, install, and manage ZLS versions automatically\n- **Smart Version Matching**: Automatically matches ZLS versions with your Zig installation\n- **Package Manager UI**: Visual interface for managing Zig dependencies in build.zig.zon\n- **Build Integration**: Execute Zig build commands directly from Neovim\n- **Project Info Panel**: Display comprehensive project and toolchain information\n- **Zero Configuration**: Works out of the box with sensible defaults\n\n### For Zig Developers\n- **ZON Parser**: Parse build.zig.zon files into JSON format\n- **Hash Verification**: SHA256 checksum validation for downloaded packages\n- **ZON Formatter**: Format build.zig.zon files with proper structure\n- **FFI Interface**: C-compatible API for integration with other tools\n\n## Requirements\n\n### Neovim Plugin\n- **Neovim**: 0.10 or later\n- **Zig**: 0.14.0 or later\n- **Dependencies**: \n  - [plenary.nvim](https://github.com/nvim-lua/plenary.nvim)\n  - [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig)\n\n### System Tools\n- **Windows**: `curl` and `unzip`\n- **Unix-like systems**: `curl` and `tar`\n\n## Installation\n\n### Using lazy.nvim\n\n```lua\n{\n    \"jinzhongjia/zig-lamp\",\n    event = \"VeryLazy\",\n    build = \":ZigLamp build sync\",\n    dependencies = {\n        \"neovim/nvim-lspconfig\",\n        \"nvim-lua/plenary.nvim\",\n    },\n    init = function()\n        -- Configuration options (all optional)\n        \n        -- Timeout in milliseconds for automatic ZLS installation\n        -- Set to nil to disable auto-install\n        vim.g.zig_lamp_zls_auto_install = nil\n        \n        -- Fallback to system ZLS if local version not found\n        -- Set to any non-negative value to enable\n        vim.g.zig_lamp_fall_back_sys_zls = nil\n        \n        -- LSP configuration options passed to lspconfig\n        vim.g.zig_lamp_zls_lsp_opt = {}\n        \n        -- UI customization\n        vim.g.zig_lamp_pkg_help_fg = \"#CF5C00\"\n        vim.g.zig_lamp_zig_fetch_timeout = 5000\n    end,\n}\n```\n\n\u003e **Important**: Do not configure ZLS through lspconfig directly. zig-lamp handles ZLS setup automatically.\n\n### Version Compatibility\n\n| zig-lamp | Zig Version | Neovim |\n|----------|-------------|---------|\n| 0.0.1    | 0.13.0 and earlier | 0.10+ |\n| latest   | 0.14.0+     | 0.10+ |\n\n## Commands\n\n### ZLS Management\n- `:ZigLamp zls install` - Install ZLS matching current Zig version\n- `:ZigLamp zls uninstall` - Remove installed ZLS version\n\n### Project Management\n- `:ZigLamp info` - Show project and toolchain information\n- `:ZigLamp pkg` - Open package manager interface\n- `:ZigLamp build [sync|async] [timeout]` - Build the zig-lamp library\n\n### Build Command Options\n- `async` (default) - Non-blocking build, returns immediately\n- `sync [timeout]` - Blocking build with optional timeout in milliseconds\n- `sync 20000` - Sync build with 20-second timeout\n\n## Package Manager Interface\n\nThe package manager provides an intuitive interface for managing Zig dependencies:\n\n### Key Bindings\n- `q` - Quit the package manager\n- `i` - Add or edit dependency\n- `o` - Toggle between URL and local path dependencies\n- `\u003cleader\u003er` - Reload from build.zig.zon file\n- `d` - Delete selected dependency or path\n- `\u003cleader\u003es` - Save changes to build.zig.zon file\n\n### Features\n- Visual dependency management\n- Automatic hash generation for URL dependencies\n- Support for both URL and local path dependencies\n- Real-time file synchronization\n- Syntax highlighting and help text\n\n## Using zig-lamp as a Zig Library\n\n### Installation\n\n1. **Add to build.zig.zon**:\n```bash\n# Recommended: Use specific commit instead of branch\nzig fetch --save https://github.com/jinzhongjia/zig-lamp/archive/main.tar.gz\n\n# Alternative: Git URL (requires git)\nzig fetch --save git+https://github.com/jinzhongjia/zig-lamp\n```\n\n2. **Configure build.zig**:\n```zig\nconst std = @import(\"std\");\n\npub fn build(b: *std.Build) void {\n    const target = b.standardTargetOptions(.{});\n    const optimize = b.standardOptimizeOption(.{});\n\n    // Add zig-lamp dependency\n    const zig_lamp = b.dependency(\"zig-lamp\", .{\n        .target = target,\n        .optimize = optimize,\n    });\n\n    const exe = b.addExecutable(.{\n        .name = \"your-app\",\n        .root_source_file = b.path(\"src/main.zig\"),\n        .target = target,\n        .optimize = optimize,\n    });\n\n    // Import zig-lamp module\n    exe.root_module.addImport(\"zigLamp\", zig_lamp.module(\"zigLamp\"));\n    \n    b.installArtifact(exe);\n}\n```\n\n### API Usage\n\n```zig\nconst std = @import(\"std\");\nconst zigLamp = @import(\"zigLamp\");\n\npub fn main() !void {\n    var gpa = std.heap.GeneralPurposeAllocator(.{}){};\n    defer _ = gpa.deinit();\n    const allocator = gpa.allocator();\n\n    // Parse build.zig.zon to JSON\n    const file = try std.fs.cwd().openFile(\"build.zig.zon\", .{});\n    defer file.close();\n    \n    var output = std.ArrayList(u8).init(allocator);\n    defer output.deinit();\n    \n    try zigLamp.zig2json(\n        allocator,\n        file.reader().any(),\n        output.writer(),\n        void{},\n        .{ .file_name = \"build.zig.zon\" }\n    );\n    \n    std.log.info(\"JSON output: {s}\", .{output.items});\n\n    // Verify file hash\n    const digest = try zigLamp.sha256Digest(file);\n    std.log.info(\"SHA256: {}\", .{std.fmt.fmtSliceHexLower(\u0026digest)});\n\n    // Format ZON file\n    const source = \"@import(\\\"std\\\")\";\n    const formatted = try zigLamp.fmtZon(source, allocator);\n    defer allocator.free(formatted);\n    std.log.info(\"Formatted: {s}\", .{formatted});\n}\n```\n\n## Architecture\n\n### Neovim Plugin Structure\n```\nlua/zig-lamp/\n├── core/           # Core functionality\n│   ├── core_cmd.lua    # Command system\n│   ├── core_config.lua # Configuration management\n│   ├── core_ffi.lua    # FFI interface to Zig library\n│   └── core_util.lua   # Utility functions\n├── info.lua        # Information display\n├── pkg/            # Package manager\n├── zig/            # Zig integration\n└── zls/            # ZLS management\n```\n\n### Zig Library Structure\n```\nsrc/\n├── zig-lamp.zig    # Main library interface\n├── zon2json.zig    # ZON to JSON parser\n└── fmtzon.zig      # ZON formatter\n```\n\n## Troubleshooting\n\n### Common Issues\n\n**ZLS Not Found**: Run `:ZigLamp zls install` to download the appropriate ZLS version.\n\n**Build Failures**: Ensure you have the required system tools (curl, unzip/tar) installed.\n\n**Library Crashes**: If the Zig library causes Neovim crashes, please file an issue with:\n- Neovim version\n- Zig version\n- Error reproduction steps\n\n**Permission Errors**: Make sure Neovim has write access to its data directory.\n\n## Development\n\n### Building from Source\n```bash\n# Clone the repository\ngit clone https://github.com/jinzhongjia/zig-lamp.git\ncd zig-lamp\n\n# Build the library\nzig build -Doptimize=ReleaseFast\n\n# Run tests\nzig build test\n```\n\n### Contributing\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests if applicable\n5. Submit a pull request\n\n## Screenshots\n\n### Package Manager Interface\n![Package Manager](https://github.com/user-attachments/assets/01324e66-5912-4532-beeb-ac82c3ca84d0)\n\n### Project Information Panel\n![Info Panel](https://github.com/user-attachments/assets/c5c988b5-d0b4-453e-8967-2b00b2bd3a11)\n\n## License\n\nThis project is open source. See the repository for license details.\n\n## Support\n\n- **Issues**: [GitHub Issues](https://github.com/jinzhongjia/zig-lamp/issues)\n- **Discussions**: [GitHub Discussions](https://github.com/jinzhongjia/zig-lamp/discussions)\n\n---\n\n**Note**: Since this plugin integrates with external libraries via FFI, stability depends on the Zig compilation target and C API compatibility. Please report any crashes or unexpected behavior.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjinzhongjia%2Fzig-lamp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjinzhongjia%2Fzig-lamp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjinzhongjia%2Fzig-lamp/lists"}