Silver Project Introduction
The Silver project is an innovative and customizable powerline-like prompt designed to enhance the command-line interface experience. It's built entirely with Rust, offering improved performance over its predecessor, Bronze. Inspired by the Agnoster theme, Silver brings a fresh and fast solution across various shell environments.
How Silver Works
Unlike traditional shell prompts crafted with shell scripts, Silver is distinctively developed in Rust. When a user initiates the command silver init
, it generates shell code. This code configures the shell's left and right prompts to execute silver lprompt
and silver rprompt
, respectively, which handle the visual appearance of the prompt.
Getting Started with Silver
Silver is designed for broad compatibility, although primarily supported on Powershell, Bash, Zsh, Fish, Ion, and Elvish shells. Here's how you can get started with using Silver:
Icons
To fully experience Silver with custom icons, one must either patch their font or use a pre-patched font from the Nerd Fonts collection. Icons are disabled by default, offering customization flexibility.
Installation
There are two main ways to install Silver:
-
From Source: This method requires installing and setting up Rust before running a specific Cargo installation command.
-
From Pre-compiled Binary: Users can download the necessary binary from Silver's release page and add it to their PATH environment variable.
MacOS Specific Steps
If you're using macOS, additional steps are necessary:
- Install Homebrew.
- Use Homebrew to install coreutils and openssl.
- Create an alias for date in your shell configuration to ensure compatibility.
Configuration
After installation, configuration is done through a silver.toml
file placed in specified directories based on your operating system (Linux or macOS). This file controls the prompt's appearance, aiding users in tailoring their setup to personal preferences.
Here's an example configuration:
[[left]]
name = "dir"
color.background = "blue"
color.foreground = "black"
[[left]]
name = "git"
color.background = "green"
color.foreground = "black"
[[right]]
name = "status"
color.background = "white"
color.foreground = "black"
[[right]]
name = "cmdtime"
color.background = "magenta"
color.foreground = "black"
[[right]]
name = "shell"
color.background = "green"
color.foreground = "black"
Finishing Setup
To activate Silver's prompt, users must evaluate the bootstrap code within their specified shell environment:
- Bash: Add the source command to
.bashrc
. - Ion: Add the eval command to
~/.config/ion/initrc
. - Powershell: Use an invoke expression command.
- For Zsh, Fish, and Elvish, refer to the respective plugins for setup instructions.
Documentation and Structure
Comprehensive documentation is accessible on Silver's wiki page. The project's structure consists of various Rust source files that include modules handling directories, environment variables, Git integration, status indications, and more.
Each module, from cmdtime.rs
to virtualenv.rs
, manages different prompt elements, contributing to Silver's modular and efficient architecture. This detailed organization ensures that every aspect of the user's shell experience is customizable, reliable, and swift.