Skip to content

Nhỏ gọn, cực nhanh, và khả năng tuỳ chỉnh vô hạn prompt cho bất kì shell nào!

Yêu cầu

  • A Nerd Font installed and enabled in your terminal.

Cài đặt nhanh chóng

  1. Cài đặt starship nhị phân:

    Cài đặt phiên bản cuối cùng

    Với Shell:

    sh
    curl -sS https://starship.rs/install.sh | sh

    Để cập nhật chính Starship, hãy chạy lại đoạn script bên trên. Nó sẽ thay thế phiên bản hiện tại mà không hề thay đổi gì những cài đặt của Starship trước đó.

    Cài đặt thông qua Trình quản lí gói

    Với Homebrew:

    sh
    brew install starship

    With Winget:

    powershell
    winget install starship
  2. Thêm đoạn mã khởi tạo vào tệp tin cấu hình shell của bạn:

    Bash

    Thêm đoạn sau vào cuối tệp tin ~/.bashrc:

    sh
    # ~/.bashrc
    
    eval "$(starship init bash)"

    Fish

    Thêm đoạn sau vào cuối tệp tin ~/.config/fish/config.fish:

    sh
    # ~/.config/fish/config.fish
    
    starship init fish | source

    Zsh

    Thêm đoạn sau vào cuối tệp tin ~/.zshrc:

    sh
    # ~/.zshrc
    
    eval "$(starship init zsh)"

    Powershell

    Thêm đoạn sau vào cuối tệp tin Microsoft.PowerShell_profile.ps1. Bạn có thể kiểm tra vị trí tệp tin này bằng việc truy xuất biến $PROFILE trong PowerShell. Thông thường, đường dẫn là ~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 hoặc ~/.config/powershell/Microsoft.PowerShell_profile.ps1 trên -Nix.

    sh
    Invoke-Expression (&starship init powershell)

    Ion

    Thêm đoạn sau vào cuối tệp tin ~/.config/ion/initrc:

    sh
    # ~/.config/ion/initrc
    
    eval $(starship init ion)

    Elvish

    WARNING

    Only elvish v0.18 or higher is supported.

    Thêm đoạn sau vào cuối tệp tin ~/.elvish/rc.elv:

    sh
    # ~/.elvish/rc.elv
    
    eval (starship init elvish)

    Tcsh

    Thêm đoạn sau vào cuối tệp tin ~/.tcshrc:

    sh
    # ~/.tcshrc
    
    eval `starship init tcsh`

    Nushell

    WARNING

    This will change in the future. Only Nushell v0.78+ is supported.

    Thêm đoạn code dưới đây vào cuối file Nushell env của bạn (Bạn có thể tìm đường dẫn tới file Nushell env bằng cách chạy $nu.env-path trong Nushell):

    sh
    mkdir ~/.cache/starship
    starship init nu | save -f ~/.cache/starship/init.nu

    Thêm đoạn code sau vào cuối file cấu hình Nushell (bạn có thể tìm đường dẫn tới file cấu hình Nushell bằng cách chạy câu lệnh $nu.config-path):

    sh
    use ~/.cache/starship/init.nu

    Xonsh

    Thêm dòng này vào cuối của file ~/.xonshrc:

    sh
    # ~/.xonshrc
    
    execx($(starship init xonsh))

    Cmd

    Bạn cần phải dùng Clink (v1.2.30+) với Cmd. Add the following to a file starship.lua and place this file in Clink scripts directory:

    lua
    -- starship.lua
    
    load(io.popen('starship init cmd'):read("*a"))()