{"id":32772510,"url":"https://github.com/markgandolfo/lightswitch.nvim","last_synced_at":"2026-01-21T13:30:58.897Z","repository":{"id":297349435,"uuid":"996493924","full_name":"markgandolfo/lightswitch.nvim","owner":"markgandolfo","description":"Toggle plugins/commands on or off using a simple interface.e","archived":false,"fork":false,"pushed_at":"2025-06-05T03:21:54.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-05T06:12:25.129Z","etag":null,"topics":["nvim-plugin"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/markgandolfo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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-06-05T03:10:06.000Z","updated_at":"2025-06-05T03:25:16.000Z","dependencies_parsed_at":"2025-06-08T07:03:09.501Z","dependency_job_id":null,"html_url":"https://github.com/markgandolfo/lightswitch.nvim","commit_stats":null,"previous_names":["markgandolfo/lightswitch.nvim"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/markgandolfo/lightswitch.nvim","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markgandolfo%2Flightswitch.nvim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markgandolfo%2Flightswitch.nvim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markgandolfo%2Flightswitch.nvim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markgandolfo%2Flightswitch.nvim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markgandolfo","download_url":"https://codeload.github.com/markgandolfo/lightswitch.nvim/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markgandolfo%2Flightswitch.nvim/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28633760,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T04:47:28.174Z","status":"ssl_error","status_checked_at":"2026-01-21T04:47:22.943Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["nvim-plugin"],"created_at":"2025-11-04T09:01:53.974Z","updated_at":"2026-01-21T13:30:58.884Z","avatar_url":"https://github.com/markgandolfo.png","language":"Lua","readme":"# LightSwitch.nvim\n\nA simple and elegant Neovim plugin that provides a UI for toggling various options using the `nui.nvim` library.\n\n[lightswitch.nvim.webm](https://github.com/user-attachments/assets/5a560a88-cdb4-4912-8d8d-981923af98ec)\n\n## Features\n\n- Toggle various Neovim commands/options through a sleek slider UI interface\n- Navigate through options and toggle them on/off with intuitive slider controls\n- Search functionality to filter visible options\n- Fully customisable with your own toggles\n\n## Prerequisites\n\n- Neovim \u003e= 0.7.0\n- [nui.nvim](https://github.com/MunifTanjim/nui.nvim)\n\n## Installation\n\n### Using [packer.nvim](https://github.com/wbthomason/packer.nvim)\n\n```lua\nuse {\n  'markgandolfo/lightswitch.nvim',\n  requires = { 'MunifTanjim/nui.nvim' }\n}\n```\n\n### Using [lazy.nvim](https://github.com/folke/lazy.nvim)\n\n```lua\n{\n  'markgandolfo/lightswitch.nvim',\n  dependencies = { 'MunifTanjim/nui.nvim' },\n  config = function()\n    require('lightswitch').setup()\n  end\n}\n```\n\n## Usage\n\n1. Set up the plugin with your desired toggles:\n\n```lua\nrequire('lightswitch').setup({\n  toggles = {\n    {\n      name = \"Copilot\",\n      enable_cmd = \"Copilot enable\",\n      disable_cmd = \"Copilot disable\",\n      state = true -- Initially enabled\n    },\n    {\n      name = \"LSP\",\n      enable_cmd = \":LspStart\u003cCR\u003e\",\n      disable_cmd = \":LspStop\u003cCR\u003e\",\n      state = false -- Initially disabled\n    },\n    {\n      name = \"Treesitter\",\n      enable_cmd = \":TSEnable\u003cCR\u003e\",\n      disable_cmd = \":TSDisable\u003cCR\u003e\",\n      state = true -- Initially enabled\n    },\n    {\n      name = \"Diagnostics\",\n      enable_cmd = \"lua vim.diagnostic.enable()\",\n      disable_cmd = \"lua vim.diagnostic.disable()\",\n      state = true\n    },\n    {\n      name = \"Formatting\",\n      enable_cmd = \"lua vim.g.format_on_save = true\",\n      disable_cmd = \"lua vim.g.format_on_save = false\",\n      state = false\n    }\n  }\n})\n```\n\n\n2. Open the LightSwitch UI:\n\n```\n:LightSwitchShow\n```\n\n## UI Controls\n\n- `j`/`k`: Navigate up and down through toggle options\n- `\u003cSpace\u003e` or `\u003cEnter\u003e`: Toggle the currently selected option\n- `/`: Start searching to filter options (updates in real-time as you type)\n- `\u003cEsc\u003e`: Clear search and return to main window (when in search mode) or close UI\n- `q`: Close the LightSwitch UI\n\n## UI Features\n\n- Slider representation for toggle state:\n  - ON: `[───⦿ ]` (filled circle on right)\n  - OFF: `[⦾───]` (empty circle on left)\n- Search filtering for quick access to specific toggles\n\n## Customisation\n\n### Toggle Configuration\n\nYou can add your own toggles using the setup function:\n\n```lua\nrequire('lightswitch').setup({\n  toggles = {\n    {\n      name = \"My Custom Option\",\n      enable_cmd = \":MyEnableCommand\u003cCR\u003e\",\n      disable_cmd = \":MyDisableCommand\u003cCR\u003e\",\n      state = false\n    },\n    -- Add more toggles here\n  }\n})\n```\n\n### Color Customisation\n\nYou can customize the colors used for toggle states:\n\n```lua\nrequire('lightswitch').setup({\n  colors = {\n    off = \"#4a4a4a\",  -- Dark grey for OFF state (default)\n    on = \"#00ff00\"    -- Green for ON state (optional, defaults to normal text color)\n  },\n  toggles = {\n    -- your toggles here\n  }\n})\n```\n\nYou can also add toggles programmatically:\n\n```lua\nlocal lightswitch = require('lightswitch')\nlightswitch.add_toggle(\"Diagnostics\", \"lua vim.diagnostic.enable()\", \"lua vim.diagnostic.disable()\", true)\n```\n\n### Command Formats\n\nLightSwitch supports multiple command formats for enable/disable commands:\n\n1. **Regular Ex commands** (default):\n   ```lua\n   enable_cmd = \"Copilot enable\"\n   disable_cmd = \"Copilot disable\"\n   ```\n\n2. **Commands with key notation** (including `\u003cCR\u003e`):\n   ```lua\n   enable_cmd = \":HighlightColors on\u003cCR\u003e\"\n   disable_cmd = \":HighlightColors off\u003cCR\u003e\"\n   ```\n\n3. **Lua expressions**:\n   ```lua\n   enable_cmd = \"require('nvim-highlight-colors').turnOn()\"\n   disable_cmd = \"require('nvim-highlight-colors').turnOff()\"\n   ```\n\n## Advanced Usage\n\n### Adding Toggles for Popular Plugins\n\n```lua\n-- For Telescope\nlightswitch.add_toggle(\"Telescope Preview\", \"lua vim.g.telescope_preview = true\", \"lua vim.g.telescope_preview = false\", true)\n\n-- For NvimTree\nlightswitch.add_toggle(\"NvimTree Auto\", \"lua require('nvim-tree.view').View.float.enable()\", \"lua require('nvim-tree.view').View.float.disable()\", false)\n\n-- For Git Signs\nlightswitch.add_toggle(\"Git Signs\", \"Gitsigns toggle_signs\", \"Gitsigns toggle_signs\", true)\n```\n\n## Contributing\n\nContributions are welcome! Feel free to open issues or submit pull requests.\n\n## License\n\nMIT\n","funding_links":[],"categories":["Utility","UI"],"sub_categories":["OS-specific"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkgandolfo%2Flightswitch.nvim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkgandolfo%2Flightswitch.nvim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkgandolfo%2Flightswitch.nvim/lists"}