- Notifications
You must be signed in to change notification settings - Fork1
A customizable and informative prompt for bash, zsh, fish, on linux and macOS.
License
danieltodor/blaze
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A customizable and informative prompt for bash, fish, zsh, on linux and macOS.
Features: easily configurable, transient prompt, git integration, command execution time,exit status, user defined modules, and more.
Installation
Configuration
Builtin modules
Creating your own modules
Update
Removal
Download and install blaze
Requirements:git
,make
,g++
git clone https://github.com/danieltodor/blaze.git&&cd blaze&&make install release=y
Setup your shell
Make sure~/.local/bin
is added to PATH.- Bash
echo'eval "$(blaze bash --init)"'>>~/.bashrc
- Fish
Depending on your config, you should move the added line where only interactive shells will use it.echo'blaze fish --init | source'>>~/.config/fish/config.fish
- Zsh
echo'eval "$(blaze zsh --init)"'>>~/.zshrc
- Bash
Configure
Open a new shell instance, and select a configuration with the./use_config <name>
command.
For additional configuration options, check out theconfiguration section.
It is recommended to use anerd font in your terminal emulator,so that the symbols are displayed correctly.
Note that some of the configs are suitable only for shells with right prompt.
Configuration files are read from these locations in order:
BLAZE_CONFIG
env variable~/.config/blaze/config.toml
# For color values you can use named values like "black" "red" "green" "yellow" "blue" "magenta" "cyan" "white".# If your terminal emulator supports the aixterm specification, you can also use these colors with the "bright_" prefix.# You can use color ids from "0" to "255". https://www.ditig.com/256-colors-cheat-sheet# If your terminal emulator has truecolor support, you can also use RGB and hexadecimal colors like "145, 255, 0" or "#3dff59".# Special values:# - "default" The background color of the (xterm compatible) terminal emulator.[global]# This will be added before and after the string in each modulepadding =""[prompt]# Prompt stringstring =" ❯"# Foreground color to useforeground =""# Foreground color to use when the last command was exited with non zero code. Use only if different from foregrounderror_foreground =""# Separate prompts with additional new linenew_line =false# Create a separator line between prompts from this characterseparator =""# Modules are displayed only for the last prompttransient =false# Start prompt on the bottom of the terminal windowbottom =false[connector]# This character will be used as spacing between the left and right side modulescharacter =""# Foreground color to useforeground =""# Background color to usebackground =""# Text styling to usedim =false[[module]]# Name of a builtin modulename =""# Execute a user defined moduleexecute =""# Optional content for certain modulescontent =""# Which level the module should be displayed on (required only for multilevel prompt)level =1# The position of the module (if omitted, modules will be displayed as they appear in config)position =1# Display it on left/right side. Or display it as right_prompt if the shell supports italign ="left"# Same as global one, but takes precedence over itpadding =""# Displayed inside the module, before the content (foreground used as color)inner_prefix =""# Displayed inside the module, after the content (foreground used as color)inner_suffix =""# Displayed as the beginning of the module (background used as color)outer_prefix =""# Displayed as the end of the module (background used as color)outer_suffix =""# Foreground color to useforeground =""# Background color to usebackground =""# Text styling to usebold =falsedim =falseitalic =falseunderline =false[directory]# Maximum number of parent folders to display. Use 0 to disable truncationlimit =10# Show folders from the root of the repositoryfrom_repository =true[duration]# Display module if execution time exceeds thresholdthreshold =2.0# Digits displayed after secondsprecision =1# Display franctional part if less than thisfractional_until =10.0[status]# Show exit status when it is 0 (success)show_zero =false[git_branch]# Show branch name even when the HEAD is in a detached stateshow_when_detached =false# Ignore branches that matches these regex patterns, e.g.: "^master"ignore = [][git_commit]# Show commit hash even when the HEAD points to a branchshow_when_attached =false# Commit hash length (might be longer, depending on uniqueness). Use 0 to disable trimminglength =7[git_status]# Show the number of changescount =true# Spacing between the elementsspacing =""# Displayed when the repository is cleanclean ="✓"# Displayed when the current branch is ahead of the remote branchahead ="↑"# Displayed when the current branch is behind the remote branchbehind ="↓"# Displayed when there are stashed filesstashed ="$"# Displayed when there are untracked filesuntracked ="?"# Displayed when there are conflicted filesconflicted ="="# Displayed when there are modified filesmodified ="!"# Displayed when there are staged filesstaged ="+"# Displayed when there are renamed filesrenamed ="»"# Displayed when there are deleted filesdeleted ="✘"[date]# Date format to useformat ="%x"[time]# Time format to useformat ="%X"
Name | Description |
---|---|
fixed | Can be used to display fixed text |
separator | Can be used for additional separation between modules |
directory | Current working directory |
duration | Execution time of the last command (wall time) |
status | Exit status of the last command |
git_branch | Active branch in the repository |
git_commit | Commit hash |
git_status | Symbols indicating the current state of the repository |
date | Current date(format options) |
time | Current time(format options) |
user | Current user |
host | Hostname |
shell | Currently active shell |
You can use the programming language of your choice to create a custom module.
- Create a script/binary that writes something to stdout.
# Check the PWD and/or the file/directory contents, or whatever you need.# At the end, write something to stdout.# If stdout is empty at the end, the module and its prefix/suffix content won't be displayed.# This way you can create modules that are only used in certain directories.print('something')
- Create a new module entry in your config file, and tell blaze how and where it can be executed.
[[module]]execute ="python path/to/file.py"# Additional styling like background, foreground, etc
cd
into the downloaded blaze directory and run this one-liner to update it.
git pull&& make clean&& make install release=y
It is advised to also update the config either via the./use_config <name>
command, or manually,as sometimes there are breaking changes.
- Delete the setup line from your shell's rc file.
cd
into the downloaded blaze directory and runmake uninstall
.- Delete the
config.toml
file if you created one.