├── LICENSE ├── README.md ├── lambda-mod.zsh-theme └── screenshot.png /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Hasib Billah 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Lambda (Mod) ZSH Theme 2 | 3 | A ZSH theme optimized for people who use: 4 | - Git 5 | - Unicode-compatible fonts and terminals 6 | 7 | --- 8 | 9 | ![Screenshot](https://raw.githubusercontent.com/halfo/lambda-mod-zsh-theme/master/screenshot.png) 10 | 11 | ## Configuring the amount of dir levels 12 | 13 | By default only the last three directories are shown in the prompt. The amount of 14 | levels can be configured by setting `LAMBDA_MOD_N_DIR_LEVELS` before loading the prompt: 15 | 16 | ``` zsh 17 | # ~/.zshrc 18 | export LAMBDA_MOD_N_DIR_LEVELS=10 19 | 20 | # load `lambda-mod` and `oh-my-zsh` 21 | ``` 22 | -------------------------------------------------------------------------------- /lambda-mod.zsh-theme: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | local LAMBDA="%(?,%{$fg_bold[green]%}λ,%{$fg_bold[red]%}λ)" 4 | if [[ "$USER" == "root" ]]; then USERCOLOR="red"; else USERCOLOR="yellow"; fi 5 | 6 | # Git sometimes goes into a detached head state. git_prompt_info doesn't 7 | # return anything in this case. So wrap it in another function and check 8 | # for an empty string. 9 | function check_git_prompt_info() { 10 | if type git &>/dev/null && git rev-parse --git-dir > /dev/null 2>&1; then 11 | if [[ -z $(git_prompt_info 2> /dev/null) ]]; then 12 | echo "%{$fg[blue]%}detached-head%{$reset_color%} $(git_prompt_status) 13 | %{$fg[yellow]%}→ " 14 | else 15 | echo "$(git_prompt_info 2> /dev/null) $(git_prompt_status) 16 | %{$fg_bold[cyan]%}→ " 17 | fi 18 | else 19 | echo "%{$fg_bold[cyan]%}→ " 20 | fi 21 | } 22 | 23 | function get_right_prompt() { 24 | if type git &>/dev/null && git rev-parse --git-dir > /dev/null 2>&1; then 25 | echo -n "$(git_prompt_short_sha)%{$reset_color%}" 26 | else 27 | echo -n "%{$reset_color%}" 28 | fi 29 | } 30 | 31 | PROMPT=$'\n'$LAMBDA'\ 32 | %{$fg_bold[$USERCOLOR]%}%n\ 33 | %{$fg_no_bold[magenta]%}[%'${LAMBDA_MOD_N_DIR_LEVELS:-3}'~]\ 34 | $(check_git_prompt_info)\ 35 | %{$reset_color%}' 36 | 37 | RPROMPT='$(get_right_prompt)' 38 | 39 | # Format for git_prompt_info() 40 | ZSH_THEME_GIT_PROMPT_PREFIX="at %{$fg[blue]%} " 41 | ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" 42 | ZSH_THEME_GIT_PROMPT_DIRTY="" 43 | ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%} ✔" 44 | 45 | # Format for git_prompt_status() 46 | ZSH_THEME_GIT_PROMPT_ADDED="%{$fg_bold[green]%}+" 47 | ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg_bold[blue]%}!" 48 | ZSH_THEME_GIT_PROMPT_DELETED="%{$fg_bold[red]%}-" 49 | ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg_bold[magenta]%}>" 50 | ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[yellow]%}#" 51 | ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[cyan]%}?" 52 | 53 | # Format for git_prompt_ahead() 54 | ZSH_THEME_GIT_PROMPT_AHEAD=" %{$fg_bold[white]%}^" 55 | 56 | 57 | # Format for git_prompt_long_sha() and git_prompt_short_sha() 58 | ZSH_THEME_GIT_PROMPT_SHA_BEFORE=" %{$fg_bold[white]%}[%{$fg_bold[blue]%}" 59 | ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$fg_bold[white]%}]" 60 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/halfo/lambda-mod-zsh-theme/f8b6ca5e348b15d1a1ffd5174747ea77f542bd4b/screenshot.png --------------------------------------------------------------------------------