├── LICENSE.md ├── README.md ├── pure.zsh-theme └── screenshot.png /LICENSE.md: -------------------------------------------------------------------------------- 1 | ## The MIT License (MIT) 2 | 3 | Copyright © 2014 [Kasper Kronborg Isager](https://github.com/kasperisager) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Pure for Oh My Zsh 2 | 3 | A super clean and minimal theme for your Oh My Zsh-powered prompt. Based on the [Pure prompt](https://github.com/sindresorhus/pure) by [Sindre Sorhus](https://github.com/sindresorhus) 4 | 5 | ![](screenshot.png) 6 | -------------------------------------------------------------------------------- /pure.zsh-theme: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | # ------------------------------------------------------------------------------ 4 | # 5 | # Pure - A minimal and beautiful theme for oh-my-zsh 6 | # 7 | # Based on the custom Zsh-prompt of the same name by Sindre Sorhus. A huge 8 | # thanks goes out to him for designing the fantastic Pure prompt in the first 9 | # place! I'd also like to thank Julien Nicoulaud for his "nicoulaj" theme from 10 | # which I've borrowed both some ideas and some actual code. You can find out 11 | # more about both of these fantastic two people here: 12 | # 13 | # Sindre Sorhus 14 | # Github: https://github.com/sindresorhus 15 | # Twitter: https://twitter.com/sindresorhus 16 | # 17 | # Julien Nicoulaud 18 | # Github: https://github.com/nicoulaj 19 | # Twitter: https://twitter.com/nicoulaj 20 | # 21 | # License 22 | # 23 | # Copyright (c) 2013 Kasper Kronborg Isager 24 | # 25 | # Permission is hereby granted, free of charge, to any person obtaining a copy 26 | # of this software and associated documentation files (the "Software"), to deal 27 | # in the Software without restriction, including without limitation the rights 28 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 29 | # copies of the Software, and to permit persons to whom the Software is 30 | # furnished to do so, subject to the following conditions: 31 | # 32 | # The above copyright notice and this permission notice shall be included in 33 | # all copies or substantial portions of the Software. 34 | # 35 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 36 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 37 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 38 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 39 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 40 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 41 | # THE SOFTWARE. 42 | # 43 | # ------------------------------------------------------------------------------ 44 | 45 | # Set required options 46 | # 47 | setopt prompt_subst 48 | 49 | # Load required modules 50 | # 51 | autoload -Uz vcs_info 52 | 53 | # Set vcs_info parameters 54 | # 55 | zstyle ':vcs_info:*' enable hg bzr git 56 | zstyle ':vcs_info:*:*' unstagedstr '!' 57 | zstyle ':vcs_info:*:*' stagedstr '+' 58 | zstyle ':vcs_info:*:*' formats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%%u%c" 59 | zstyle ':vcs_info:*:*' actionformats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%u%c (%a)" 60 | zstyle ':vcs_info:*:*' nvcsformats "%~" "" "" 61 | 62 | # Fastest possible way to check if repo is dirty 63 | # 64 | git_dirty() { 65 | # Check if we're in a git repo 66 | command git rev-parse --is-inside-work-tree &>/dev/null || return 67 | # Check if it's dirty 68 | command git diff --quiet --ignore-submodules HEAD &>/dev/null; [ $? -eq 1 ] && echo "*" 69 | } 70 | 71 | # Display information about the current repository 72 | # 73 | repo_information() { 74 | echo "%F{blue}${vcs_info_msg_0_%%/.} %F{8}$vcs_info_msg_1_`git_dirty` $vcs_info_msg_2_%f" 75 | } 76 | 77 | # Displays the exec time of the last command if set threshold was exceeded 78 | # 79 | cmd_exec_time() { 80 | local stop=`date +%s` 81 | local start=${cmd_timestamp:-$stop} 82 | let local elapsed=$stop-$start 83 | [ $elapsed -gt 5 ] && echo ${elapsed}s 84 | } 85 | 86 | # Get the intial timestamp for cmd_exec_time 87 | # 88 | preexec() { 89 | cmd_timestamp=`date +%s` 90 | } 91 | 92 | # Output additional information about paths, repos and exec time 93 | # 94 | precmd() { 95 | vcs_info # Get version control info before we start outputting stuff 96 | print -P "\n$(repo_information) %F{yellow}$(cmd_exec_time)%f" 97 | } 98 | 99 | # Define prompts 100 | # 101 | PROMPT="%(?.%F{magenta}.%F{red})❯%f " # Display a red prompt char on failure 102 | RPROMPT="%F{8}${SSH_TTY:+%n@%m}%f" # Display username if connected via SSH 103 | 104 | # ------------------------------------------------------------------------------ 105 | # 106 | # List of vcs_info format strings: 107 | # 108 | # %b => current branch 109 | # %a => current action (rebase/merge) 110 | # %s => current version control system 111 | # %r => name of the root directory of the repository 112 | # %S => current path relative to the repository root directory 113 | # %m => in case of Git, show information about stashes 114 | # %u => show unstaged changes in the repository 115 | # %c => show staged changes in the repository 116 | # 117 | # List of prompt format strings: 118 | # 119 | # prompt: 120 | # %F => color dict 121 | # %f => reset color 122 | # %~ => current path 123 | # %* => time 124 | # %n => username 125 | # %m => shortname host 126 | # %(?..) => prompt conditional - %(condition.true.false) 127 | # 128 | # ------------------------------------------------------------------------------ 129 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kasperisager/zsh-pure/d6f349466c23b7be00d63a0efc32a99eb542c68e/screenshot.png --------------------------------------------------------------------------------