Starship/zh: Difference between revisions
Created page with "如果您使用我刚才提到的其他 shell,请前往此 [https://starship.rs/guide/#step-2-set-up-your-shell-to-use-starship 页面]" Tags: Mobile edit Mobile web edit |
Created page with "由于我们无法包含 Starship 上的每个选项,因此这里有一个 GitHub 链接 <noinclude> [https://gist.github.com/s-a-c/0e44dc7766922308924812d4c019b109#file-starship-nix/ 包含每个配置选项] </noinclude> 这里有官方文档来解释每个选项, [https://starship.rs/config/ Starship 配置指南]" |
||
Line 112: | Line 112: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
由于我们无法包含 Starship 上的每个选项,因此这里有一个 GitHub 链接 <noinclude> [https://gist.github.com/s-a-c/0e44dc7766922308924812d4c019b109#file-starship-nix/ 包含每个配置选项] </noinclude> 这里有官方文档来解释每个选项, [https://starship.rs/config/ Starship 配置指南] | |||
祝你好运 :D | 祝你好运 :D | ||
[[Category:Shell|分类:Shell]] | [[Category:Shell|分类:Shell]] |
Revision as of 15:04, 10 October 2025
Starship is a fast, customizable, and minimal prompt for any shell. It is written in Rust and displays relevant information like the current directory, Git status, runtime versions, and more, adapting to the context with minimal configuration. It supports multiple shells, including Bash, Zsh, Fish, PowerShell and a lot of other shells, and your configuration will stay persistent across all these shells and is designed for speed and efficiency.
Installation
Using nix-shell
nix-shell -p starship
Using Global Configuration
environment.systemPackages = [
pkgs.starship
];
After modifying your configuration, apply the changes by running:
sudo nixos-rebuild switch
使用 Home Manager
home.packages = [
pkgs.starship
];
After updating your configuration, apply the changes by running:
home-manager switch
Configuration
Basic
programs.starship.enable = true;
after you have installed Starship you need to source it in your shell
Bash:
eval "$(starship init bash)"
Zsh:
eval "$(starship init zsh)"
Fish:
starship init fish | source
如果您使用我剛才提到的其他 shell,請前往此 頁面
Advanced
you can customize Starship with Nix (here's a snippet to understand) :
programs.starship = {
enable = true;
settings = {
add_newline = true;
command_timeout = 1300;
scan_timeout = 50;
format = "$all$nix_shell$nodejs$lua$golang$rust$php$git_branch$git_commit$git_state$git_status\n$username$hostname$directory";
character = {
success_symbol = "[](bold green) ";
error_symbol = "[✗](bold red) ";
};
};
};
由於我們無法包含 Starship 上的每個選項,因此這裡有一個 GitHub 連結 包含每個配置選項 這裡有官方文檔來解釋每個選項, Starship 配置指南
祝你好運 :D