Zsh Completion Server (zshcs) is a Language Server Protocol (LSP)
implementation for Zsh shell scripts.
It aims to provide high-performance and accurate completion features by
leveraging Zsh's own completion system.
- Accurate Completion: Directly utilizes Zsh's internal completion
mechanisms (
compinit,compadd, etc.) to achieve the same completion accuracy as Zsh itself. - LSP Compliant: Built using the
tower-lspcrate, making it compatible with various LSP-supported editors such as Neovim. - High Performance: Implemented in Rust for efficient document management and Zsh process control.
You can install zshcs directly from the GitHub repository:
cargo install --git https://github.com/yuys13/zshcs.gitAlternatively, you can clone the repository and build it manually:
git clone https://github.com/yuys13/zshcs.git
cd zshcs
cargo build --release
# The binary will be located at target/release/zshcsFor Neovim 0.11 or later, you can use the built-in vim.lsp.enable function.
- Create a configuration file at
~/.config/nvim/lsp/zshcs.lua:
return {
cmd = { "zshcs" },
filetypes = { "zsh" },
root_markers = { ".git" },
}- Enable it in your
init.lua:
vim.lsp.enable("zshcs")zshcs consists of two main components:
- LSP Server (Rust): Handles communication with the editor, document synchronization, and Zsh process management.
- Completion Engine (Zsh): An embedded
capture.zshscript uses thezptymodule to simulate an interactive Zsh session and hooks thecompaddbuilt-in to capture completion candidates.
For more details on the architecture, please refer to docs/ARCHITECTURE.md.
- Rust (latest stable)
- Zsh
# Build
cargo build
# Run tests
cargo test
# Check formatting
cargo fmt --check
# Run linter
cargo clippy --no-deps --all-targets -- -D warningsThis project includes code derived from the following repositories, and we extend our gratitude to their original authors and contributors for their great work.