├── zshtheme.png
├── README.md
├── heapbytes-mac.zsh-theme
├── heapbytes.zsh-theme
├── LICENSE
└── .zshrc
/zshtheme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/heapbytes/heapbytes-zsh/HEAD/zshtheme.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Zsh promt theme
2 |
3 | > This is an update version of my previous edited zsh theme.
4 |
5 |
6 | ## Features
7 | - Prints the current working directory
8 | - Prints the tun0 IP if connected to a VPN
9 | - Prints the wlan0 IP if you aren't connected to any VPN. (change the module name in `.zsh-theme` according to your wifi module)
10 | - Git info
11 |
12 | > You can call this a fork/update/inspiration of rkj theme.
13 |
14 | ## Showcase
15 |
16 | 
17 |
--------------------------------------------------------------------------------
/heapbytes-mac.zsh-theme:
--------------------------------------------------------------------------------
1 | #Author : Heapbytes (https://github.com/heapbytes)
2 |
3 | PROMPT='
4 | ┌─[%F{blue} %~%f] [%F{green} $(get_ip_address)%f] $(git_prompt_info)
5 | └─➜ '
6 |
7 | RPROMPT='[%F{red}%?%f]'
8 |
9 | # https://apple.stackexchange.com/questions/226871/how-can-i-get-the-list-of-all-active-network-interfaces-programmatically/226880#226880
10 | get_ip_address() {
11 | ipAddress="$(ipconfig getifaddr $(networksetup -listallhardwareports | awk '/Hardware Port: Wi-Fi/{getline; print $2}'))"
12 | if [[ -n ipAddress ]]; then
13 | echo "%{$fg[green]%}$ipAddress"
14 | else
15 | echo "%{$fg[red]%}No IP%{$reset_color%}"
16 | fi
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/heapbytes.zsh-theme:
--------------------------------------------------------------------------------
1 | #Author : Heapbytes (https://github.com/heapbytes)
2 |
3 | PROMPT='
4 | ┌─[%F{blue} %~%f] [%F{green} $(get_ip_address)%f] $(git_prompt_info)
5 | └─➜ '
6 |
7 | RPROMPT='[%F{red}%?%f]'
8 |
9 | get_ip_address() {
10 | if [[ -n "$(ifconfig tun0 2>/dev/null)" ]]; then
11 | echo "%{$fg[green]%}$(ifconfig tun0 | awk '/inet / {print $2}')%{$reset_color%}"
12 | else
13 | local ip=$(ip -4 addr | awk '/inet/ && $2 !~ /^127/ {print $2}' | cut -d/ -f1 | head -n1)
14 | if [[ -n "$ip" ]]; then
15 | echo "%{$fg[green]%}$ip%{$reset_color%}"
16 | else
17 | echo "%{$fg[red]%}No IP%{$reset_color%}"
18 | fi
19 | fi
20 | }
21 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 Gourav Suram
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 |
--------------------------------------------------------------------------------
/.zshrc:
--------------------------------------------------------------------------------
1 | # If you come from bash you might have to change your $PATH.
2 | # export PATH=$HOME/bin:/usr/local/bin:$PATH
3 |
4 | # Path to your oh-my-zsh installation.
5 | export ZSH=$HOME/.oh-my-zsh
6 |
7 | # Set name of the theme to load --- if set to "random", it will
8 | # load a random theme each time oh-my-zsh is loaded, in which case,
9 | # to know which specific one was loaded, run: echo $RANDOM_THEME
10 | # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
11 | ZSH_THEME="heapbytes"
12 |
13 |
14 | # Add wisely, as too many plugins slow down shell startup.
15 | plugins=(git
16 | zsh-autosuggestions
17 | zsh-syntax-highlighting
18 | )
19 |
20 | source $ZSH/oh-my-zsh.sh
21 |
22 | # On-demand rehash
23 | zshcache_time="$(date +%s%N)"
24 |
25 | autoload -Uz add-zsh-hook
26 |
27 | rehash_precmd() {
28 | if [[ -a /var/cache/zsh/pacman ]]; then
29 | local paccache_time="$(date -r /var/cache/zsh/pacman +%s%N)"
30 | if (( zshcache_time < paccache_time )); then
31 | rehash
32 | zshcache_time="$paccache_time"
33 | fi
34 | fi
35 | }
36 |
37 | add-zsh-hook -Uz precmd rehash_precmd
38 |
39 | # omz
40 | alias zshconfig="geany ~/.zshrc"
41 | alias ohmyzsh="thunar ~/.oh-my-zsh"
42 |
43 | # exa --icons
44 | # ls
45 | alias ls='exa --icons'
46 | alias l='exa --icons -lh'
47 | alias ll='exa --icons -lah'
48 | alias la='exa --icons -A'
49 | alias lm='exa --icons -m'
50 | alias lr='exa --icons -R'
51 | alias lg='exa --icons -l --group-directories-first'
52 |
53 | # git
54 | alias gcl='git clone --depth 1'
55 | alias gi='git init'
56 | alias ga='git add'
57 | alias gc='git commit -m'
58 | alias gp='git push origin master'
59 |
60 | #my
61 |
62 | #alias nvim='$HOME/.local/bin/lvim'
63 | #alias lvim='$HOME/.local/bin/lvim'
64 | alias pinstall='sudo pacman -S'
65 | alias upinstall='sudo pacman -Sy'
66 | alias yinstall='yay -S'
67 |
68 | precmd(){
69 | precmd(){
70 | echo
71 | }
72 | }
73 |
74 |
75 |
--------------------------------------------------------------------------------