A lightweight hosts management tool built with Lazarus (Free Pascal), providing a graphical interface for quickly switching between different hosts configurations.
中文版 | A native desktop application designed for users who pursue extreme performance and simplicity, serving as an alternative to the local hosts management functionality of SwitchHosts.
SwitchHosts uses approximately 308MB of RAM (Working Set).
LazSwitchHosts uses less than 7MB of memory — extremely lightweight.
The built-in Find & Replace dialog supports regular expressions and case-insensitive matching.
- Tiny footprint: Under 6MB compiled, under 2MB with UPX compression — a single standalone executable with zero dependencies
- Minimal memory: Less than 7MB at runtime, saving 98% compared to SwitchHosts (~308MB)
- Instant startup: Native compilation, no framework loading overhead
- Native experience: LCL native UI, fast and responsive
- Plugin-based editor: Reusable editor engine architecture supporting Ctrl+D multi-select editing, syntax highlighting, and find & replace
- Graphical interface: Cross-platform desktop app based on LCL
- Quick switching: One-click switching between different hosts configurations
- Configuration management: Add, edit, delete, and drag-to-reorder hosts entries
- Syntax highlighting: Color-coded IP addresses, hostnames, and comments
- Multi-select editing: Ctrl+D to select matching words one by one for synchronized replacement
- Find & replace: Supports regular expressions and case-insensitive matching
- Line operations: Ctrl+C/X/V copies/cuts/pastes entire lines when no selection is active
- Keyboard shortcuts: Ctrl+S to save, Ctrl+/ to toggle comment, Ctrl+Z/Y for undo/redo
- System tray: Minimize to tray, double-click to restore
- Supported platforms: Windows, Linux, macOS
- Development environment: Lazarus IDE
- Dependencies: BGRABitmapPack (install via Lazarus Online Package Manager)
LAZ_SWITCHHOSTSDIR: Custom configuration directory (default:~/.SwitchHosts)LAZ_HOSTSFILENAME: Custom hosts file path (default: system hosts file path)
LazSwitchHosts/
├── lazswitchhosts.lpr # Program entry point
├── unitmain.pas # Main window UI and assembly
├── uniteditorengine.pas # Editor engine core
├── uniteditorplugin.pas # Editor plugin base class
├── uniteditorkeymap.pas # Declarative keymap registry
├── uniteditorsyntax.pas # Syntax provider (hosts, etc.)
├── unitmultiselect.pas # Multi-select plugin (Ctrl+D)
├── unithostshighlighter.pas # Hosts syntax highlighter
├── unitsearchdialog.pas # Find & replace dialog
├── unitconfigmanager.pas # Configuration manager (JSON)
├── unitutils.pas # Platform utility functions
└── unittoggleswitch.pas # Toggle switch control
This project follows a minimalist design philosophy and is not a full replacement for SwitchHosts. The following features are not supported:
- Remote hosts configuration (URL-based)
- Sub-folder configuration management
- Proxy settings
- Configuration change history backup
- Icons: https://www.iconfont.cn/collections/detail?cid=19977
- BGRABitmapPack - MPL 2.0 / LGPL v3
- SynEdit - MIT
- LCL - LGPL v2.1
This project is licensed under the Apache License 2.0 — see the LICENSE file for details.



