mirror of
https://github.com/GeorgeSG/dotfiles.git
synced 2026-09-04 00:18:44 +00:00
Compare commits
205
Commits
v1
...
2c124d2bee
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c124d2bee | ||
|
|
26262f2111 | ||
|
|
38206e6f48 | ||
|
|
d80d9d5462 | ||
|
|
ab3f98f506 | ||
|
|
aac8d2a035 | ||
|
|
71be3eb48b | ||
|
|
5f65e96f8e | ||
|
|
b1fcfbb6d4 | ||
|
|
171bc921a7 | ||
|
|
ffb94b7a62 | ||
|
|
df3bdd3207 | ||
|
|
a01ad11ace | ||
|
|
72e2db0780 | ||
|
|
5b0f04c2b6 | ||
|
|
894f00cc5e | ||
|
|
e26ea8a377 | ||
|
|
966b04322e | ||
|
|
d822494616 | ||
|
|
98d91f20c8 | ||
|
|
5f8c77cdc8 | ||
|
|
b60c5602ca | ||
|
|
e192ef81f4 | ||
|
|
8ab8cc5533 | ||
|
|
2f8e433848 | ||
|
|
ad28dee306 | ||
|
|
b7d6c1f529 | ||
|
|
13befac5e6 | ||
|
|
034ba4bc36 | ||
|
|
6d0daf7535 | ||
|
|
f9367d6fe6 | ||
|
|
7f7c5b3786 | ||
|
|
910b4d3846 | ||
|
|
3b1193b66b | ||
|
|
418e882aa7 | ||
|
|
1bfc8feeff | ||
|
|
cb2930a6e3 | ||
|
|
0e5cd1e276 | ||
|
|
097ee2c214 | ||
|
|
9262b92c3a | ||
|
|
ab7a3c7dc7 | ||
|
|
484665b291 | ||
|
|
9a9edb57ff | ||
|
|
091218ca64 | ||
|
|
ffd0b82e21 | ||
|
|
b1024a5363 | ||
|
|
eee5631613 | ||
|
|
58da740702 | ||
|
|
ea1af03c9b | ||
|
|
adb5c180c4 | ||
|
|
7f76c54c73 | ||
|
|
36daa66605 | ||
|
|
c190054553 | ||
|
|
42f87f7acd | ||
|
|
ac77163995 | ||
|
|
ca0a011536 | ||
|
|
0389f91188 | ||
|
|
1ed9a09f1b | ||
|
|
afc4f70fa7 | ||
|
|
a2d1b6d12a | ||
|
|
5d6445d575 | ||
|
|
16d887ec8d | ||
|
|
f2963d17b7 | ||
|
|
e5ed811055 | ||
|
|
58f0b6cb9a | ||
|
|
74bacf3304 | ||
|
|
34c51ecc9b | ||
|
|
73bf405e02 | ||
|
|
63060c52f4 | ||
|
|
af1dd2c0fc | ||
|
|
a1f4d4cb9c | ||
|
|
74a55a2dba | ||
|
|
36bcdccc21 | ||
|
|
7c84d0c507 | ||
|
|
b820d657ee | ||
|
|
ead8c1df03 | ||
|
|
9c7184fb66 | ||
|
|
8e8f35f5e8 | ||
|
|
278ca68338 | ||
|
|
0cc989bbb7 | ||
|
|
47a432293e | ||
|
|
75d563e018 | ||
|
|
376f6578cb | ||
|
|
706f3846ee | ||
|
|
6d248c04c8 | ||
|
|
577a07285b | ||
|
|
22c8a7159b | ||
|
|
d41f162b61 | ||
|
|
567523d4d4 | ||
|
|
bd5fc63166 | ||
|
|
5899f68be2 | ||
|
|
08bdb7655b | ||
|
|
e43d18baf7 | ||
|
|
503f514783 | ||
|
|
27517b46f5 | ||
|
|
fd94ad783b | ||
|
|
f8adb2fdf0 | ||
|
|
a1a8f36931 | ||
|
|
d5694f106e | ||
|
|
096ffe0f7d | ||
|
|
3e062ad036 | ||
|
|
0d0804a420 | ||
|
|
47af8efcfa | ||
|
|
04625d844e | ||
|
|
a76f5f0563 | ||
|
|
5abece9316 | ||
|
|
ade30406d3 | ||
|
|
91ee9a3087 | ||
|
|
d720aa58c6 | ||
|
|
a1c1e65960 | ||
|
|
7161134798 | ||
|
|
d2f1022b42 | ||
|
|
68d9562369 | ||
|
|
56584b3abe | ||
|
|
ade4e7d527 | ||
|
|
75eec352cb | ||
|
|
a120b8747a | ||
|
|
0763dcb89c | ||
|
|
be0c0a8302 | ||
|
|
41043f38bc | ||
|
|
4d7d433253 | ||
|
|
259e90d98d | ||
|
|
c38a23a408 | ||
|
|
8701166c31 | ||
|
|
fe9397b8e9 | ||
|
|
91bb9c57a6 | ||
|
|
a98422f735 | ||
|
|
494cad38eb | ||
|
|
d9a0518046 | ||
|
|
7f75d9ff8f | ||
|
|
99f55332f8 | ||
|
|
1afcfcc7f2 | ||
|
|
5d2960ba25 | ||
|
|
231fcb3d6e | ||
|
|
23f1285b80 | ||
|
|
e9f42c013b | ||
|
|
6ee241f17e | ||
|
|
57d074b3a2 | ||
|
|
8d30d8f42c | ||
|
|
7a355e626d | ||
|
|
d0d8162af6 | ||
|
|
b72530e8f5 | ||
|
|
fe81ac69a7 | ||
|
|
d91faeb4b4 | ||
|
|
bfc3ad92ef | ||
|
|
74abf09eaa | ||
|
|
78c15fbd28 | ||
|
|
25639710e8 | ||
|
|
c30aaee31c | ||
|
|
a92433ea8e | ||
|
|
6948d245e8 | ||
|
|
1fd685683b | ||
|
|
f29af7c047 | ||
|
|
9d7d4f0b29 | ||
|
|
d4a2c81fe0 | ||
|
|
6274ebc261 | ||
|
|
5436636128 | ||
|
|
fa0a818f4a | ||
|
|
62d75fe13d | ||
|
|
2e25bbc165 | ||
|
|
5f32f16103 | ||
|
|
2aae05ba23 | ||
|
|
4b0468dfa0 | ||
|
|
c00e9da16d | ||
|
|
df082c2644 | ||
|
|
440b679fbc | ||
|
|
e22f60a262 | ||
|
|
6f38970446 | ||
|
|
d118fd7f96 | ||
|
|
0ad2db0b12 | ||
|
|
274bd20ec9 | ||
|
|
82b42198ac | ||
|
|
077616dd24 | ||
|
|
73fc82ed3c | ||
|
|
2d560eaa18 | ||
|
|
21bd58a24d | ||
|
|
2ad62f154e | ||
|
|
8a8f2b4064 | ||
|
|
67645789d6 | ||
|
|
e375e5197e | ||
|
|
95785f830a | ||
|
|
3a22236d21 | ||
|
|
e78bba211f | ||
|
|
716b715386 | ||
|
|
c09ac49ae6 | ||
|
|
94e7d6ce27 | ||
|
|
1cab46c1d0 | ||
|
|
a29c560bd9 | ||
|
|
bd26d27e63 | ||
|
|
bce7bf0e9e | ||
|
|
6ed5cf2d3f | ||
|
|
a6440ea9a1 | ||
|
|
8c720beba3 | ||
|
|
67d0315ce0 | ||
|
|
b6d2b759b3 | ||
|
|
506b9a5cd0 | ||
|
|
eeb6938b3b | ||
|
|
8a8172a441 | ||
|
|
b3522c7af3 | ||
|
|
810e35bc74 | ||
|
|
e106aa71bf | ||
|
|
a73acbaa1c | ||
|
|
3f392d4a75 | ||
|
|
28e991f7b1 | ||
|
|
284aa8ba39 |
@@ -1,52 +0,0 @@
|
||||
##### Platform independent #####
|
||||
# Git Aliases
|
||||
alias g="git"
|
||||
alias much="git"
|
||||
alias such="git"
|
||||
alias very="git"
|
||||
alias so="git"
|
||||
|
||||
alias ga="git add"
|
||||
alias gr="git rm"
|
||||
alias gc="git commit"
|
||||
alias gs="git status -s"
|
||||
alias gss="git status"
|
||||
alias gd="git diff"
|
||||
alias gds="git diff --staged"
|
||||
alias gco="git checkout"
|
||||
alias gcm="git checkout master"
|
||||
alias gpom="git pull origin master"
|
||||
alias gbd="git branch -D"
|
||||
alias gm="git mergetool"
|
||||
|
||||
alias tm="tmux -2 attach-session -t "default" || tmux -2 new-session -s \"default\""
|
||||
alias tmv="tmux -2 attach-session -t "vscode" || tmux -2 new-session -s \"vscode\""
|
||||
|
||||
# Editing files
|
||||
alias aliases="code ~/.bash_aliases"
|
||||
alias vimrc="vim ~/.vimrc"
|
||||
|
||||
# NPM
|
||||
alias npr="npm run"
|
||||
|
||||
# CD-ing to some commonly used folders
|
||||
alias og="cd ~/Git"
|
||||
|
||||
alias sass_watch="sass --watch ./:./"
|
||||
alias grep="grep --color=auto"
|
||||
alias c="clear"
|
||||
alias be="bundle exec"
|
||||
alias share="python -m SimpleHTTPServer"
|
||||
|
||||
##### Mac OS Specific #####
|
||||
alias showfiles="defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app"
|
||||
alias hidefiles="defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app"
|
||||
alias cask="brew cask"
|
||||
|
||||
alias fl="open -a ForkLift"
|
||||
|
||||
if [ -f ~/.bash_local_aliases ]; then
|
||||
. ~/.bash_local_aliases
|
||||
fi
|
||||
|
||||
alias dokku='$HOME/.dokku/contrib/dokku_client.sh'
|
||||
@@ -1 +0,0 @@
|
||||
source ~/.bashrc
|
||||
@@ -1,91 +0,0 @@
|
||||
# Colors
|
||||
PS1='\[\e[1;32m\]\w\[\e[m\]\[\e[1;0m\] \[\e[0m\] \[\e[1;0m\]'
|
||||
export TERM=xterm-256color
|
||||
|
||||
shopt -s autocd
|
||||
shopt -s cdspell
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# Disable Caret-C output
|
||||
stty -ctlecho
|
||||
|
||||
set -o vi
|
||||
bind -m vi-insert "\C-l":clear-screen
|
||||
|
||||
#so as not to be disturbed by Ctrl-S ctrl-Q in terminals:
|
||||
stty -ixon
|
||||
|
||||
######################
|
||||
# History Management #
|
||||
######################
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
|
||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||
HISTSIZE=5000
|
||||
HISTFILESIZE=2000
|
||||
|
||||
# don't put duplicate lines or lines starting with space in the history.
|
||||
# See bash(1) for more options
|
||||
HISTCONTROL=ignoreboth
|
||||
|
||||
if [ -f ~/.bash-git-prompt/share/gitprompt.sh ]; then
|
||||
source ~/.bash-git-prompt/share/gitprompt.sh
|
||||
fi
|
||||
|
||||
GIT_PROMPT_ONLY_IN_REPO=1
|
||||
GIT_PROMPT_START="\[\e[1;32m\]\w\[\e[m\]"
|
||||
GIT_PROMPT_END="\[\e[1;m\] \[\e[1;m\]"
|
||||
GIT_PROMPT_THEME=Georgi
|
||||
|
||||
######################
|
||||
# Aliases #
|
||||
######################
|
||||
|
||||
# enable color support of ls and also add handy aliases
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
fi
|
||||
|
||||
# some more ls aliases
|
||||
alias ls='ls -G'
|
||||
alias ll='ls -alFG'
|
||||
alias la='ls -AG'
|
||||
alias l='ls -CFG'
|
||||
|
||||
if [ -f ~/.bash_aliases ]; then
|
||||
. ~/.bash_aliases
|
||||
fi
|
||||
|
||||
######################
|
||||
# Completion #
|
||||
######################
|
||||
|
||||
# enable programmable completion features (you don't need to enable
|
||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
# sources /etc/bash.bashrc).
|
||||
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
|
||||
# Git completion
|
||||
if [ -f ~/.git-completion.bash ]; then
|
||||
. ~/.git-completion.bash
|
||||
fi
|
||||
|
||||
######################
|
||||
# Sources & exports #
|
||||
######################
|
||||
|
||||
if [ -f ~/.bashrc_local ]; then
|
||||
. ~/.bashrc_local
|
||||
fi
|
||||
|
||||
# Editor
|
||||
export EDITOR='subl -w'
|
||||
-55
@@ -1,55 +0,0 @@
|
||||
|
||||
[color]
|
||||
diff = auto
|
||||
status = auto
|
||||
branch = auto
|
||||
interactive = auto
|
||||
ui = auto
|
||||
[alias]
|
||||
# Shorten some often used commands
|
||||
b = branch
|
||||
c = commit
|
||||
co = checkout
|
||||
com = checkout master
|
||||
ss = status
|
||||
s = status -s
|
||||
ds = diff --staged
|
||||
amend = commit --amend -c HEAD
|
||||
oops = reset --soft HEAD~1
|
||||
kris = pull --rebase
|
||||
ignore = !git update-index --assume-unchanged
|
||||
unignore = !git update-index --no-assume-unchanged
|
||||
ignored = !git ls-files -v | grep "^[[:lower:]]"
|
||||
undo = reset --soft HEAD^
|
||||
squash = rebase --autostash -i
|
||||
megasquash = "!f() { git rebase --autostash -i `git merge-base --fork-point HEAD master`; }; f"
|
||||
|
||||
# various pretty loggers from various places
|
||||
l = log --pretty=oneline --abbrev-commit
|
||||
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
|
||||
lgg = log --graph --pretty=format:'%Creset %s' --abbrev-commit
|
||||
lc = log ORIG_HEAD.. --stat --no-merges
|
||||
# from http://blog.kfish.org/2010/04/git-lola.html
|
||||
lol = log --graph --decorate --pretty=oneline --abbrev-commit
|
||||
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
|
||||
ll = log --graph --date=short
|
||||
[push]
|
||||
default = simple
|
||||
[mergetool "sourcetree"]
|
||||
cmd = /Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
|
||||
trustExitCode = true
|
||||
[diff]
|
||||
tool = default-difftool
|
||||
[difftool "default-difftool"]
|
||||
cmd = code --wait --diff $LOCAL $REMOTE
|
||||
[difftool "sourcetree"]
|
||||
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
|
||||
path =
|
||||
[filter "media"]
|
||||
clean = git media clean %f
|
||||
smudge = git media smudge %f
|
||||
required = true
|
||||
|
||||
# local user config, usernames, etc
|
||||
[include]
|
||||
path=~/.gitconfig-local
|
||||
+13
-2
@@ -1,3 +1,14 @@
|
||||
.DS_Store
|
||||
.vim/bundle
|
||||
.vim/undodir
|
||||
home/.vim/bundle
|
||||
home/.vim/undodir
|
||||
home/.config/bash/bash-git-prompt
|
||||
Brewfile.lock.json
|
||||
Caskfile.lock.json
|
||||
|
||||
home/.config/alacritty/themes
|
||||
|
||||
__pycache__
|
||||
*.pyc
|
||||
|
||||
*.local
|
||||
*.log
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
[submodule "dotbot"]
|
||||
path = dotbot
|
||||
url = https://github.com/anishathalye/dotbot
|
||||
ignore = dirty
|
||||
[submodule "home/config/tmux/plugins/tpm"]
|
||||
path = home/config/tmux/plugins/tpm
|
||||
url = https://github.com/tmux-plugins/tpm
|
||||
[submodule "home/config/bash/bash-git-prompt"]
|
||||
path = home/config/bash/bash-git-prompt
|
||||
url = https://github.com/magicmonty/bash-git-prompt.git
|
||||
[submodule "home/config/zsh/plugins/zsh-git-prompt"]
|
||||
path = home/config/zsh/plugins/zsh-git-prompt
|
||||
url = https://github.com/zsh-git-prompt/zsh-git-prompt.git
|
||||
[submodule "home/config/zsh/plugins/calc.plugin.zsh"]
|
||||
path = home/config/zsh/plugins/calc.plugin.zsh
|
||||
url = https://github.com/arzzen/calc.plugin.zsh.git
|
||||
[submodule "home/config/zsh/plugins/zsh-vim-mode"]
|
||||
path = home/config/zsh/plugins/zsh-vim-mode
|
||||
url = https://github.com/softmoth/zsh-vim-mode.git
|
||||
[submodule "home/config/zsh/plugins/zsh-better-npm-completion"]
|
||||
path = home/config/zsh/plugins/zsh-better-npm-completion
|
||||
url = https://github.com/lukechilds/zsh-better-npm-completion.git
|
||||
[submodule "home/config/zsh/plugins/zsh-ssh"]
|
||||
path = home/config/zsh/plugins/zsh-ssh
|
||||
url = https://github.com/sunlei/zsh-ssh
|
||||
[submodule "home/vim/bundle/Vundle.vim"]
|
||||
path = home/vim/bundle/Vundle.vim
|
||||
url = https://github.com/VundleVim/Vundle.vim.git
|
||||
-124
@@ -1,124 +0,0 @@
|
||||
# ------------------
|
||||
# General Settings
|
||||
# ------------------
|
||||
|
||||
# Set Custom Prefix
|
||||
set -g prefix C-a
|
||||
unbind C-b
|
||||
|
||||
# Start in newer bash
|
||||
set-option -g default-command "/usr/local/bin/bash --login"
|
||||
|
||||
# Disable delay
|
||||
set -sg escape-time 1
|
||||
|
||||
# Change the index of first window or pane to 1
|
||||
set -g base-index 1
|
||||
setw -g pane-base-index 1
|
||||
|
||||
# set -g status-utf8 on
|
||||
# setw -g utf8 on
|
||||
|
||||
# -------------------
|
||||
# Visual Settings
|
||||
# -------------------
|
||||
|
||||
set -g default-terminal "screen-256color"
|
||||
|
||||
# Theme
|
||||
|
||||
# Theme "Tomorrow"
|
||||
|
||||
TMUX_PANE_BORDER_FG="#d6d6d6"
|
||||
TMUX_PANE_ACTIVE_BORDER_FG="#3e999f"
|
||||
TMUX_MESSAGE_FG="#3e999f"
|
||||
TMUX_MESSAGE_BG="#d6d6d6"
|
||||
TMUX_STATUS_BG="#efefef"
|
||||
|
||||
TMUX_NAMESPACE_FG="#efefef"
|
||||
TMUX_NAMESPACE_BG="#c82829"
|
||||
TMUX_USERNAME_FG="#efefef"
|
||||
TMUX_USERNAME_BG="#f5871f"
|
||||
|
||||
# Pane borders
|
||||
set -g pane-border-style "fg=$TMUX_PANE_BORDER_FG"
|
||||
set -g pane-active-border-style "fg=$TMUX_PANE_ACTIVE_BORDER_FG"
|
||||
|
||||
# Message in status bar (e.g. Copied successfully)
|
||||
set -g message-style "fg=$TMUX_MESSAGE_FG,bg=$TMUX_MESSAGE_BG"
|
||||
|
||||
# Status bar
|
||||
set-option -g status-position bottom
|
||||
|
||||
# Status mid style
|
||||
set -g status-style "fg=white,bg=$TMUX_STATUS_BG"
|
||||
|
||||
set -g status-left '#[fg=#(echo $TMUX_NAMESPACE_FG),bg=#(echo $TMUX_NAMESPACE_BG),bold] #S #[fg=#(echo $TMUX_NAMESPACE_BG),bg=#(echo $TMUX_USERNAME_BG),bold]#[fg=#(echo $TMUX_STATUS_BG),bg=#(echo $TMUX_USERNAME_BG),bold] #(whoami) #[fg=#(echo $TMUX_USERNAME_BG),bg=#(echo $TMUX_STATUS_BG),bold]'
|
||||
set -g status-left-length 30
|
||||
|
||||
set -g status-right '#[fg=#(echo $TMUX_USERNAME_BG),bg=#(echo $TMUX_NAMESPACE_FG),bold]#[fg=#(echo $TMUX_NAMESPACE_FG),bg=#(echo $TMUX_USERNAME_BG),bold] #H #[fg=#(echo $TMUX_NAMESPACE_BG),bg=#(echo $TMUX_USERNAME_BG),bold]#[fg=#(echo $TMUX_NAMESPACE_FG),bg=#(echo $TMUX_NAMESPACE_BG),bold] #(date +%H:%M) '
|
||||
set -g status-right-length 60
|
||||
|
||||
# window name options
|
||||
set -g window-status-format "#[fg=#3e999f,bg=#efefef] #I #W "
|
||||
set -g window-status-current-format "#[fg=#efefef,bg=#3e999f,noreverse,bold] #I #W "
|
||||
|
||||
|
||||
# --------------------
|
||||
# Custom keybindings
|
||||
# --------------------
|
||||
|
||||
set -g mouse on
|
||||
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"
|
||||
|
||||
|
||||
setw -g mode-keys vi
|
||||
bind C-a send-prefix
|
||||
|
||||
# Unbind unused defaults
|
||||
unbind %
|
||||
unbind [
|
||||
unbind p
|
||||
|
||||
unbind Up
|
||||
unbind Down
|
||||
unbind Left
|
||||
unbind Right
|
||||
|
||||
unbind M-Up
|
||||
unbind M-Down
|
||||
unbind M-Left
|
||||
unbind M-Right
|
||||
|
||||
unbind C-Up
|
||||
unbind C-Down
|
||||
unbind C-Left
|
||||
unbind C-Right
|
||||
|
||||
# Source this file
|
||||
bind r source-file ~/.tmux.conf \; display "Config file reloaded!"
|
||||
|
||||
# Splits
|
||||
bind v split-window -h
|
||||
bind s split-window -v
|
||||
|
||||
# Move between panes
|
||||
bind h select-pane -L
|
||||
bind j select-pane -D
|
||||
bind k select-pane -U
|
||||
bind l select-pane -R
|
||||
|
||||
# Move between windows
|
||||
bind -r C-h select-window -t :-
|
||||
bind -r C-l select-window -t :+
|
||||
|
||||
# Resize panes
|
||||
bind -r H resize-pane -L 5
|
||||
bind -r J resize-pane -D 5
|
||||
bind -r K resize-pane -U 5
|
||||
bind -r L resize-pane -R 5
|
||||
|
||||
# Copy & Paste
|
||||
bind Escape copy-mode
|
||||
bind p paste-buffer
|
||||
bind C-c run-shell "bash -c 'tmux show-buffer | pbcopy'" \; display 'Copied to clipboard'
|
||||
@@ -1,46 +0,0 @@
|
||||
# Mappings for keys for MX Revoluton
|
||||
# b:1 - left mouse button
|
||||
# b:2 - left and right mouse button together
|
||||
# b:3 - right mouse button
|
||||
# b:4 - mouse wheel up
|
||||
# b:5 - mouse wheel down
|
||||
# b:6 - mouse wheel left
|
||||
# b:7 - mouse wheel right
|
||||
# b:8 - back button
|
||||
# b:9 - forward button
|
||||
# b:10 - -none-
|
||||
# b:11 - -none-
|
||||
# b:12 - -none-
|
||||
# b:13 - media wheel up
|
||||
# b:14 - -none-
|
||||
# b:15 - media wheel down
|
||||
# b:16 - -none-
|
||||
# b:17 - media wheel press
|
||||
|
||||
# forward
|
||||
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next"
|
||||
m:0x0 + b:8
|
||||
|
||||
# back
|
||||
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous"
|
||||
m:0x0 + b:9
|
||||
|
||||
# volume up
|
||||
"amixer -D pulse sset Master 5%+"
|
||||
m:0x0 + b:13
|
||||
|
||||
# volume down
|
||||
"amixer -D pulse sset Master 5%-"
|
||||
m:0x0 + b:15
|
||||
|
||||
# mute
|
||||
"amixer -D pulse set Master 1+ toggle"
|
||||
m:0x0 + b:17
|
||||
|
||||
# mouse wheel left middle click
|
||||
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause"
|
||||
b:6
|
||||
|
||||
# mouse wheel right middle click
|
||||
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop"
|
||||
b:7
|
||||
@@ -1,74 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: UTF-8 -*-
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
# change those symbols to whatever you prefer
|
||||
symbols = {'ahead of': '↑', 'behind': '↓', 'prehash':':'}
|
||||
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
import sys
|
||||
gitsym = Popen(['git', 'symbolic-ref', 'HEAD'], stdout=PIPE, stderr=PIPE)
|
||||
branch, error = gitsym.communicate()
|
||||
|
||||
error_string = error.decode('utf-8')
|
||||
|
||||
if 'fatal: Not a git repository' in error_string:
|
||||
sys.exit(0)
|
||||
|
||||
branch = branch.strip()[11:]
|
||||
|
||||
res, err = Popen(['git','diff','--name-status'], stdout=PIPE, stderr=PIPE).communicate()
|
||||
err_string = err.decode('utf-8')
|
||||
if 'fatal' in err_string:
|
||||
sys.exit(0)
|
||||
changed_files = [namestat[0] for namestat in res.splitlines()]
|
||||
staged_files = [namestat[0] for namestat in Popen(['git','diff', '--staged','--name-status'], stdout=PIPE).communicate()[0].splitlines()]
|
||||
nb_changed = len(changed_files) - changed_files.count('U')
|
||||
nb_U = staged_files.count('U')
|
||||
nb_staged = len(staged_files) - nb_U
|
||||
staged = str(nb_staged)
|
||||
conflicts = str(nb_U)
|
||||
changed = str(nb_changed)
|
||||
nb_untracked = len(Popen(['git','ls-files','--others','--exclude-standard'],stdout=PIPE).communicate()[0].splitlines())
|
||||
untracked = str(nb_untracked)
|
||||
if not nb_changed and not nb_staged and not nb_U and not nb_untracked:
|
||||
clean = '1'
|
||||
else:
|
||||
clean = '0'
|
||||
|
||||
remote = ''
|
||||
|
||||
if not branch: # not on any branch
|
||||
branch = symbols['prehash']+ Popen(['git','rev-parse','--short','HEAD'], stdout=PIPE).communicate()[0][:-1]
|
||||
else:
|
||||
remote_name = Popen(['git','config','branch.%s.remote' % branch], stdout=PIPE).communicate()[0].strip()
|
||||
if remote_name:
|
||||
merge_name = Popen(['git','config','branch.%s.merge' % branch], stdout=PIPE).communicate()[0].strip()
|
||||
if remote_name == '.': # local
|
||||
remote_ref = merge_name
|
||||
else:
|
||||
remote_ref = 'refs/remotes/%s/%s' % (remote_name, merge_name[11:])
|
||||
revgit = Popen(['git', 'rev-list', '--left-right', '%s...HEAD' % remote_ref],stdout=PIPE, stderr=PIPE)
|
||||
revlist = revgit.communicate()[0]
|
||||
if revgit.poll(): # fallback to local
|
||||
revlist = Popen(['git', 'rev-list', '--left-right', '%s...HEAD' % merge_name],stdout=PIPE, stderr=PIPE).communicate()[0]
|
||||
behead = revlist.splitlines()
|
||||
ahead = len([x for x in behead if x[0]=='>'])
|
||||
behind = len(behead) - ahead
|
||||
if behind:
|
||||
remote += '%s%s' % (symbols['behind'], behind)
|
||||
if ahead:
|
||||
remote += '%s%s' % (symbols['ahead of'], ahead)
|
||||
|
||||
out = '\n'.join([
|
||||
str(branch),
|
||||
remote,
|
||||
staged,
|
||||
conflicts,
|
||||
changed,
|
||||
untracked,
|
||||
clean])
|
||||
print(out)
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
# To install source this file from your .zshrc file
|
||||
|
||||
# Change this to reflect your installation directory
|
||||
export __GIT_PROMPT_DIR=~/.zsh/git-prompt
|
||||
# Initialize colors.
|
||||
autoload -U colors
|
||||
colors
|
||||
|
||||
# Allow for functions in the prompt.
|
||||
setopt PROMPT_SUBST
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
|
||||
add-zsh-hook chpwd chpwd_update_git_vars
|
||||
add-zsh-hook preexec preexec_update_git_vars
|
||||
add-zsh-hook precmd precmd_update_git_vars
|
||||
|
||||
## Function definitions
|
||||
function preexec_update_git_vars() {
|
||||
case "$2" in
|
||||
git*|hub*|gh*|stg*)
|
||||
__EXECUTED_GIT_COMMAND=1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function precmd_update_git_vars() {
|
||||
if [ -n "$__EXECUTED_GIT_COMMAND" ] || [ -n "$ZSH_THEME_GIT_PROMPT_NOCACHE" ]; then
|
||||
update_current_git_vars
|
||||
unset __EXECUTED_GIT_COMMAND
|
||||
fi
|
||||
}
|
||||
|
||||
function chpwd_update_git_vars() {
|
||||
update_current_git_vars
|
||||
}
|
||||
|
||||
function update_current_git_vars() {
|
||||
unset __CURRENT_GIT_STATUS
|
||||
|
||||
local gitstatus="$__GIT_PROMPT_DIR/gitstatus.py"
|
||||
_GIT_STATUS=`python ${gitstatus}`
|
||||
__CURRENT_GIT_STATUS=("${(@f)_GIT_STATUS}")
|
||||
GIT_BRANCH=$__CURRENT_GIT_STATUS[1]
|
||||
GIT_REMOTE=$__CURRENT_GIT_STATUS[2]
|
||||
GIT_STAGED=$__CURRENT_GIT_STATUS[3]
|
||||
GIT_CONFLICTS=$__CURRENT_GIT_STATUS[4]
|
||||
GIT_CHANGED=$__CURRENT_GIT_STATUS[5]
|
||||
GIT_UNTRACKED=$__CURRENT_GIT_STATUS[6]
|
||||
GIT_CLEAN=$__CURRENT_GIT_STATUS[7]
|
||||
}
|
||||
|
||||
|
||||
git_super_status() {
|
||||
precmd_update_git_vars
|
||||
if [ -n "$__CURRENT_GIT_STATUS" ]; then
|
||||
STATUS="$ZSH_THEME_GIT_PROMPT_PREFIX$ZSH_THEME_GIT_PROMPT_BRANCH$GIT_BRANCH%{${reset_color}%}"
|
||||
if [ -n "$GIT_REMOTE" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_REMOTE$GIT_REMOTE%{${reset_color}%}"
|
||||
fi
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_SEPARATOR"
|
||||
if [ "$GIT_STAGED" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED$GIT_STAGED%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_CONFLICTS" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CONFLICTS$GIT_CONFLICTS%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_CHANGED" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CHANGED$GIT_CHANGED%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_UNTRACKED" -ne "0" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED%{${reset_color}%}"
|
||||
fi
|
||||
if [ "$GIT_CLEAN" -eq "1" ]; then
|
||||
STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||
fi
|
||||
STATUS="$STATUS%{${reset_color}%}$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
echo "$STATUS"
|
||||
fi
|
||||
}
|
||||
|
||||
# Default values for the appearance of the prompt. Configure at will.
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="("
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
|
||||
ZSH_THEME_GIT_PROMPT_SEPARATOR="|"
|
||||
ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_bold[magenta]%}"
|
||||
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[red]%}●"
|
||||
ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[red]%}✖"
|
||||
ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[blue]%}✚"
|
||||
ZSH_THEME_GIT_PROMPT_REMOTE=""
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="…"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✔"
|
||||
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
# Include my bash aliases
|
||||
source ~/.bash_aliases
|
||||
|
||||
source ~/.zsh/git-prompt/zshrc.sh
|
||||
|
||||
bindkey -v
|
||||
|
||||
bindkey '^r' history-incremental-search-backward
|
||||
bindkey '^R' history-incremental-pattern-search-backward
|
||||
#
|
||||
#so as not to be disturbed by Ctrl-S ctrl-Q in terminals:
|
||||
stty -ixon
|
||||
|
||||
# enable color support of ls and also add handy aliases
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
#alias dir='dir --color=auto'
|
||||
#alias vdir='vdir --color=auto'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
fi
|
||||
|
||||
# some more ls aliases
|
||||
alias ls='ls -G'
|
||||
alias ll='ls -alFG'
|
||||
alias la='ls -AG'
|
||||
alias l='ls -CFG'
|
||||
|
||||
|
||||
autoload -U compinit promptinit
|
||||
autoload -U colors && colors
|
||||
compinit
|
||||
promptinit
|
||||
|
||||
setopt AUTO_CD
|
||||
setopt AUTO_PUSHD
|
||||
setopt PUSHD_IGNORE_DUPS
|
||||
setopt PROMPT_SUBST
|
||||
|
||||
# Allow [ or ] whereever you want
|
||||
unsetopt nomatch
|
||||
|
||||
DIRSTACKSIZE=15
|
||||
|
||||
# Enable colors in prompt
|
||||
autoload -U colors && colors
|
||||
|
||||
|
||||
# Git Prompt colors
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg_bold[cyan]%}("
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg_bold[cyan]%})"
|
||||
ZSH_THEME_GIT_PROMPT_SEPARATOR="%{$fg_bold[cyan]%}|"
|
||||
ZSH_THEME_GIT_PROMPT_BRANCH=""
|
||||
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg_bold[green]%}●"
|
||||
ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg_bold[red]%}✖"
|
||||
ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg_bold[red]%}✚"
|
||||
ZSH_THEME_GIT_PROMPT_REMOTE=""
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="…"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[cyan]%}✔"
|
||||
|
||||
|
||||
|
||||
PROMPT='%B%F{green}%~%b%F{white}$(git_super_status)%{$fg_bold[white]%}: '
|
||||
RPROMPT='${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1'
|
||||
|
||||
export KEYTIMEOUT=1
|
||||
|
||||
# Arrow-driven completion
|
||||
zstyle ':completion:*' menu select
|
||||
|
||||
# Complete Aliases
|
||||
setopt completealiases
|
||||
|
||||
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
|
||||
|
||||
### Added by the Heroku Toolbelt
|
||||
export PATH="/usr/local/heroku/bin:$PATH"
|
||||
|
||||
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
|
||||
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
# Dotfiles
|
||||
|
||||
Personal dotfiles for macOS and Linux, managed with [dotbot](https://github.com/anishathalye/dotbot).
|
||||
|
||||
## Structure
|
||||
|
||||
```
|
||||
dotfiles/
|
||||
├── home/ # Config files symlinked into $HOME
|
||||
│ ├── config/ # ~/.config/* (alacritty, tmux, zsh, bash, etc.)
|
||||
│ ├── claude/ # Claude Code config
|
||||
│ ├── bashrc
|
||||
│ ├── gitconfig
|
||||
│ ├── tmux.conf
|
||||
│ ├── vim/
|
||||
│ ├── vimrc
|
||||
│ └── zshenv
|
||||
├── macos/ # macOS-specific: Brewfile, Caskfiles, iTerm2 config
|
||||
├── shell/ # Shell scripts (setup, platform installers, clone, ssh)
|
||||
├── functions/ # Utility scripts
|
||||
├── fonts/ # Fonts
|
||||
├── dotbot/ # Dotbot submodule
|
||||
├── dotbot.default.yaml # Main dotbot config (always applied)
|
||||
├── dotbot.personal.yaml # Personal brew casks
|
||||
├── dotbot.setup-once.yaml # One-time setup (macOS defaults, repo clones)
|
||||
└── install # Main install script
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
# Default setup (symlinks + shell plugins)
|
||||
./install
|
||||
|
||||
# First-time macOS setup (run once: Xcode tools, macOS defaults, clone repos)
|
||||
./install setup-once
|
||||
|
||||
# Personal apps (brew cask installs from Caskfile.personal)
|
||||
./install personal
|
||||
```
|
||||
|
||||
## How It Works
|
||||
|
||||
- `./install` runs dotbot with `dotbot.default.yaml` plus any additional configs passed as arguments
|
||||
- Dotbot creates symlinks from `home/` into `$HOME`, creates directories, and runs shell commands. Folders in `home/config` are symlinked to `~/.config/<folder>`
|
||||
- Platform detection: macOS runs `shell/install_apps_macos.sh`, Linux runs `shell/install_apps_linux.sh`
|
||||
- Submodules: dotbot, tpm, Vundle.vim, and several zsh/bash plugins — run `git submodule update --init --recursive` if anything is missing
|
||||
|
||||
## Important: `.local` files
|
||||
|
||||
Files matching `*.local` (e.g. `.zshrc.local`, `.gitconfig.local`, `.bash_profile.local`) are **machine-specific overrides** that exist only on the local machine. They are gitignored and not part of this repo. Do not modify, reference, or suggest changes to `.local` files.
|
||||
|
||||
## Adding Config for a New Tool
|
||||
|
||||
1. Put the config file under `home/config/<tool>/` or directly in `home/`
|
||||
2. Add a `link:` entry in `dotbot.default.yaml` pointing from the repo path to the target path in `$HOME`
|
||||
3. If it needs a directory created first, add it under `create:` in the same file
|
||||
4. Run `./install` to apply
|
||||
|
||||
## Key Configs
|
||||
|
||||
| File | Linked to |
|
||||
|------|-----------|
|
||||
| `home/zshenv` | `~/.zshenv` |
|
||||
| `home/gitconfig` | `~/.gitconfig` |
|
||||
| `home/config/alacritty/` | `~/.config/alacritty/` |
|
||||
| `home/config/tmux/` | `~/.config/tmux/` |
|
||||
| `home/config/vim/` | `~/.vim/` |
|
||||
| `home/config/zsh/` | `~/.config/zsh/` |
|
||||
| `home/config/bash/` | `~/.config/bash/` |
|
||||
@@ -1,4 +1,29 @@
|
||||
dotfiles
|
||||
========
|
||||
|
||||
Some of my dotfiles
|
||||
Personal dotfiles for macOS and Linux, managed with [dotbot](https://github.com/anishathalye/dotbot).
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
git clone --recursive git@github.com:GeorgeSG/dotfiles.git ~/Git/dotfiles
|
||||
cd ~/Git/dotfiles
|
||||
./install
|
||||
```
|
||||
|
||||
### macOS - first time setup
|
||||
|
||||
```sh
|
||||
# Installs Xcode tools, sets macOS defaults, clones personal repos
|
||||
./install setup-once
|
||||
|
||||
# Installs personal apps (Bitwarden, Discord, Spotify, etc.)
|
||||
./install personal
|
||||
```
|
||||
|
||||
### Linux
|
||||
|
||||
```sh
|
||||
# Default install handles everything - installs apt packages, sets zsh as default shell
|
||||
./install
|
||||
```
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
class BashGitPrompt < Formula
|
||||
desc "Informative, fancy bash prompt for Git users"
|
||||
homepage "https://github.com/magicmonty/bash-git-prompt"
|
||||
url "https://github.com/magicmonty/bash-git-prompt/archive/2.6.1.tar.gz"
|
||||
sha256 "d2e58eaaae521cbcf3758a38cbc9233ea2e24a47dd907e64cdb514f30bd7b9ed"
|
||||
head "https://github.com/magicmonty/bash-git-prompt.git"
|
||||
|
||||
bottle :unneeded
|
||||
|
||||
def install
|
||||
share.install "gitprompt.sh", "gitprompt.fish", "git-prompt-help.sh",
|
||||
"gitstatus.py", "gitstatus.sh", "gitstatus_pre-1.7.10.sh",
|
||||
"prompt-colors.sh"
|
||||
|
||||
(share/"themes").install Dir["themes/*.bgptheme"], "themes/Custom.bgptemplate"
|
||||
doc.install "README.md"
|
||||
end
|
||||
|
||||
def caveats; <<-EOS.undent
|
||||
You should add the following to your .bashrc (or equivalent):
|
||||
if [ -f "$(brew --prefix bash-git-prompt)/share/gitprompt.sh" ]; then
|
||||
GIT_PROMPT_THEME=Default
|
||||
source "$(brew --prefix bash-git-prompt)/share/gitprompt.sh"
|
||||
fi
|
||||
EOS
|
||||
end
|
||||
end
|
||||
@@ -1 +0,0 @@
|
||||
{"used_options":[],"unused_options":[],"built_as_bottle":false,"poured_from_bottle":false,"time":1476791353,"source_modified_time":1475782274,"HEAD":"0296439c832a915be9b73456c0c26bc6c79c271d","stdlib":null,"compiler":"clang","runtime_dependencies":[],"source":{"path":"/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/bash-git-prompt.rb","tap":"homebrew/core","spec":"stable","versions":{"stable":"2.6.1","devel":null,"head":"HEAD","version_scheme":0}}}
|
||||
@@ -1,23 +0,0 @@
|
||||
Copyright (c) 2016, Martin Gondermann
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,359 +0,0 @@
|
||||
# Informative git prompt for bash and fish
|
||||
|
||||
[](https://gitter.im/magicmonty/bash-git-prompt?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
|
||||
This prompt is a port of the "Informative git prompt for zsh" which you can
|
||||
find [here](https://github.com/olivierverdier/zsh-git-prompt)
|
||||
|
||||
A ``bash`` prompt that displays information about the current git repository.
|
||||
In particular the branch name, difference with remote branch, number of files
|
||||
staged, changed, etc.
|
||||
|
||||
(an original idea from this [blog post][]).
|
||||
|
||||
`gitstatus.sh` and `git-prompt-help.sh` added by [AKS](http://github.com/aks).
|
||||
|
||||
# ATTENTION! Breaking changes!
|
||||
|
||||
**If you use this prompt already, please update your `.git-prompt-colors.sh`,
|
||||
if you have one. It now contains a function named `define_git_prompt_colors()` or `override_git_prompt_colors()`!**
|
||||
|
||||
**Please see the ``Custom.bgptemplate`` in the ``themes`` subdirectory of the installation directory!**
|
||||
|
||||
**You can now also use the function `override_git_prompt_colors()`. It should define the variable `GIT_PROMPT_THEME_NAME`
|
||||
and call the function `reload_git_prompt_colors <ThemeName>` like follows:**
|
||||
|
||||
```sh
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="Custom" # needed for reload optimization, should be unique
|
||||
|
||||
# Place your overrides here
|
||||
...
|
||||
}
|
||||
|
||||
# load the theme
|
||||
reload_git_prompt_colors "Custom"
|
||||
```
|
||||
|
||||
The advantage of this approach is, that you only need to specify the parts, that are different to the Default theme.
|
||||
|
||||
---
|
||||
|
||||
**The variable `GIT_PROMPT_SHOW_LAST_COMMAND_INDICATOR` was replaced with a more general placeholder
|
||||
named ``_LAST_COMMAND_INDICATOR_``, which is replaced by the state of the last executed command. It is now activated by default.**
|
||||
|
||||
## Examples
|
||||
|
||||
The prompt may look like the following:
|
||||
|
||||

|
||||
|
||||
* ``(master↑3|✚1)``: on branch ``master``, ahead of remote by 3 commits, 1 file changed but not staged
|
||||
* ``(status|●2)``: on branch ``status``, 2 files staged
|
||||
* ``(master|✚7…)``: on branch ``master``, 7 files changed, some files untracked
|
||||
* ``(master|✖2✚3)``: on branch ``master``, 2 conflicts, 3 files changed
|
||||
* ``(master|⚑2)``: on branch ``master``, 2 stash entries
|
||||
* ``(experimental↓2↑3|✔)``: on branch ``experimental``; your branch has diverged by 3 commits, remote by 2 commits; the repository is otherwise clean
|
||||
* ``(:70c2952|✔)``: not on any branch; parent commit has hash ``70c2952``; the repository is otherwise clean
|
||||
|
||||
## Prompt Structure
|
||||
|
||||
By default, the general appearance of the prompt is::
|
||||
|
||||
(<branch> <upstream branch> <branch tracking>|<local status>)
|
||||
|
||||
The symbols are as follows:
|
||||
|
||||
- Local Status Symbols
|
||||
- ``✔``: repository clean
|
||||
- ``●n``: there are ``n`` staged files
|
||||
- ``✖n``: there are ``n`` files with merge conflicts
|
||||
- ``✚n``: there are ``n`` changed but *unstaged* files
|
||||
- ``…n``: there are ``n`` untracked files
|
||||
- ``⚑n``: there are ``n`` stash entries
|
||||
- Upstream branch
|
||||
- Shows the remote tracking branch
|
||||
- Disabled by default
|
||||
- Enable by setting GIT_PROMPT_SHOW_UPSTREAM=1
|
||||
- Branch Tracking Symbols
|
||||
- ``↑n``: ahead of remote by ``n`` commits
|
||||
- ``↓n``: behind remote by ``n`` commits
|
||||
- ``↓m↑n``: branches diverged, other by ``m`` commits, yours by ``n`` commits
|
||||
- ``L``: local branch, not remotely tracked
|
||||
- Branch Symbol:<br />
|
||||
When the branch name starts with a colon ``:``, it means it's actually a hash, not a branch (although it should be pretty clear, unless you name your branches like hashes :-)
|
||||
|
||||
## Installation
|
||||
|
||||
### via [Homebrew][homebrew] on Mac OS X
|
||||
|
||||
- Run `brew update`
|
||||
|
||||
- Run `brew install bash-git-prompt` for the last stable release or `brew install --HEAD bash-git-prompt` for the
|
||||
latest version directly from the repository
|
||||
|
||||
- Now you can source the file in your `~/.bash_profile` as follows:
|
||||
|
||||
```sh
|
||||
if [ -f "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh" ]; then
|
||||
source "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh"
|
||||
fi
|
||||
```
|
||||
|
||||
### via Git clone
|
||||
|
||||
- Clone this repository to your home directory.
|
||||
|
||||
```sh
|
||||
cd ~
|
||||
git clone https://github.com/magicmonty/bash-git-prompt.git .bash-git-prompt --depth=1
|
||||
```
|
||||
|
||||
Add to the `~/.bashrc`:
|
||||
```
|
||||
GIT_PROMPT_ONLY_IN_REPO=1
|
||||
source ~/.bash-git-prompt/gitprompt.sh
|
||||
```
|
||||
|
||||
### All configs for .bashrc
|
||||
|
||||
```sh
|
||||
|
||||
# Set config variables first
|
||||
GIT_PROMPT_ONLY_IN_REPO=1
|
||||
|
||||
# GIT_PROMPT_FETCH_REMOTE_STATUS=0 # uncomment to avoid fetching remote status
|
||||
|
||||
# GIT_PROMPT_SHOW_UPSTREAM=1 # uncomment to show upstream tracking branch
|
||||
# GIT_PROMPT_SHOW_UNTRACKED_FILES=all # can be no, normal or all; determines counting of untracked files
|
||||
|
||||
# GIT_PROMPT_SHOW_CHANGED_FILES_COUNT=0 # uncomment to avoid printing the number of changed files
|
||||
|
||||
# GIT_PROMPT_STATUS_COMMAND=gitstatus_pre-1.7.10.sh # uncomment to support Git older than 1.7.10
|
||||
|
||||
# GIT_PROMPT_START=... # uncomment for custom prompt start sequence
|
||||
# GIT_PROMPT_END=... # uncomment for custom prompt end sequence
|
||||
|
||||
# as last entry source the gitprompt script
|
||||
# GIT_PROMPT_THEME=Custom # use custom theme specified in file GIT_PROMPT_THEME_FILE (default ~/.git-prompt-colors.sh)
|
||||
# GIT_PROMPT_THEME_FILE=~/.git-prompt-colors.sh
|
||||
# GIT_PROMPT_THEME=Solarized # use theme optimized for solarized color scheme
|
||||
source ~/.bash-git-prompt/gitprompt.sh
|
||||
```
|
||||
|
||||
You can set the `GIT_PROMPT_SHOW_UNTRACKED_FILES` variable to `no` or `normal` to speed things up if you have lots of
|
||||
untracked files in your repository. This can be the case for build systems that put their build artifacts in
|
||||
the subdirectory structure of the git repository.
|
||||
|
||||
- `cd` to a git repository and test it!
|
||||
|
||||
#### Themes
|
||||
|
||||
The most settings are now stored in theme files. To select a theme, set the variable `GIT_PROMPT_THEME` to the name
|
||||
of the theme located in `<INSTALLDIR>/themes` without the extension `.bgptheme` like this:
|
||||
|
||||
```sh
|
||||
GIT_PROMPT_THEME=Solarized
|
||||
```
|
||||
|
||||
If you set `GIT_PROMPT_THEME` to `Custom`, then the `.git-prompt-colors.sh` in the home directory will be used.
|
||||
This file can now be generated with the command `git_prompt_make_custom_theme [<Name of base theme>]`. If the name of
|
||||
the base theme is ommitted or the theme file is not found, then the Default theme is used. If you have already a custom
|
||||
`.git-prompt-colors.sh` in your home directory, a error message will be shown.
|
||||
|
||||
You can display a list of available themes with `git_prompt_list_themes` (the current theme is highlighted)
|
||||
|
||||
**If you omit the `GIT_PROMPT_THEME` variable, the Default theme is used or, if you have a custom `.git-prompt-colors.sh`
|
||||
in your home directory, then the Custom theme is used.**
|
||||
|
||||
##### Ubuntu Themes
|
||||
|
||||
Ubuntu requires a bit more spacing for some characters so it has its own themes.
|
||||
|
||||
These can be listed with `git_prompt_list_themes`:
|
||||
```sh
|
||||
git_prompt_list_themes | grep Ubuntu
|
||||
```
|
||||
|
||||
##### Theme structure
|
||||
|
||||
Please see the ``Custom.bgptemplate`` in the ``themes`` subdirectory of the installation directory!
|
||||
|
||||
A theme consists of a function `override_git_prompt_colors()` which defines at least the variable `GIT_PROMPT_THEME_NAME`
|
||||
with a unique theme identifier and a call to the function `reload_git_prompt_colors <ThemeName>` like follows:
|
||||
|
||||
```sh
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="Custom" # needed for reload optimization, should be unique
|
||||
|
||||
# Place your overrides here
|
||||
...
|
||||
}
|
||||
|
||||
# load the theme
|
||||
reload_git_prompt_colors "Custom"
|
||||
```
|
||||
|
||||
The advantage of this approach is, that you only need to specify the parts, that are different to the Default theme.
|
||||
|
||||
If you use a custom theme in `.git-prompt-colors.sh`, please set `GIT_PROMPT_THEME_NAME="Custom"`.
|
||||
|
||||
#### Further customizations
|
||||
|
||||
- You can define `GIT_PROMPT_START` and `GIT_PROMPT_END` to tweak your prompt.
|
||||
|
||||
- The default colors are defined within `prompt-colors.sh`, which is sourced by
|
||||
`gitprompt.sh`. The colors used for various git status are defined in
|
||||
`themes/Default.bgptheme`. Both of these files may be overridden by copying
|
||||
them to $HOME with a `.` prefix. They can also be placed in `$HOME/lib`
|
||||
without the leading `.`. The defaults are the original files in the
|
||||
`~/.bash-git-prompt` directory.
|
||||
|
||||
- You can use `GIT_PROMPT_START_USER`, `GIT_PROMPT_START_ROOT`,
|
||||
`GIT_PROMPT_END_USER` and `GIT_PROMPT_END_ROOT` in your
|
||||
`.git-prompt-colors.sh` to tweak your prompt. You can also override the start
|
||||
and end of the prompt by setting `GIT_PROMPT_START` and `GIT_PROMPT_END`
|
||||
before you source the `gitprompt.sh`.
|
||||
|
||||
- The current git repo information is obtained by the script `gitstatus.sh`.
|
||||
- You can define `prompt_callback` function to tweak your prompt dynamically.
|
||||
|
||||
```sh
|
||||
function prompt_callback {
|
||||
if [ `jobs | wc -l` -ne 0 ]; then
|
||||
echo -n " jobs:\j"
|
||||
fi
|
||||
}
|
||||
```
|
||||
|
||||
- There are two helper functions that can be used within `prompt_callback`:
|
||||
- `gp_set_window_title <String>` - sets the window title to the given string (should work for XTerm type terminals like in OS X or Ubuntu)
|
||||
- `gp_truncate_pwd` - a function that returns the current PWD truncated to fit the current terminal width
|
||||
|
||||
- If you want to show the git prompt only if you are in a git repository you
|
||||
can set ``GIT_PROMPT_ONLY_IN_REPO=1`` before sourcing the gitprompt script
|
||||
|
||||
- There is an indicator at the start of the prompt, which shows
|
||||
the result of the last executed command by if you put the placeholder
|
||||
`_LAST_COMMAND_INDICATOR_` in any of the prompt templates.
|
||||
It is now by default activated in the default theme:
|
||||
|
||||
```sh
|
||||
GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${Yellow}${PathShort}${ResetColor}"
|
||||
GIT_PROMPT_START_ROOT="_LAST_COMMAND_INDICATOR_ ${GIT_PROMPT_START_USER}"
|
||||
```
|
||||
|
||||
If you want to display the exit code too, you can use the placeholder
|
||||
``_LAST_COMMAND_STATE_`` in ``GIT_PROMPT_COMMAND_OK`` or ``GIT_PROMPT_COMMAND_FAIL``
|
||||
in your ``.git-prompt-colors.sh``:
|
||||
|
||||
```sh
|
||||
GIT_PROMPT_COMMAND_OK="${Green}✔ " # displays as ✔
|
||||
GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_ " # displays as ✘-1 for exit code 1
|
||||
```
|
||||
|
||||
- It is now possible to disable the fetching of the remote repository either
|
||||
globally by setting ``GIT_PROMPT_FETCH_REMOTE_STATUS=0`` in your .bashrc or
|
||||
on a per repository basis by creating a file named ``.bash-git-rc`` with the
|
||||
content ``FETCH_REMOTE_STATUS=0`` in the root of your git repository.
|
||||
|
||||
- You can also ignore a repository completely by creating a file named ``.bash-git-rc`` with the
|
||||
content ``GIT_PROMPT_IGNORE=1`` in the root of your git repository.
|
||||
|
||||
- If you have a repository with many untracked files, the git prompt can become very slow.
|
||||
You can disable the display of untracked files on a per repository basis by setting
|
||||
``GIT_PROMPT_SHOW_UNTRACKED_FILES=no`` in your ``.bash-git-rc`` in the repository or
|
||||
by disabling it globally in your ``.bashrc``
|
||||
|
||||
- You can get help on the git prompt with the function ``git_prompt_help``.
|
||||
Examples are available with ``git_prompt_examples``.
|
||||
A list of all available named colors is available with `git_prompt_color_samples`
|
||||
|
||||
- If you make any changes to any file that is sourced by `gitprompt.sh`, you
|
||||
should run this command, so that the next prompt update will find all the
|
||||
files and source them anew.
|
||||
|
||||
```sh
|
||||
git_prompt_reset
|
||||
```
|
||||
|
||||
- You can disable/enable gitprompt by runnning:
|
||||
|
||||
```sh
|
||||
git_prompt_toggle
|
||||
```
|
||||
|
||||
|
||||
**Enjoy!**
|
||||
|
||||
## Alternative RPM Install
|
||||
|
||||
This project ships an RPM spec to simplify installation on RHEL and
|
||||
clones. If you wish to install from RPM, you may first build the RPM
|
||||
from scratch by following this procedure:
|
||||
* Clone this repository and tag the release with a version number
|
||||
|
||||
````sh
|
||||
git tag -a -m "Tag release 1.1" 1.1
|
||||
````
|
||||
|
||||
* Run the following command to create a tarball:
|
||||
|
||||
````sh
|
||||
VER=$(git describe)
|
||||
# replace dash with underscore to work around
|
||||
# rpmbuild does not allow dash in version string
|
||||
VER=${VER//\-/_}
|
||||
git archive \
|
||||
--format tar \
|
||||
--prefix=bash-git-prompt-${VER}/ \
|
||||
HEAD \
|
||||
-- *.sh \
|
||||
*.fish \
|
||||
README.md \
|
||||
themes \
|
||||
> bash-git-prompt-${VER}.tar
|
||||
mkdir -p /tmp/bash-git-prompt-${VER}
|
||||
sed "s/Version:.*/Version: ${VER}/" \
|
||||
bash-git-prompt.spec \
|
||||
> /tmp/bash-git-prompt-${VER}/bash-git-prompt.spec
|
||||
OLDDIR=$(pwd)
|
||||
cd /tmp
|
||||
tar -uf ${OLDDIR}/bash-git-prompt-${VER}.tar \
|
||||
bash-git-prompt-${VER}/bash-git-prompt.spec
|
||||
cd ${OLDDIR}
|
||||
gzip bash-git-prompt-${VER}.tar
|
||||
mv bash-git-prompt-${VER}.tar.gz bash-git-prompt-${VER}.tgz
|
||||
````
|
||||
|
||||
* Log into an RHEL or clones host and run:
|
||||
|
||||
````sh
|
||||
rpmbuild -ta bash-git-prompt-xxx.tar.gz
|
||||
````
|
||||
Then you may publish or install the rpm from "~/rpmbuild/RPMS/noarch".
|
||||
|
||||
## License
|
||||
This code is under the [BSD 2 Clause (NetBSD) license][license].
|
||||
|
||||
## Who Are You?
|
||||
The current maintainer of the original bash-git-prompt is [Martin Gondermann][magicmonty].
|
||||
|
||||
## Contributing
|
||||
If you want to contribute you can look for issues with the label [up-for-grabs][upforgrabs].
|
||||
Please leave a comment on the issue, that you want to fix it, so others know, the labels are "taken".
|
||||
|
||||
Pull requests are welcome. I will check them and merge them, if I think they help the project.
|
||||
|
||||
## Donations
|
||||
I accept tips through [Flattr][flattr].
|
||||
|
||||
[](https://flattr.com/submit/auto?user_id=magicmonty&url=https%3A%2F%2Fgithub.com%2Fmagicmonty%2Fbash-git-prompt)
|
||||
|
||||
[blog post]: http://sebastiancelis.com/2009/nov/16/zsh-prompt-git-users/
|
||||
[tip]:https://www.gittip.com/magicmonty/
|
||||
[magicmonty]: http://blog.pagansoft.de/pages/about.html
|
||||
[license]:https://github.com/magicmonty/bash-git-prompt/tree/master/LICENSE.txt
|
||||
[flattr]: https://flattr.com/submit/auto?user_id=magicmonty&url=https%3A%2F%2Fgithub.com%2Fmagicmonty%2Fbash-git-prompt
|
||||
[homebrew]: http://brew.sh/
|
||||
[upforgrabs]: https://github.com/magicmonty/bash-git-prompt/labels/up-for-grabs
|
||||
@@ -1,76 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# git-prompt-help -- show useful info to help new users with the information
|
||||
# being displayed.
|
||||
|
||||
git_prompt_help() {
|
||||
source ${__GIT_PROMPT_DIR}/prompt-colors.sh
|
||||
source ${__GIT_PROMPT_DIR}/themes/Default.bgptheme
|
||||
cat <<EOF | sed 's/\\\[\\033//g' | sed 's/\\\]//g'
|
||||
The git prompt format is ${GIT_PROMPT_PREFIX}<BRANCH><TRACKING>${GIT_PROMPT_SEPARATOR}<LOCALSTATUS>${GIT_PROMPT_SUFFIX}
|
||||
|
||||
BRANCH is a branch name, such as "master" or "stage", a tag name, or commit
|
||||
hash prefixed with ':'.
|
||||
|
||||
TRACKING indicates how the local branch differs from the
|
||||
remote branch. It can be empty, or one of:
|
||||
|
||||
${GIT_PROMPT_BRANCH}${ResetColor}${GIT_PROMPT_REMOTE}${GIT_PROMPT_SYMBOLS_AHEAD}N${ResetColor} - ahead of remote by N commits
|
||||
${GIT_PROMPT_BRANCH}${ResetColor}${GIT_PROMPT_REMOTE}${GIT_PROMPT_SYMBOLS_BEHIND}M${ResetColor} - behind remote by M commits
|
||||
${GIT_PROMPT_BRANCH}${ResetColor}${GIT_PROMPT_REMOTE}${GIT_PROMPT_SYMBOLS_AHEAD}N${GIT_PROMPT_SYMBOLS_BEHIND}M${ResetColor} - branches diverged, other by M commits, yours by N commits
|
||||
|
||||
LOCALSTATUS is one of the following:
|
||||
|
||||
${GIT_PROMPT_CLEAN}${ResetColor} - repository clean
|
||||
${GIT_PROMPT_STAGED}N${ResetColor} - N staged files
|
||||
${GIT_PROMPT_CONFLICTS}N${ResetColor} - N files with merge conflicts
|
||||
${GIT_PROMPT_CHANGED}N${ResetColor} - N changed but *unstaged* files
|
||||
${GIT_PROMPT_UNTRACKED}N${ResetColor} - N untracked files
|
||||
${GIT_PROMPT_STASHED}N${ResetColor} - N stash entries
|
||||
|
||||
See "git_prompt_examples" for examples.
|
||||
EOF
|
||||
}
|
||||
|
||||
help_git_prompt() { git_prompt_help ; }
|
||||
|
||||
git_prompt_examples() {
|
||||
cat <<EOF | sed 's/\\\[\\033//g' | sed 's/\\\]//g'
|
||||
These are examples of the git prompt:
|
||||
|
||||
[${GIT_PROMPT_BRANCH}master${ResetColor}${GIT_PROMPT_REMOTE}↑·3${ResetColor}|${GIT_PROMPT_CHANGED}1${ResetColor}] - on branch "master", ahead of remote by 3 commits, 1
|
||||
file changed but not staged
|
||||
|
||||
[${GIT_PROMPT_BRANCH}status${ResetColor}|${GIT_PROMPT_STAGED}2${ResetColor}] - on branch "status", 2 files staged
|
||||
|
||||
[${GIT_PROMPT_BRANCH}master${ResetColor}|${GIT_PROMPT_CHANGED}7${GIT_PROMPT_UNTRACKED}${ResetColor}] - on branch "master", 7 files changed, some files untracked
|
||||
|
||||
[${GIT_PROMPT_BRANCH}master${ResetColor}|${GIT_PROMPT_CONFLICTS}2${GIT_PROMPT_CHANGED}3${ResetColor}] - on branch "master", 2 conflicts, 3 files changed
|
||||
|
||||
[${GIT_PROMPT_BRANCH}master${ResetColor}|${GIT_PROMPT_STASHED}2${ResetColor}] - on branch "master", 2 stash entries
|
||||
|
||||
[${GIT_PROMPT_BRANCH}experimental${ResetColor}${GIT_PROMPT_REMOTE}↓·2↑·3${ResetColor}|${GIT_PROMPT_CLEAN}${ResetColor}]
|
||||
- on branch "experimental"; your branch has diverged
|
||||
by 3 commits, remote by 2 commits; the repository is
|
||||
otherwise clean
|
||||
|
||||
[${GIT_PROMPT_BRANCH}:70c2952${ResetColor}|${GIT_PROMPT_CLEAN}${ResetColor}] - not on any branch; parent commit has hash "70c2952"; the
|
||||
repository is otherwise clean
|
||||
EOF
|
||||
}
|
||||
|
||||
git_prompt_color_samples() {
|
||||
|
||||
showColor() {
|
||||
local color=$(eval echo "\${$1}")
|
||||
echo -e "${color}$1${ResetColor}" | sed 's/\\\]//g' | sed 's/\\\[//g'
|
||||
}
|
||||
|
||||
local x=0
|
||||
while (( x < 8 )) ; do
|
||||
showColor ${ColorNames[x]}
|
||||
showColor "Dim${ColorNames[x]}"
|
||||
showColor "Bold${ColorNames[x]}"
|
||||
showColor "Bright${ColorNames[x]}"
|
||||
(( x++ ))
|
||||
done
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
if not set -q __GIT_PROMPT_DIR
|
||||
set __GIT_PROMPT_DIR ~/.gitprompt
|
||||
end
|
||||
|
||||
# Colors
|
||||
# Reset
|
||||
set ResetColor (set_color normal) # Text Reset
|
||||
|
||||
# Regular Colors
|
||||
set Red (set_color red) # Red
|
||||
set Yellow (set_color yellow); # Yellow
|
||||
set Blue (set_color blue) # Blue
|
||||
set WHITE (set_color white)
|
||||
|
||||
# Bold
|
||||
set BGreen (set_color -o green) # Green
|
||||
|
||||
# High Intensty
|
||||
set IBlack (set_color -o black) # Black
|
||||
|
||||
# Bold High Intensty
|
||||
set Magenta (set_color -o purple) # Purple
|
||||
|
||||
# Default values for the appearance of the prompt. Configure at will.
|
||||
set GIT_PROMPT_PREFIX "["
|
||||
set GIT_PROMPT_SUFFIX "]"
|
||||
set GIT_PROMPT_SEPARATOR "|"
|
||||
set GIT_PROMPT_BRANCH "$Magenta"
|
||||
set GIT_PROMPT_STAGED "$Red● "
|
||||
set GIT_PROMPT_CONFLICTS "$Red✖ "
|
||||
set GIT_PROMPT_CHANGED "$Blue✚ "
|
||||
set GIT_PROMPT_REMOTE " "
|
||||
set GIT_PROMPT_UNTRACKED "…"
|
||||
set GIT_PROMPT_STASHED "⚑ "
|
||||
set GIT_PROMPT_CLEAN "$BGreen✔"
|
||||
|
||||
function fish_prompt
|
||||
|
||||
# Various variables you might want for your PS1 prompt instead
|
||||
set Time (date +%R)
|
||||
set PathShort (pwd|sed "s=$HOME=~=")
|
||||
|
||||
set PROMPT_START "$Yellow$PathShort$ResetColor"
|
||||
set PROMPT_END " \n$WHITE$Time$ResetColor \$ "
|
||||
|
||||
set -e __CURRENT_GIT_STATUS
|
||||
set gitstatus "$__GIT_PROMPT_DIR/gitstatus.py"
|
||||
|
||||
set _GIT_STATUS (python $gitstatus)
|
||||
set __CURRENT_GIT_STATUS $_GIT_STATUS
|
||||
|
||||
set __CURRENT_GIT_STATUS_PARAM_COUNT (count $__CURRENT_GIT_STATUS)
|
||||
|
||||
if not test "0" -eq $__CURRENT_GIT_STATUS_PARAM_COUNT
|
||||
set GIT_BRANCH $__CURRENT_GIT_STATUS[1]
|
||||
set GIT_REMOTE "$__CURRENT_GIT_STATUS[2]"
|
||||
if contains "." "$GIT_REMOTE"
|
||||
set -e GIT_REMOTE
|
||||
end
|
||||
set GIT_STAGED $__CURRENT_GIT_STATUS[3]
|
||||
set GIT_CONFLICTS $__CURRENT_GIT_STATUS[4]
|
||||
set GIT_CHANGED $__CURRENT_GIT_STATUS[5]
|
||||
set GIT_UNTRACKED $__CURRENT_GIT_STATUS[6]
|
||||
set GIT_STASHED $__CURRENT_GIT_STATUS[7]
|
||||
set GIT_CLEAN $__CURRENT_GIT_STATUS[8]
|
||||
end
|
||||
|
||||
if test -n "$__CURRENT_GIT_STATUS"
|
||||
set STATUS " $GIT_PROMPT_PREFIX$GIT_PROMPT_BRANCH$GIT_BRANCH$ResetColor"
|
||||
|
||||
if set -q GIT_REMOTE
|
||||
set STATUS "$STATUS$GIT_PROMPT_REMOTE$GIT_REMOTE$ResetColor"
|
||||
end
|
||||
|
||||
set STATUS "$STATUS$GIT_PROMPT_SEPARATOR"
|
||||
|
||||
if [ $GIT_STAGED != "0" ]
|
||||
set STATUS "$STATUS$GIT_PROMPT_STAGED$GIT_STAGED$ResetColor"
|
||||
end
|
||||
|
||||
if [ $GIT_CONFLICTS != "0" ]
|
||||
set STATUS "$STATUS$GIT_PROMPT_CONFLICTS$GIT_CONFLICTS$ResetColor"
|
||||
end
|
||||
|
||||
if [ $GIT_CHANGED != "0" ]
|
||||
set STATUS "$STATUS$GIT_PROMPT_CHANGED$GIT_CHANGED$ResetColor"
|
||||
end
|
||||
|
||||
if [ "$GIT_UNTRACKED" != "0" ]
|
||||
set STATUS "$STATUS$GIT_PROMPT_UNTRACKED$GIT_UNTRACKED$ResetColor"
|
||||
end
|
||||
|
||||
if [ "$GIT_STASHED" != "0" ]
|
||||
set STATUS "$STATUS$GIT_PROMPT_STASHED$GIT_STASHED$ResetColor"
|
||||
end
|
||||
|
||||
if [ "$GIT_CLEAN" = "1" ]
|
||||
set STATUS "$STATUS$GIT_PROMPT_CLEAN"
|
||||
end
|
||||
|
||||
set STATUS "$STATUS$ResetColor$GIT_PROMPT_SUFFIX"
|
||||
|
||||
set PS1 "$PROMPT_START$STATUS$PROMPT_END"
|
||||
else
|
||||
set PS1 "$PROMPT_START$PROMPT_END"
|
||||
end
|
||||
|
||||
echo -e $PS1
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -1,651 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function async_run() {
|
||||
{
|
||||
eval "$@" &> /dev/null
|
||||
}&
|
||||
}
|
||||
|
||||
function git_prompt_dir() {
|
||||
# assume the gitstatus.sh is in the same directory as this script
|
||||
# code thanks to http://stackoverflow.com/questions/59895
|
||||
if [ -z "$__GIT_PROMPT_DIR" ]; then
|
||||
local SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ]; do
|
||||
local DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
|
||||
done
|
||||
__GIT_PROMPT_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
fi
|
||||
}
|
||||
|
||||
function echoc() {
|
||||
echo -e "${1}$2${ResetColor}" | sed 's/\\\]//g' | sed 's/\\\[//g'
|
||||
}
|
||||
|
||||
function get_theme() {
|
||||
local CUSTOM_THEME_FILE="${HOME}/.git-prompt-colors.sh"
|
||||
if [[ ! (-z ${GIT_PROMPT_THEME_FILE} ) ]]; then
|
||||
CUSTOM_THEME_FILE=$GIT_PROMPT_THEME_FILE
|
||||
fi
|
||||
local DEFAULT_THEME_FILE="${__GIT_PROMPT_DIR}/themes/Default.bgptheme"
|
||||
|
||||
if [[ -z ${GIT_PROMPT_THEME} ]]; then
|
||||
if [[ -r $CUSTOM_THEME_FILE ]]; then
|
||||
GIT_PROMPT_THEME="Custom"
|
||||
__GIT_PROMPT_THEME_FILE=$CUSTOM_THEME_FILE
|
||||
else
|
||||
GIT_PROMPT_THEME="Default"
|
||||
__GIT_PROMPT_THEME_FILE=$DEFAULT_THEME_FILE
|
||||
fi
|
||||
else
|
||||
if [[ "${GIT_PROMPT_THEME}" = "Custom" ]]; then
|
||||
GIT_PROMPT_THEME="Custom"
|
||||
__GIT_PROMPT_THEME_FILE=$CUSTOM_THEME_FILE
|
||||
|
||||
if [[ ! (-r $__GIT_PROMPT_THEME_FILE) ]]; then
|
||||
GIT_PROMPT_THEME="Default"
|
||||
__GIT_PROMPT_THEME_FILE=$DEFAULT_THEME_FILE
|
||||
fi
|
||||
else
|
||||
local theme=""
|
||||
|
||||
# use default theme, if theme was not found
|
||||
for themefile in "${__GIT_PROMPT_DIR}/themes/"*.bgptheme; do
|
||||
local basename=${themefile##*/}
|
||||
if [[ "${basename%.bgptheme}" = "${GIT_PROMPT_THEME}" ]]; then
|
||||
theme=$GIT_PROMPT_THEME
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "${theme}" = "" ]]; then
|
||||
GIT_PROMPT_THEME="Default"
|
||||
fi
|
||||
|
||||
__GIT_PROMPT_THEME_FILE="${__GIT_PROMPT_DIR}/themes/${GIT_PROMPT_THEME}.bgptheme"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function git_prompt_load_colors() {
|
||||
if gp_set_file_var __PROMPT_COLORS_FILE prompt-colors.sh ; then
|
||||
# outsource the color defs
|
||||
source "$__PROMPT_COLORS_FILE"
|
||||
else
|
||||
echo 1>&2 "Cannot find prompt-colors.sh!"
|
||||
fi
|
||||
}
|
||||
|
||||
function git_prompt_load_theme() {
|
||||
get_theme
|
||||
local DEFAULT_THEME_FILE="${__GIT_PROMPT_DIR}/themes/Default.bgptheme"
|
||||
source "${DEFAULT_THEME_FILE}"
|
||||
source "${__GIT_PROMPT_THEME_FILE}"
|
||||
}
|
||||
|
||||
function git_prompt_list_themes() {
|
||||
git_prompt_load_colors
|
||||
git_prompt_dir
|
||||
get_theme
|
||||
|
||||
for themefile in "${__GIT_PROMPT_DIR}/themes/"*.bgptheme; do
|
||||
local basename=${themefile##*/}
|
||||
local theme="${basename%.bgptheme}"
|
||||
if [[ "${GIT_PROMPT_THEME}" = "${theme}" ]]; then
|
||||
echoc ${Red} "*${theme}"
|
||||
else
|
||||
echo $theme
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "${GIT_PROMPT_THEME}" = "Custom" ]]; then
|
||||
echoc ${Magenta} "*Custom"
|
||||
else
|
||||
echoc ${Blue} "Custom"
|
||||
fi
|
||||
}
|
||||
|
||||
function git_prompt_make_custom_theme() {
|
||||
if [[ -r "${HOME}/.git-prompt-colors.sh" ]]; then
|
||||
echoc ${Red} "You alread have created a custom theme!"
|
||||
else
|
||||
git_prompt_dir
|
||||
|
||||
local base="Default"
|
||||
if [[ -n $1 && -r "${__GIT_PROMPT_DIR}/themes/${1}.bgptheme" ]]; then
|
||||
base=$1
|
||||
echoc ${Green} "Using theme ${Magenta}\"${base}\"${Green} as base theme!"
|
||||
else
|
||||
echoc ${Green} "Using theme ${Magenta}\"Default\"${Green} as base theme!"
|
||||
fi
|
||||
|
||||
if [[ "${base}" = "Custom" ]]; then
|
||||
echoc ${Red} "You cannot use the custom theme as base"
|
||||
else
|
||||
echoc ${Green} "Creating new custom theme in \"${HOME}/.git-prompt-colors.sh\""
|
||||
echoc ${DimYellow} "Please add ${Magenta}\"GIT_PROMPT_THEME=Custom\"${DimYellow} to your .bashrc to use this theme"
|
||||
if [[ "${base}" == "Default" ]]; then
|
||||
cp "${__GIT_PROMPT_DIR}/themes/Custom.bgptemplate" "${HOME}/.git-prompt-colors.sh"
|
||||
else
|
||||
cp "${__GIT_PROMPT_DIR}/themes/${base}.bgptheme" "${HOME}/.git-prompt-colors.sh"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# gp_set_file_var ENVAR SOMEFILE
|
||||
#
|
||||
# If ENVAR is set, check that it's value exists as a readable file. Otherwise,
|
||||
# Set ENVAR to the path to SOMEFILE, based on $HOME, $__GIT_PROMPT_DIR, and the
|
||||
# directory of the current script. The SOMEFILE can be prefixed with '.', or
|
||||
# not.
|
||||
#
|
||||
# Return 0 (success) if ENVAR not already defined, 1 (failure) otherwise.
|
||||
|
||||
function gp_set_file_var() {
|
||||
local envar="$1"
|
||||
local file="$2"
|
||||
if eval "[[ -n \"\$$envar\" && -r \"\$$envar\" ]]" ; then # is envar set to a readable file?
|
||||
local basefile
|
||||
eval "basefile=\"\`basename \\\"\$$envar\\\"\`\"" # assign basefile
|
||||
if [[ "$basefile" = "$file" || "$basefile" = ".$file" ]]; then
|
||||
return 0
|
||||
fi
|
||||
else # envar is not set, or it's set to a different file than requested
|
||||
eval "$envar=" # set empty envar
|
||||
gp_maybe_set_envar_to_path "$envar" "$HOME/.$file" "$HOME/$file" "$HOME/lib/$file" && return 0
|
||||
git_prompt_dir
|
||||
gp_maybe_set_envar_to_path "$envar" "$__GIT_PROMPT_DIR/$file" "${0##*/}/$file" && return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
# gp_maybe_set_envar_to_path ENVAR FILEPATH ...
|
||||
#
|
||||
# return 0 (true) if any FILEPATH is readable, set ENVAR to it
|
||||
# return 1 (false) if not
|
||||
|
||||
function gp_maybe_set_envar_to_path() {
|
||||
local envar="$1"
|
||||
shift
|
||||
local file
|
||||
for file in "$@" ; do
|
||||
if [[ -r "$file" ]]; then
|
||||
eval "$envar=\"$file\""
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# git_prompt_reset
|
||||
#
|
||||
# unsets selected GIT_PROMPT variables, causing the next prompt callback to
|
||||
# recalculate them from scratch.
|
||||
|
||||
git_prompt_reset() {
|
||||
local var
|
||||
for var in GIT_PROMPT_DIR __GIT_PROMPT_COLORS_FILE __PROMPT_COLORS_FILE __GIT_STATUS_CMD GIT_PROMPT_THEME_NAME; do
|
||||
unset $var
|
||||
done
|
||||
}
|
||||
|
||||
# gp_format_exit_status RETVAL
|
||||
#
|
||||
# echos the symbolic signal name represented by RETVAL if the process was
|
||||
# signalled, otherwise echos the original value of RETVAL
|
||||
|
||||
gp_format_exit_status() {
|
||||
local RETVAL="$1"
|
||||
local SIGNAL
|
||||
# Suppress STDERR in case RETVAL is not an integer (in such cases, RETVAL
|
||||
# is echoed verbatim)
|
||||
if [ "${RETVAL}" -gt 128 ] 2>/dev/null; then
|
||||
SIGNAL=$(( ${RETVAL} - 128 ))
|
||||
kill -l "${SIGNAL}" 2>/dev/null || echo "${RETVAL}"
|
||||
else
|
||||
echo "${RETVAL}"
|
||||
fi
|
||||
}
|
||||
|
||||
function git_prompt_config() {
|
||||
#Checking if root to change output
|
||||
_isroot=false
|
||||
[[ $UID -eq 0 ]] && _isroot=true
|
||||
|
||||
# There are two files related to colors:
|
||||
#
|
||||
# prompt-colors.sh -- sets generic color names suitable for bash 'PS1' prompt
|
||||
# git-prompt-colors.sh -- sets the GIT_PROMPT color scheme, using names from prompt-colors.sh
|
||||
|
||||
git_prompt_load_colors
|
||||
|
||||
# source the user's ~/.git-prompt-colors.sh file, or the one that should be
|
||||
# sitting in the same directory as this script
|
||||
|
||||
git_prompt_load_theme
|
||||
|
||||
if is_function prompt_callback; then
|
||||
prompt_callback="prompt_callback"
|
||||
else
|
||||
prompt_callback="prompt_callback_default"
|
||||
fi
|
||||
|
||||
if [ $GIT_PROMPT_LAST_COMMAND_STATE = 0 ]; then
|
||||
LAST_COMMAND_INDICATOR="$GIT_PROMPT_COMMAND_OK";
|
||||
else
|
||||
LAST_COMMAND_INDICATOR="$GIT_PROMPT_COMMAND_FAIL";
|
||||
fi
|
||||
|
||||
# replace _LAST_COMMAND_STATE_ token with the actual state
|
||||
GIT_PROMPT_LAST_COMMAND_STATE=$(gp_format_exit_status ${GIT_PROMPT_LAST_COMMAND_STATE})
|
||||
LAST_COMMAND_INDICATOR="${LAST_COMMAND_INDICATOR//_LAST_COMMAND_STATE_/${GIT_PROMPT_LAST_COMMAND_STATE}}"
|
||||
|
||||
# Do this only once to define PROMPT_START and PROMPT_END
|
||||
|
||||
if [[ -z "$PROMPT_START" || -z "$PROMPT_END" ]]; then
|
||||
|
||||
if [[ -z "$GIT_PROMPT_START" ]] ; then
|
||||
if $_isroot; then
|
||||
PROMPT_START="$GIT_PROMPT_START_ROOT"
|
||||
else
|
||||
PROMPT_START="$GIT_PROMPT_START_USER"
|
||||
fi
|
||||
else
|
||||
PROMPT_START="$GIT_PROMPT_START"
|
||||
fi
|
||||
|
||||
if [[ -z "$GIT_PROMPT_END" ]] ; then
|
||||
if $_isroot; then
|
||||
PROMPT_END="$GIT_PROMPT_END_ROOT"
|
||||
else
|
||||
PROMPT_END="$GIT_PROMPT_END_USER"
|
||||
fi
|
||||
else
|
||||
PROMPT_END="$GIT_PROMPT_END"
|
||||
fi
|
||||
fi
|
||||
|
||||
# set GIT_PROMPT_LEADING_SPACE to 0 if you want to have no leading space in front of the GIT prompt
|
||||
if [[ "$GIT_PROMPT_LEADING_SPACE" = 0 ]]; then
|
||||
PROMPT_LEADING_SPACE=""
|
||||
else
|
||||
PROMPT_LEADING_SPACE=" "
|
||||
fi
|
||||
|
||||
if [[ "$GIT_PROMPT_ONLY_IN_REPO" = 1 ]]; then
|
||||
EMPTY_PROMPT="$OLD_GITPROMPT"
|
||||
else
|
||||
local ps="$(gp_add_virtualenv_to_prompt)$PROMPT_START$($prompt_callback)$PROMPT_END"
|
||||
EMPTY_PROMPT="${ps//_LAST_COMMAND_INDICATOR_/${LAST_COMMAND_INDICATOR}}"
|
||||
fi
|
||||
|
||||
# fetch remote revisions every other $GIT_PROMPT_FETCH_TIMEOUT (default 5) minutes
|
||||
if [[ -z "$GIT_PROMPT_FETCH_TIMEOUT" ]]; then
|
||||
GIT_PROMPT_FETCH_TIMEOUT="5"
|
||||
fi
|
||||
if [[ -z "$__GIT_STATUS_CMD" ]] ; then # if GIT_STATUS_CMD not defined..
|
||||
git_prompt_dir
|
||||
if ! gp_maybe_set_envar_to_path __GIT_STATUS_CMD "$__GIT_PROMPT_DIR/$GIT_PROMPT_STATUS_COMMAND" ; then
|
||||
echo 1>&2 "Cannot find $GIT_PROMPT_STATUS_COMMAND!"
|
||||
fi
|
||||
# __GIT_STATUS_CMD defined
|
||||
fi
|
||||
unset GIT_BRANCH
|
||||
}
|
||||
|
||||
function setLastCommandState() {
|
||||
GIT_PROMPT_LAST_COMMAND_STATE=$?
|
||||
}
|
||||
|
||||
function we_are_on_repo() {
|
||||
if [[ -e "$(git rev-parse --git-dir 2> /dev/null)" ]]; then
|
||||
echo 1
|
||||
fi
|
||||
echo 0
|
||||
}
|
||||
|
||||
function update_old_git_prompt() {
|
||||
local in_repo=$(we_are_on_repo)
|
||||
if [[ $GIT_PROMPT_OLD_DIR_WAS_GIT = 0 ]]; then
|
||||
OLD_GITPROMPT=$PS1
|
||||
fi
|
||||
|
||||
GIT_PROMPT_OLD_DIR_WAS_GIT=$in_repo
|
||||
}
|
||||
|
||||
function setGitPrompt() {
|
||||
update_old_git_prompt
|
||||
|
||||
local repo=$(git rev-parse --show-toplevel 2> /dev/null)
|
||||
if [[ ! -e "$repo" ]] && [[ "$GIT_PROMPT_ONLY_IN_REPO" = 1 ]]; then
|
||||
# we do not permit bash-git-prompt outside git repos, so nothing to do
|
||||
PS1="$OLD_GITPROMPT"
|
||||
return
|
||||
fi
|
||||
|
||||
local EMPTY_PROMPT
|
||||
local __GIT_STATUS_CMD
|
||||
|
||||
git_prompt_config
|
||||
|
||||
if [[ ! -e "$repo" ]] || [[ "$GIT_PROMPT_DISABLE" = 1 ]]; then
|
||||
PS1="$EMPTY_PROMPT"
|
||||
return
|
||||
fi
|
||||
|
||||
local FETCH_REMOTE_STATUS=1
|
||||
if [[ "$GIT_PROMPT_FETCH_REMOTE_STATUS" = 0 ]]; then
|
||||
FETCH_REMOTE_STATUS=0
|
||||
fi
|
||||
|
||||
unset GIT_PROMPT_IGNORE
|
||||
OLD_GIT_PROMPT_SHOW_UNTRACKED_FILES=${GIT_PROMPT_SHOW_UNTRACKED_FILES}
|
||||
unset GIT_PROMPT_SHOW_UNTRACKED_FILES
|
||||
|
||||
if [[ -e "$repo/.bash-git-rc" ]]; then
|
||||
source "$repo/.bash-git-rc"
|
||||
fi
|
||||
|
||||
if [ -z "${GIT_PROMPT_SHOW_UNTRACKED_FILES}" ]; then
|
||||
GIT_PROMPT_SHOW_UNTRACKED_FILES=${OLD_GIT_PROMPT_SHOW_UNTRACKED_FILES}
|
||||
fi
|
||||
unset OLD_GIT_PROMPT_SHOW_UNTRACKED_FILES
|
||||
|
||||
if [[ "$GIT_PROMPT_IGNORE" = 1 ]]; then
|
||||
PS1="$EMPTY_PROMPT"
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ "$FETCH_REMOTE_STATUS" = 1 ]]; then
|
||||
checkUpstream
|
||||
fi
|
||||
|
||||
updatePrompt
|
||||
}
|
||||
|
||||
# some versions of find do not have -mmin
|
||||
_have_find_mmin=1
|
||||
|
||||
function olderThanMinutes() {
|
||||
local matches
|
||||
local find_exit_code
|
||||
|
||||
if [[ -z "$_find_command" ]]; then
|
||||
if command -v gfind > /dev/null; then
|
||||
_find_command=gfind
|
||||
else
|
||||
_find_command=find
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$_have_find_mmin" = 1 ]]; then
|
||||
matches=$("$_find_command" "$1" -mmin +"$2" 2> /dev/null)
|
||||
find_exit_code="$?"
|
||||
if [[ -n "$matches" ]]; then
|
||||
return 0
|
||||
else
|
||||
if [[ "$find_exit_code" != 0 ]]; then
|
||||
_have_find_mmin=0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# try perl, solaris ships with perl
|
||||
if command -v perl > /dev/null; then
|
||||
perl -e '((time - (stat("'"$1"'"))[9]) / 60) > '"$2"' && exit(0) || exit(1)'
|
||||
return "$?"
|
||||
else
|
||||
echo >&2
|
||||
echo "[1;31mWARNING[0m: neither a find that supports -mmin (such as GNU find) or perl is available, disabling remote status checking. Install GNU find as gfind or perl to enable this feature, or set GIT_PROMPT_FETCH_REMOTE_STATUS=0 to disable this warning." >&2
|
||||
echo >&2
|
||||
GIT_PROMPT_FETCH_REMOTE_STATUS=0
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function checkUpstream() {
|
||||
local GIT_PROMPT_FETCH_TIMEOUT
|
||||
git_prompt_config
|
||||
|
||||
local FETCH_HEAD="$repo/.git/FETCH_HEAD"
|
||||
# Fech repo if local is stale for more than $GIT_FETCH_TIMEOUT minutes
|
||||
if [[ ! -e "$FETCH_HEAD" ]] || olderThanMinutes "$FETCH_HEAD" "$GIT_PROMPT_FETCH_TIMEOUT"
|
||||
then
|
||||
if [[ -n $(git remote show) ]]; then
|
||||
(
|
||||
async_run "git fetch --quiet"
|
||||
disown -h
|
||||
)
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function replaceSymbols() {
|
||||
if [[ -z ${GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING} ]]; then
|
||||
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING=L
|
||||
fi
|
||||
|
||||
local VALUE=${1//_AHEAD_/${GIT_PROMPT_SYMBOLS_AHEAD}}
|
||||
local VALUE1=${VALUE//_BEHIND_/${GIT_PROMPT_SYMBOLS_BEHIND}}
|
||||
local VALUE2=${VALUE1//_NO_REMOTE_TRACKING_/${GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING}}
|
||||
|
||||
echo ${VALUE2//_PREHASH_/${GIT_PROMPT_SYMBOLS_PREHASH}}
|
||||
}
|
||||
|
||||
function createPrivateIndex {
|
||||
# Create a copy of the index to avoid conflicts with parallel git commands, e.g. git rebase.
|
||||
local __GIT_INDEX_FILE
|
||||
local __GIT_INDEX_PRIVATE
|
||||
if [[ -z "$GIT_INDEX_FILE" ]]; then
|
||||
__GIT_INDEX_FILE="$(git rev-parse --git-dir)/index"
|
||||
else
|
||||
__GIT_INDEX_FILE="$GIT_INDEX_FILE"
|
||||
fi
|
||||
__GIT_INDEX_PRIVATE="/tmp/git-index-private$$"
|
||||
command cp "$__GIT_INDEX_FILE" "$__GIT_INDEX_PRIVATE" 2>/dev/null
|
||||
echo "$__GIT_INDEX_PRIVATE"
|
||||
}
|
||||
|
||||
function updatePrompt() {
|
||||
local LAST_COMMAND_INDICATOR
|
||||
local PROMPT_LEADING_SPACE
|
||||
local PROMPT_START
|
||||
local PROMPT_END
|
||||
local EMPTY_PROMPT
|
||||
local Blue="\[\033[0;34m\]"
|
||||
|
||||
git_prompt_config
|
||||
|
||||
export __GIT_PROMPT_IGNORE_STASH=${GIT_PROMPT_IGNORE_STASH}
|
||||
export __GIT_PROMPT_SHOW_UPSTREAM=${GIT_PROMPT_SHOW_UPSTREAM}
|
||||
|
||||
if [ -z "${GIT_PROMPT_SHOW_UNTRACKED_FILES}" ]; then
|
||||
export __GIT_PROMPT_SHOW_UNTRACKED_FILES=all
|
||||
else
|
||||
export __GIT_PROMPT_SHOW_UNTRACKED_FILES=${GIT_PROMPT_SHOW_UNTRACKED_FILES}
|
||||
fi
|
||||
|
||||
if [ -z "${GIT_PROMPT_SHOW_CHANGED_FILES_COUNT}" ]; then
|
||||
export __GIT_PROMPT_SHOW_CHANGED_FILES_COUNT=1
|
||||
else
|
||||
export __GIT_PROMPT_SHOW_CHANGED_FILES_COUNT=${GIT_PROMPT_SHOW_CHANGED_FILES_COUNT}
|
||||
fi
|
||||
|
||||
local GIT_INDEX_PRIVATE="$(createPrivateIndex)"
|
||||
#important to define GIT_INDEX_FILE as local: This way it only affects this function (and below) - even with the export afterwards
|
||||
local GIT_INDEX_FILE
|
||||
export GIT_INDEX_FILE="$GIT_INDEX_PRIVATE"
|
||||
|
||||
local -a git_status_fields
|
||||
git_status_fields=($("$__GIT_STATUS_CMD" 2>/dev/null))
|
||||
|
||||
export GIT_BRANCH=$(replaceSymbols ${git_status_fields[0]})
|
||||
local GIT_REMOTE="$(replaceSymbols ${git_status_fields[1]})"
|
||||
if [[ "." == "$GIT_REMOTE" ]]; then
|
||||
unset GIT_REMOTE
|
||||
fi
|
||||
|
||||
local GIT_UPSTREAM="${git_status_fields[2]}"
|
||||
if [[ -z "${__GIT_PROMPT_SHOW_UPSTREAM}" || "^" == "$GIT_UPSTREAM" ]]; then
|
||||
unset GIT_UPSTREAM
|
||||
else
|
||||
GIT_UPSTREAM="${GIT_PROMPT_UPSTREAM//_UPSTREAM_/${GIT_UPSTREAM}}"
|
||||
fi
|
||||
|
||||
local GIT_STAGED=${git_status_fields[3]}
|
||||
local GIT_CONFLICTS=${git_status_fields[4]}
|
||||
local GIT_CHANGED=${git_status_fields[5]}
|
||||
local GIT_UNTRACKED=${git_status_fields[6]}
|
||||
local GIT_STASHED=${git_status_fields[7]}
|
||||
local GIT_CLEAN=${git_status_fields[8]}
|
||||
|
||||
local NEW_PROMPT="$EMPTY_PROMPT"
|
||||
if [[ -n "$git_status_fields" ]]; then
|
||||
local STATUS="${PROMPT_LEADING_SPACE}${GIT_PROMPT_PREFIX}${GIT_PROMPT_BRANCH}${GIT_BRANCH}${ResetColor}"
|
||||
|
||||
# __add_status KIND VALEXPR INSERT
|
||||
# eg: __add_status 'STAGED' '-ne 0'
|
||||
|
||||
__chk_gitvar_status() {
|
||||
local v
|
||||
if [[ "x$2" == "x-n" ]] ; then
|
||||
v="$2 \"\$GIT_$1\""
|
||||
else
|
||||
v="\$GIT_$1 $2"
|
||||
fi
|
||||
if eval "test $v" ; then
|
||||
if [[ $# -lt 2 || "$3" != '-' ]] && [[ "x$__GIT_PROMPT_SHOW_CHANGED_FILES_COUNT" == "x1" || "x$1" == "xREMOTE" ]]; then
|
||||
__add_status "\$GIT_PROMPT_$1\$GIT_$1\$ResetColor"
|
||||
else
|
||||
__add_status "\$GIT_PROMPT_$1\$ResetColor"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
__add_gitvar_status() {
|
||||
__add_status "\$GIT_PROMPT_$1\$GIT_$1\$ResetColor"
|
||||
}
|
||||
|
||||
# __add_status SOMETEXT
|
||||
__add_status() {
|
||||
eval "STATUS=\"$STATUS$1\""
|
||||
}
|
||||
|
||||
__add_status '$GIT_UPSTREAM'
|
||||
__chk_gitvar_status 'REMOTE' '-n'
|
||||
__add_status "$GIT_PROMPT_SEPARATOR"
|
||||
__chk_gitvar_status 'STAGED' '-ne 0'
|
||||
__chk_gitvar_status 'CONFLICTS' '-ne 0'
|
||||
__chk_gitvar_status 'CHANGED' '-ne 0'
|
||||
__chk_gitvar_status 'UNTRACKED' '-ne 0'
|
||||
__chk_gitvar_status 'STASHED' '-ne 0'
|
||||
__chk_gitvar_status 'CLEAN' '-eq 1' -
|
||||
__add_status "$ResetColor$GIT_PROMPT_SUFFIX"
|
||||
|
||||
NEW_PROMPT="$(gp_add_virtualenv_to_prompt)$PROMPT_START$($prompt_callback)$STATUS$PROMPT_END"
|
||||
else
|
||||
NEW_PROMPT="$EMPTY_PROMPT"
|
||||
fi
|
||||
|
||||
PS1="${NEW_PROMPT//_LAST_COMMAND_INDICATOR_/${LAST_COMMAND_INDICATOR}${ResetColor}}"
|
||||
command rm "$GIT_INDEX_PRIVATE" 2>/dev/null
|
||||
}
|
||||
|
||||
# Helper function that returns virtual env information to be set in prompt
|
||||
# Honors virtualenvs own setting VIRTUAL_ENV_DISABLE_PROMPT
|
||||
function gp_add_virtualenv_to_prompt {
|
||||
local ACCUMULATED_VENV_PROMPT=""
|
||||
local VENV=""
|
||||
if [[ -n "$VIRTUAL_ENV" && -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ]]; then
|
||||
VENV=$(basename "${VIRTUAL_ENV}")
|
||||
ACCUMULATED_VENV_PROMPT="${ACCUMULATED_VENV_PROMPT}${GIT_PROMPT_VIRTUALENV//_VIRTUALENV_/${VENV}}"
|
||||
fi
|
||||
if [[ -n "$CONDA_DEFAULT_ENV" ]]; then
|
||||
VENV=$(basename "${CONDA_DEFAULT_ENV}")
|
||||
ACCUMULATED_VENV_PROMPT="${ACCUMULATED_VENV_PROMPT}${GIT_PROMPT_VIRTUALENV//_VIRTUALENV_/${VENV}}"
|
||||
fi
|
||||
echo "$ACCUMULATED_VENV_PROMPT"
|
||||
}
|
||||
|
||||
# Use exit status from declare command to determine whether input argument is a
|
||||
# bash function
|
||||
function is_function {
|
||||
declare -Ff "$1" >/dev/null;
|
||||
}
|
||||
|
||||
# Helper function that truncates $PWD depending on window width
|
||||
function gp_truncate_pwd {
|
||||
local tilde="~"
|
||||
local newPWD="${PWD/#${HOME}/${tilde}}"
|
||||
local pwdmaxlen=$((${COLUMNS:-80}/3))
|
||||
[ ${#newPWD} -gt $pwdmaxlen ] && newPWD="...${newPWD:3-$pwdmaxlen}"
|
||||
echo -n "$newPWD"
|
||||
}
|
||||
|
||||
# Sets the window title to the given argument string
|
||||
function gp_set_window_title {
|
||||
echo -ne "\[\033]0;"$@"\007\]"
|
||||
}
|
||||
|
||||
function prompt_callback_default {
|
||||
return
|
||||
}
|
||||
|
||||
# toggle gitprompt
|
||||
function git_prompt_toggle() {
|
||||
if [[ "$GIT_PROMPT_DISABLE" = 1 ]]; then
|
||||
GIT_PROMPT_DISABLE=0
|
||||
else
|
||||
GIT_PROMPT_DISABLE=1
|
||||
fi
|
||||
return
|
||||
}
|
||||
|
||||
function gp_install_prompt {
|
||||
if [ -z "$OLD_GITPROMPT" ]; then
|
||||
OLD_GITPROMPT=$PS1
|
||||
fi
|
||||
|
||||
if [ -z "$GIT_PROMPT_OLD_DIR_WAS_GIT" ]; then
|
||||
GIT_PROMPT_OLD_DIR_WAS_GIT=$(we_are_on_repo)
|
||||
fi
|
||||
|
||||
if [ -z "$PROMPT_COMMAND" ]; then
|
||||
PROMPT_COMMAND=setGitPrompt
|
||||
else
|
||||
PROMPT_COMMAND=${PROMPT_COMMAND%% }; # remove trailing spaces
|
||||
PROMPT_COMMAND=${PROMPT_COMMAND%\;}; # remove trailing semi-colon
|
||||
|
||||
local new_entry="setGitPrompt"
|
||||
case ";$PROMPT_COMMAND;" in
|
||||
*";$new_entry;"*)
|
||||
# echo "PROMPT_COMMAND already contains: $new_entry"
|
||||
:;;
|
||||
*)
|
||||
PROMPT_COMMAND="$PROMPT_COMMAND;$new_entry"
|
||||
# echo "PROMPT_COMMAND does not contain: $new_entry"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
local setLastCommandStateEntry="setLastCommandState"
|
||||
case ";$PROMPT_COMMAND;" in
|
||||
*";$setLastCommandStateEntry;"*)
|
||||
# echo "PROMPT_COMMAND already contains: $setLastCommandStateEntry"
|
||||
:;;
|
||||
*)
|
||||
PROMPT_COMMAND="$setLastCommandStateEntry;$PROMPT_COMMAND"
|
||||
# echo "PROMPT_COMMAND does not contain: $setLastCommandStateEntry"
|
||||
;;
|
||||
esac
|
||||
|
||||
git_prompt_dir
|
||||
source "$__GIT_PROMPT_DIR/git-prompt-help.sh"
|
||||
}
|
||||
|
||||
gp_install_prompt
|
||||
@@ -1,153 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: UTF-8 -*-
|
||||
|
||||
"""This module defines a Print function to use with python 2.x or 3.x., so we can use the prompt with older versions of
|
||||
Python too
|
||||
|
||||
It's interface is that of python 3.0's print. See
|
||||
http://docs.python.org/3.0/library/functions.html?highlight=print#print
|
||||
|
||||
Shamelessly ripped from
|
||||
http://www.daniweb.com/software-development/python/code/217214/a-print-function-for-different-versions-of-python
|
||||
"""
|
||||
# change those symbols to whatever you prefer
|
||||
symbols = {'ahead of': '↑·', 'behind': '↓·', 'prehash': ':'}
|
||||
|
||||
import sys
|
||||
import re
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
__all__ = ["Print"]
|
||||
|
||||
try:
|
||||
Print = eval("print") # python 3.0 case
|
||||
python_version = 3
|
||||
to_str = str
|
||||
except SyntaxError as e:
|
||||
python_version = 2
|
||||
to_str = unicode
|
||||
D = dict()
|
||||
try:
|
||||
exec ("from __future__ import print_function\np=print", D)
|
||||
Print = D["p"] # 2.6 case
|
||||
except SyntaxError:
|
||||
def Print(*args, **kwd): # 2.4, 2.5, define our own Print function
|
||||
fout = kwd.get("file", sys.stdout)
|
||||
w = fout.write
|
||||
if args:
|
||||
w(str(args[0]))
|
||||
sep = kwd.get("sep", " ")
|
||||
for a in args[1:]:
|
||||
w(sep)
|
||||
w(str(a))
|
||||
w(kwd.get("end", "\n"))
|
||||
finally:
|
||||
del D
|
||||
|
||||
|
||||
def get_tag_or_hash():
|
||||
cmd = Popen(['git', 'describe', '--exact-match'], stdout=PIPE, stderr=PIPE)
|
||||
so, se = cmd.communicate()
|
||||
tag = '%s' % so.decode('utf-8').strip()
|
||||
|
||||
if tag:
|
||||
return tag
|
||||
else:
|
||||
cmd = Popen(['git', 'rev-parse', '--short', 'HEAD'], stdout=PIPE, stderr=PIPE)
|
||||
so, se = cmd.communicate()
|
||||
hash_name = '%s' % so.decode('utf-8').strip()
|
||||
return ''.join([symbols['prehash'], hash_name])
|
||||
|
||||
|
||||
def get_stash():
|
||||
cmd = Popen(['git', 'rev-parse', '--git-dir'], stdout=PIPE, stderr=PIPE)
|
||||
so, se = cmd.communicate()
|
||||
stash_file = '%s%s' % (so.decode('utf-8').rstrip(), '/logs/refs/stash')
|
||||
|
||||
try:
|
||||
with open(stash_file) as f:
|
||||
return sum(1 for _ in f)
|
||||
except IOError:
|
||||
return 0
|
||||
|
||||
|
||||
# `git status --porcelain --branch` can collect all information
|
||||
# branch, remote_branch, untracked, staged, changed, conflicts, ahead, behind
|
||||
po = Popen(['git', 'status', '--porcelain', '--branch'], env={'LC_ALL': 'C'}, stdout=PIPE, stderr=PIPE)
|
||||
stdout, stderr = po.communicate()
|
||||
if po.returncode != 0:
|
||||
sys.exit(0) # Not a git repository
|
||||
|
||||
# collect git status information
|
||||
untracked, staged, changed, conflicts = [], [], [], []
|
||||
num_ahead, num_behind = 0, 0
|
||||
ahead, behind = '', ''
|
||||
branch = ''
|
||||
remote = ''
|
||||
status = [(line[0], line[1], line[2:]) for line in stdout.decode('utf-8').splitlines()]
|
||||
for st in status:
|
||||
if st[0] == '#' and st[1] == '#':
|
||||
if re.search('Initial commit on', st[2]):
|
||||
branch = st[2].split(' ')[-1]
|
||||
elif re.search('no branch', st[2]): # detached status
|
||||
branch = get_tag_or_hash()
|
||||
elif len(st[2].strip().split('...')) == 1:
|
||||
branch = st[2].strip()
|
||||
else:
|
||||
# current and remote branch info
|
||||
branch, rest = st[2].strip().split('...')
|
||||
if len(rest.split(' ')) == 1:
|
||||
# remote_branch = rest.split(' ')[0]
|
||||
pass
|
||||
else:
|
||||
# ahead or behind
|
||||
divergence = ' '.join(rest.split(' ')[1:])
|
||||
divergence = divergence.lstrip('[').rstrip(']')
|
||||
for div in divergence.split(', '):
|
||||
if 'ahead' in div:
|
||||
num_ahead = int(div[len('ahead '):].strip())
|
||||
ahead = '%s%s' % (symbols['ahead of'], num_ahead)
|
||||
elif 'behind' in div:
|
||||
num_behind = int(div[len('behind '):].strip())
|
||||
behind = '%s%s' % (symbols['behind'], num_behind)
|
||||
remote = ''.join([behind, ahead])
|
||||
elif st[0] == '?' and st[1] == '?':
|
||||
untracked.append(st)
|
||||
else:
|
||||
if st[1] == 'M':
|
||||
changed.append(st)
|
||||
if st[0] == 'U':
|
||||
conflicts.append(st)
|
||||
elif st[0] != ' ':
|
||||
staged.append(st)
|
||||
|
||||
stashed = get_stash()
|
||||
if not changed and not staged and not conflicts and not untracked and not stashed:
|
||||
clean = 1
|
||||
else:
|
||||
clean = 0
|
||||
|
||||
if remote == "":
|
||||
remote = '.'
|
||||
|
||||
if python_version == 2:
|
||||
remote = remote.decode('utf-8')
|
||||
|
||||
out = '\n'.join([
|
||||
branch,
|
||||
remote,
|
||||
to_str(len(staged)),
|
||||
to_str(len(conflicts)),
|
||||
to_str(len(changed)),
|
||||
to_str(len(untracked)),
|
||||
to_str(stashed),
|
||||
to_str(clean),
|
||||
to_str(python_version),
|
||||
])
|
||||
|
||||
|
||||
if python_version == 2:
|
||||
Print(out.encode('utf-8'))
|
||||
else:
|
||||
Print(out)
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# -*- coding: utf-8 -*-
|
||||
# gitstatus.sh -- produce the current git repo status on STDOUT
|
||||
# Functionally equivalent to 'gitstatus.py', but written in bash (not python).
|
||||
#
|
||||
# Alan K. Stebbens <aks@stebbens.org> [http://github.com/aks]
|
||||
|
||||
if [ -z "${__GIT_PROMPT_DIR}" ]; then
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "${SOURCE}" ]; do
|
||||
DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
|
||||
SOURCE="$(readlink "${SOURCE}")"
|
||||
[[ $SOURCE != /* ]] && SOURCE="${DIR}/${SOURCE}"
|
||||
done
|
||||
__GIT_PROMPT_DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
|
||||
fi
|
||||
|
||||
gitstatus=$( LC_ALL=C git status --untracked-files=${__GIT_PROMPT_SHOW_UNTRACKED_FILES:-all} --porcelain --branch )
|
||||
|
||||
# if the status is fatal, exit now
|
||||
[[ "$?" -ne 0 ]] && exit 0
|
||||
|
||||
num_staged=0
|
||||
num_changed=0
|
||||
num_conflicts=0
|
||||
num_untracked=0
|
||||
while IFS='' read -r line || [[ -n "$line" ]]; do
|
||||
status=${line:0:2}
|
||||
while [[ -n $status ]]; do
|
||||
case "$status" in
|
||||
#two fixed character matches, loop finished
|
||||
\#\#) branch_line="${line/\.\.\./^}"; break ;;
|
||||
\?\?) ((num_untracked++)); break ;;
|
||||
U?) ((num_conflicts++)); break;;
|
||||
?U) ((num_conflicts++)); break;;
|
||||
DD) ((num_conflicts++)); break;;
|
||||
AA) ((num_conflicts++)); break;;
|
||||
#two character matches, first loop
|
||||
?M) ((num_changed++)) ;;
|
||||
?D) ((num_changed++)) ;;
|
||||
?\ ) ;;
|
||||
#single character matches, second loop
|
||||
U) ((num_conflicts++)) ;;
|
||||
\ ) ;;
|
||||
*) ((num_staged++)) ;;
|
||||
esac
|
||||
status=${status:0:(${#status}-1)}
|
||||
done
|
||||
done <<< "$gitstatus"
|
||||
|
||||
num_stashed=0
|
||||
if [[ "$__GIT_PROMPT_IGNORE_STASH" != "1" ]]; then
|
||||
stash_file="$( git rev-parse --git-dir )/logs/refs/stash"
|
||||
if [[ -e "${stash_file}" ]]; then
|
||||
while IFS='' read -r wcline || [[ -n "$wcline" ]]; do
|
||||
((num_stashed++))
|
||||
done < ${stash_file}
|
||||
fi
|
||||
fi
|
||||
|
||||
clean=0
|
||||
if (( num_changed == 0 && num_staged == 0 && num_untracked == 0 && num_stashed == 0 && num_conflicts == 0)) ; then
|
||||
clean=1
|
||||
fi
|
||||
|
||||
IFS="^" read -ra branch_fields <<< "${branch_line/\#\# }"
|
||||
branch="${branch_fields[0]}"
|
||||
remote=
|
||||
upstream=
|
||||
|
||||
if [[ "$branch" == *"Initial commit on"* ]]; then
|
||||
IFS=" " read -ra fields <<< "$branch"
|
||||
branch="${fields[3]}"
|
||||
remote="_NO_REMOTE_TRACKING_"
|
||||
elif [[ "$branch" == *"no branch"* ]]; then
|
||||
tag=$( git describe --tags --exact-match )
|
||||
if [[ -n "$tag" ]]; then
|
||||
branch="$tag"
|
||||
else
|
||||
branch="_PREHASH_$( git rev-parse --short HEAD )"
|
||||
fi
|
||||
else
|
||||
if [[ "${#branch_fields[@]}" -eq 1 ]]; then
|
||||
remote="_NO_REMOTE_TRACKING_"
|
||||
else
|
||||
IFS="[,]" read -ra remote_fields <<< "${branch_fields[1]}"
|
||||
upstream="${remote_fields[0]}"
|
||||
for remote_field in "${remote_fields[@]}"; do
|
||||
if [[ "$remote_field" == *ahead* ]]; then
|
||||
num_ahead=${remote_field:6}
|
||||
ahead="_AHEAD_${num_ahead}"
|
||||
fi
|
||||
if [[ "$remote_field" == *behind* ]]; then
|
||||
num_behind=${remote_field:7}
|
||||
behind="_BEHIND_${num_behind# }"
|
||||
fi
|
||||
done
|
||||
remote="${behind}${ahead}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "$remote" ]] ; then
|
||||
remote='.'
|
||||
fi
|
||||
|
||||
if [[ -z "$upstream" ]] ; then
|
||||
upstream='^'
|
||||
fi
|
||||
|
||||
printf "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \
|
||||
"$branch" \
|
||||
"$remote" \
|
||||
"$upstream" \
|
||||
$num_staged \
|
||||
$num_conflicts \
|
||||
$num_changed \
|
||||
$num_untracked \
|
||||
$num_stashed \
|
||||
$clean
|
||||
|
||||
exit
|
||||
@@ -1,125 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# -*- coding: UTF-8 -*-
|
||||
# gitstatus.sh -- produce the current git repo status on STDOUT
|
||||
# Functionally equivalent to 'gitstatus.py', but written in bash (not python).
|
||||
#
|
||||
# Alan K. Stebbens <aks@stebbens.org> [http://github.com/aks]
|
||||
|
||||
# helper functions
|
||||
count_lines() { echo "$1" | egrep -c "^$2" ; }
|
||||
all_lines() { echo "$1" | grep -v "^$" | wc -l ; }
|
||||
|
||||
if [ -z "${__GIT_PROMPT_DIR}" ]; then
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "${SOURCE}" ]; do
|
||||
DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
|
||||
SOURCE="$(readlink "${SOURCE}")"
|
||||
[[ $SOURCE != /* ]] && SOURCE="${DIR}/${SOURCE}"
|
||||
done
|
||||
__GIT_PROMPT_DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
|
||||
fi
|
||||
|
||||
gitsym=$( git symbolic-ref HEAD 2>/dev/null )
|
||||
|
||||
#If exit status OK, we have a branch
|
||||
if [[ $? == 0 ]]; then
|
||||
# the current branch is the tail end of the symbolic reference
|
||||
branch="${gitsym##refs/heads/}" # get the basename after "refs/heads/"
|
||||
fi
|
||||
|
||||
gitstatus=$( git diff --name-status 2>&1 )
|
||||
|
||||
# if the diff is fatal, exit now
|
||||
if [[ $? != 0 ]]; then exit 0; fi
|
||||
|
||||
staged_files=$( git diff --staged --name-status )
|
||||
|
||||
num_changed=$(( $( all_lines "$gitstatus" ) - $( count_lines "$gitstatus" U ) ))
|
||||
num_conflicts=$( count_lines "$staged_files" U )
|
||||
num_staged=$(( $( all_lines "$staged_files" ) - num_conflicts ))
|
||||
num_untracked=$( git ls-files --others --exclude-standard $(git rev-parse --show-cdup) | wc -l )
|
||||
|
||||
num_stashed=0
|
||||
if [[ "$__GIT_PROMPT_IGNORE_STASH" != "1" ]]; then
|
||||
stash_file="$( git rev-parse --git-dir )/logs/refs/stash"
|
||||
if [[ -e "${stash_file}" ]]; then
|
||||
while IFS='' read -r wcline || [[ -n "$wcline" ]]; do
|
||||
((num_stashed++))
|
||||
done < ${stash_file}
|
||||
fi
|
||||
fi
|
||||
|
||||
clean=0
|
||||
if (( num_changed == 0 && num_staged == 0 && num_untracked == 0 && num_stashed == 0 && num_conflicts == 0 )) ; then
|
||||
clean=1
|
||||
fi
|
||||
|
||||
remote=
|
||||
upstream=
|
||||
|
||||
if [[ -z "$branch" ]]; then
|
||||
tag=$( git describe --tags --exact-match 2>/dev/null )
|
||||
if [[ -n "$tag" ]]; then
|
||||
branch="$tag"
|
||||
else
|
||||
branch="_PREHASH_$( git rev-parse --short HEAD )"
|
||||
fi
|
||||
else
|
||||
remote_name=$( git config branch.${branch}.remote )
|
||||
|
||||
if [[ -n "$remote_name" ]]; then
|
||||
merge_name=$( git config branch.${branch}.merge )
|
||||
else
|
||||
remote_name='origin'
|
||||
merge_name="refs/heads/${branch}"
|
||||
fi
|
||||
|
||||
if [[ "$remote_name" == '.' ]]; then
|
||||
remote_ref="$merge_name"
|
||||
else
|
||||
remote_ref="refs/remotes/$remote_name/${merge_name##refs/heads/}"
|
||||
fi
|
||||
|
||||
# detect if the local branch have a remote tracking branch
|
||||
upstream=$( git rev-parse --abbrev-ref ${branch}@{upstream} 2>&1 )
|
||||
|
||||
if [[ $? == 0 ]]; then
|
||||
# get the revision list, and count the leading "<" and ">"
|
||||
revgit=$( git rev-list --left-right ${remote_ref}...HEAD 2>/dev/null )
|
||||
if [[ $? == 0 ]]; then
|
||||
num_revs=$( all_lines "$revgit" )
|
||||
num_ahead=$( count_lines "$revgit" "^>" )
|
||||
num_behind=$(( num_revs - num_ahead ))
|
||||
if (( num_behind > 0 )) ; then
|
||||
remote="${remote}_BEHIND_${num_behind}"
|
||||
fi
|
||||
if (( num_ahead > 0 )) ; then
|
||||
remote="${remote}_AHEAD_${num_ahead}"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
remote='_NO_REMOTE_TRACKING_'
|
||||
unset upstream
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "$remote" ]] ; then
|
||||
remote='.'
|
||||
fi
|
||||
|
||||
if [[ -z "$upstream" ]] ; then
|
||||
upstream='^'
|
||||
fi
|
||||
|
||||
printf "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" \
|
||||
"$branch" \
|
||||
"$remote" \
|
||||
"$upstream" \
|
||||
$num_staged \
|
||||
$num_conflicts \
|
||||
$num_changed \
|
||||
$num_untracked \
|
||||
$num_stashed \
|
||||
$clean
|
||||
|
||||
exit
|
||||
@@ -1,82 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# prompt-colors.sh
|
||||
#
|
||||
# source this file to get color definitions
|
||||
# if $debug or $verbose is set, the definitions
|
||||
# are also printed to STDERR.
|
||||
|
||||
define_color_names() {
|
||||
|
||||
ColorNames=( Black Red Green Yellow Blue Magenta Cyan White )
|
||||
FgColors=( 30 31 32 33 34 35 36 37 )
|
||||
BgColors=( 40 41 42 43 44 45 46 47 )
|
||||
|
||||
local AttrNorm=0
|
||||
local AttrBright=1
|
||||
local AttrDim=2
|
||||
local AttrUnder=4
|
||||
local AttrBlink=5
|
||||
local AttrRev=7
|
||||
local AttrHide=8
|
||||
|
||||
# define "BoldCOLOR", "BrightCOLOR", and "DimCOLOR" names
|
||||
|
||||
# _map_colors ATTRNAME ATTRVALUE
|
||||
#
|
||||
# Defines three names for every color, attribute combintaion:
|
||||
# {ATTRNAME}{COLORNAME}
|
||||
# {ATTRNAME}{COLORNAME}Fg
|
||||
# {ATTRNAME}{COLORNAME}Bg
|
||||
#
|
||||
# Example: BoldRed, BoldRedFg, BoldRedBg
|
||||
|
||||
_map_colors() {
|
||||
local x=0
|
||||
local attrname="$1"
|
||||
local attrcode=$2
|
||||
while (( x < 8 )) ; do
|
||||
local colorname=${ColorNames[x]}
|
||||
local fgcolorcode=${FgColors[x]}
|
||||
local bgcolorcode=${BgColors[x]}
|
||||
longcolorname="${attrname}${colorname}"
|
||||
_def_color $longcolorname $attrcode $fgcolorcode
|
||||
_def_color ${longcolorname}Fg $attrcode $fgcolorcode
|
||||
_def_color ${longcolorname}Bg $attrcode $bgcolorcode
|
||||
(( x++ ))
|
||||
done
|
||||
}
|
||||
|
||||
# _term_color [ N | N M ]
|
||||
_term_color() {
|
||||
local cv
|
||||
if (( $# > 1 )); then
|
||||
cv="${1};${2}"
|
||||
else
|
||||
cv="${1}"
|
||||
fi
|
||||
echo "\[\033[${cv}m\]"
|
||||
}
|
||||
|
||||
# def_color NAME ATTRCODE COLORCODE
|
||||
_def_color() {
|
||||
local def="$1=\"\`_term_color $2 $3\`\""
|
||||
if [[ -n "$debug$verbose" ]]; then
|
||||
echo 1>&2 "+ $def"
|
||||
fi
|
||||
eval "$def"
|
||||
}
|
||||
|
||||
_map_colors Bold $AttrBright
|
||||
_map_colors Bright $AttrBright
|
||||
_map_colors Dim $AttrDim
|
||||
_map_colors '' $AttrNorm
|
||||
|
||||
_def_color IntenseBlack 0 90
|
||||
_def_color ResetColor 0 0
|
||||
|
||||
}
|
||||
|
||||
# do the color definitions only once
|
||||
if [[ ${#ColorNames[*]} = 0 || -z "$IntenseBlack" || -z "$ResetColor" ]]; then
|
||||
define_color_names
|
||||
fi
|
||||
@@ -1,31 +0,0 @@
|
||||
# This theme for gitprompt.sh is designed for dark color schemes
|
||||
# it is clone of oh-my-zsh crunch theme style with exit status
|
||||
|
||||
override_git_prompt_colors() {
|
||||
if [ -e ~/.rvm/bin/rvm-prompt ]; then
|
||||
RUBY_PROMPT='{$(~/.rvm/bin/rvm-prompt i v)}'
|
||||
else
|
||||
if command -v rbenv > /dev/null; then
|
||||
RUBY_PROMPT='{$(rbenv version | sed -e "s/ (set.*$//")}'
|
||||
fi
|
||||
fi
|
||||
Time12a="\$(date +%H:%M)"
|
||||
|
||||
|
||||
GIT_PROMPT_THEME_NAME="Chmike"
|
||||
GIT_PROMPT_BRANCH="${Green}"
|
||||
GIT_PROMPT_REMOTE=" "
|
||||
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="⭐"
|
||||
|
||||
GIT_PROMPT_SEPARATOR="|"
|
||||
GIT_PROMPT_CHANGED="${Cyan}❗"
|
||||
GIT_PROMPT_STAGED="${Yellow}▸"
|
||||
GIT_PROMPT_UNTRACKED="${Blue}…"
|
||||
GIT_PROMPT_CONFLICTS="${BoldRed}❓"
|
||||
GIT_PROMPT_STASHED="${Magenta}>"
|
||||
GIT_PROMPT_CLEAN="${Green}✔ "
|
||||
GIT_PROMPT_COMMAND_OK="${Green}✔"
|
||||
GIT_PROMPT_COMMAND_FAIL="${Red}✘"
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "Crunch"
|
||||
@@ -1,34 +0,0 @@
|
||||
# This theme for gitprompt.sh is designed for dark color schemes
|
||||
# it is clone of oh-my-zsh crunch theme style with exit status
|
||||
|
||||
override_git_prompt_colors() {
|
||||
if [ -e ~/.rvm/bin/rvm-prompt ]; then
|
||||
RUBY_PROMPT='{$(~/.rvm/bin/rvm-prompt i v)}'
|
||||
else
|
||||
if command -v rbenv > /dev/null; then
|
||||
RUBY_PROMPT='{$(rbenv version | sed -e "s/ (set.*$//")}'
|
||||
fi
|
||||
fi
|
||||
Time12a="\$(date +%H:%M)"
|
||||
|
||||
GIT_PROMPT_THEME_NAME="Crunch"
|
||||
GIT_PROMPT_STAGED="${Yellow}● "
|
||||
GIT_PROMPT_UNTRACKED="${Cyan}… "
|
||||
GIT_PROMPT_STASHED="${BoldMagenta}⚑ "
|
||||
GIT_PROMPT_CLEAN="${Green}✔ "
|
||||
GIT_PROMPT_COMMAND_OK="${Green}✔ "
|
||||
GIT_PROMPT_COMMAND_FAIL="${Red}✘ "
|
||||
|
||||
KERNEL_PROMPT='‹$(uname -r)›'
|
||||
|
||||
GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_${White}{${Yellow}${Time12a}${White}}[${Magenta}${RUBY_PROMPT}${White}]${Cyan}${PathShort}${White}:"
|
||||
GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}"
|
||||
GIT_PROMPT_END_USER="${BoldBlue} ➭ ${ResetColor}"
|
||||
GIT_PROMPT_END_ROOT="${BoldRed} # ${ResetColor}"
|
||||
GIT_PROMPT_LEADING_SPACE=0
|
||||
GIT_PROMPT_PREFIX="${Green}["
|
||||
GIT_PROMPT_SUFFIX="${Green}]"
|
||||
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="✭"
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "Crunch"
|
||||
@@ -1,58 +0,0 @@
|
||||
# This is the custom theme template for gitprompt.sh
|
||||
|
||||
# These are the defaults from the "Default" theme
|
||||
# You just need to override what you want to have changed
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="Custom"
|
||||
|
||||
# Time12a="\$(date +%H:%M)"
|
||||
# PathShort="\w";
|
||||
|
||||
## These are the color definitions used by gitprompt.sh
|
||||
# GIT_PROMPT_PREFIX="[" # start of the git info string
|
||||
# GIT_PROMPT_SUFFIX="]" # the end of the git info string
|
||||
# GIT_PROMPT_SEPARATOR="|" # separates each item
|
||||
|
||||
# GIT_PROMPT_BRANCH="${Magenta}" # the git branch that is active in the current directory
|
||||
# GIT_PROMPT_STAGED="${Red}●" # the number of staged files/directories
|
||||
# GIT_PROMPT_CONFLICTS="${Red}✖ " # the number of files in conflict
|
||||
# GIT_PROMPT_CHANGED="${Blue}✚ " # the number of changed files
|
||||
|
||||
# GIT_PROMPT_REMOTE=" " # the remote branch name (if any) and the symbols for ahead and behind
|
||||
# GIT_PROMPT_UNTRACKED="${Cyan}…" # the number of untracked files/dirs
|
||||
# GIT_PROMPT_STASHED="${BoldBlue}⚑ " # the number of stashed files/dir
|
||||
# GIT_PROMPT_CLEAN="${BoldGreen}✔" # a colored flag indicating a "clean" repo
|
||||
|
||||
## For the command indicator, the placeholder _LAST_COMMAND_STATE_
|
||||
## will be replaced with the exit code of the last command
|
||||
## e.g.
|
||||
## GIT_PROMPT_COMMAND_OK="${Green}✔-_LAST_COMMAND_STATE_ " # indicator if the last command returned with an exit code of 0
|
||||
## GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_ " # indicator if the last command returned with an exit code of other than 0
|
||||
|
||||
# GIT_PROMPT_COMMAND_OK="${Green}✔" # indicator if the last command returned with an exit code of 0
|
||||
# GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_" # indicator if the last command returned with an exit code of other than 0
|
||||
|
||||
## template for displaying the current virtual environment
|
||||
## use the placeholder _VIRTUALENV_ will be replaced with
|
||||
## the name of the current virtual environment (currently CONDA and VIRTUAL_ENV)
|
||||
# GIT_PROMPT_VIRTUALENV="(${Blue}_VIRTUALENV_${ResetColor}) "
|
||||
|
||||
# template for displaying the current remote tracking branch
|
||||
# use the placeholder _UPSTREAM_ will be replaced with
|
||||
# the name of the current remote tracking branch
|
||||
# GIT_PROMPT_UPSTREAM=" {${Blue}_UPSTREAM_${ResetColor}}"
|
||||
|
||||
## _LAST_COMMAND_INDICATOR_ will be replaced by the appropriate GIT_PROMPT_COMMAND_OK OR GIT_PROMPT_COMMAND_FAIL
|
||||
# GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${Yellow}${PathShort}${ResetColor}"
|
||||
# GIT_PROMPT_START_ROOT="_LAST_COMMAND_INDICATOR_ ${GIT_PROMPT_START_USER}"
|
||||
# GIT_PROMPT_END_USER=" \n${White}${Time12a}${ResetColor} $ "
|
||||
# GIT_PROMPT_END_ROOT=" \n${White}${Time12a}${ResetColor} # "
|
||||
|
||||
## Please do not add colors to these symbols
|
||||
# GIT_PROMPT_SYMBOLS_AHEAD="↑·" # The symbol for "n versions ahead of origin"
|
||||
# GIT_PROMPT_SYMBOLS_BEHIND="↓·" # The symbol for "n versions behind of origin"
|
||||
# GIT_PROMPT_SYMBOLS_PREHASH=":" # Written before hash of commit, if no name could be found
|
||||
# GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="L" # This symbol is written after the branch, if the branch is not tracked
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "Custom"
|
||||
@@ -1,106 +0,0 @@
|
||||
# This is the default theme for gitprompt.sh
|
||||
|
||||
unset_git_prompt_colors() {
|
||||
unset Time12a
|
||||
unset PathShort
|
||||
unset GIT_PROMPT_PREFIX
|
||||
unset GIT_PROMPT_SUFFIX
|
||||
unset GIT_PROMPT_SEPARATOR
|
||||
unset GIT_PROMPT_BRANCH
|
||||
unset GIT_PROMPT_STAGED
|
||||
unset GIT_PROMPT_CONFLICTS
|
||||
unset GIT_PROMPT_CHANGED
|
||||
unset GIT_PROMPT_REMOTE
|
||||
unset GIT_PROMPT_UNTRACKED
|
||||
unset GIT_PROMPT_STASHED
|
||||
unset GIT_PROMPT_CLEAN
|
||||
unset GIT_PROMPT_COMMAND_OK
|
||||
unset GIT_PROMPT_COMMAND_FAIL
|
||||
unset GIT_PROMPT_VIRTUALENV
|
||||
unset GIT_PROMPT_UPSTREAM
|
||||
unset GIT_PROMPT_START_USER
|
||||
unset GIT_PROMPT_START_ROOT
|
||||
unset GIT_PROMPT_END_USER
|
||||
unset GIT_PROMPT_END_ROOT
|
||||
unset GIT_PROMPT_SYMBOLS_AHEAD
|
||||
unset GIT_PROMPT_SYMBOLS_BEHIND
|
||||
unset GIT_PROMPT_SYMBOLS_PREHASH
|
||||
unset GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING
|
||||
}
|
||||
|
||||
define_helpers() {
|
||||
Time12a="\$(date +%H:%M)"
|
||||
PathShort="\w";
|
||||
}
|
||||
|
||||
define_undefined_git_prompt_colors() {
|
||||
if [ -z ${GIT_PROMPT_THEME_NAME+x} ]; then GIT_PROMPT_THEME_NAME="Default"; fi
|
||||
|
||||
# These are the color definitions used by gitprompt.sh
|
||||
if [ -z ${GIT_PROMPT_PREFIX+x} ]; then GIT_PROMPT_PREFIX="["; fi # start of the git info string
|
||||
if [ -z ${GIT_PROMPT_SUFFIX+x} ]; then GIT_PROMPT_SUFFIX="]"; fi # the end of the git info string
|
||||
if [ -z ${GIT_PROMPT_SEPARATOR+x} ]; then GIT_PROMPT_SEPARATOR="|"; fi # separates each item
|
||||
|
||||
if [ -z ${GIT_PROMPT_BRANCH+x} ]; then GIT_PROMPT_BRANCH="${Magenta}"; fi # the git branch that is active in the current directory
|
||||
if [ -z ${GIT_PROMPT_STAGED+x} ]; then GIT_PROMPT_STAGED="${Red}●"; fi # the number of staged files/directories
|
||||
if [ -z ${GIT_PROMPT_CONFLICTS+x} ]; then GIT_PROMPT_CONFLICTS="${Red}✖ "; fi # the number of files in conflict
|
||||
if [ -z ${GIT_PROMPT_CHANGED+x} ]; then GIT_PROMPT_CHANGED="${Blue}✚ "; fi # the number of changed files
|
||||
|
||||
if [ -z ${GIT_PROMPT_REMOTE+x} ]; then GIT_PROMPT_REMOTE=" "; fi # the remote branch name (if any) and the symbols for ahead and behind
|
||||
if [ -z ${GIT_PROMPT_UNTRACKED+x} ]; then GIT_PROMPT_UNTRACKED="${Cyan}…"; fi # the number of untracked files/dirs
|
||||
if [ -z ${GIT_PROMPT_STASHED+x} ]; then GIT_PROMPT_STASHED="${BoldBlue}⚑ "; fi # the number of stashed files/dir
|
||||
if [ -z ${GIT_PROMPT_CLEAN+x} ]; then GIT_PROMPT_CLEAN="${BoldGreen}✔"; fi # a colored flag indicating a "clean" repo
|
||||
|
||||
# For the command indicator, the placeholder _LAST_COMMAND_STATE_
|
||||
# will be replaced with the exit code of the last command
|
||||
# e.g.
|
||||
# GIT_PROMPT_COMMAND_OK="${Green}✔-_LAST_COMMAND_STATE_ " # indicator if the last command returned with an exit code of 0
|
||||
# GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_ " # indicator if the last command returned with an exit code of other than 0
|
||||
|
||||
if [ -z ${GIT_PROMPT_COMMAND_OK+x} ]; then GIT_PROMPT_COMMAND_OK="${Green}✔"; fi # indicator if the last command returned with an exit code of 0
|
||||
if [ -z ${GIT_PROMPT_COMMAND_FAIL+x} ]; then GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_"; fi # indicator if the last command returned with an exit code of other than 0
|
||||
|
||||
# Possible to change which command is used to create git status information
|
||||
# There are three options:
|
||||
# 1) gitstatus.sh (uses git status --branch --porcelain - fast, requires git > 1.7.10)
|
||||
# 2) gitstatus_pre-1.7.10.sh (Uses a variety of git commands and pipes - slower, works with older git clients)
|
||||
# 3) gitstatus.py (Unsupported, lack features found in the bash versions)
|
||||
if [ -z ${GIT_PROMPT_STATUS_COMMAND+x} ]; then GIT_PROMPT_STATUS_COMMAND="gitstatus.sh"; fi # Point out the command to get the git status from
|
||||
|
||||
# template for displaying the current virtual environment
|
||||
# use the placeholder _VIRTUALENV_ will be replaced with
|
||||
# the name of the current virtual environment (currently CONDA and VIRTUAL_ENV)
|
||||
if [ -z ${GIT_PROMPT_VIRTUALENV+x} ]; then GIT_PROMPT_VIRTUALENV="(${Blue}_VIRTUALENV_${ResetColor}) "; fi
|
||||
|
||||
# template for displaying the current remote tracking branch
|
||||
# use the placeholder _UPSTREAM_ will be replaced with
|
||||
# the name of the current remote tracking branch
|
||||
if [ -z ${GIT_PROMPT_UPSTREAM+x} ]; then GIT_PROMPT_UPSTREAM=" {${Blue}_UPSTREAM_${ResetColor}}"; fi
|
||||
|
||||
# _LAST_COMMAND_INDICATOR_ will be replaced by the appropriate GIT_PROMPT_COMMAND_OK OR GIT_PROMPT_COMMAND_FAIL
|
||||
if [ -z ${GIT_PROMPT_START_USER+x} ]; then GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${Yellow}${PathShort}${ResetColor}"; fi
|
||||
if [ -z ${GIT_PROMPT_START_ROOT+x} ]; then GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}"; fi
|
||||
if [ -z ${GIT_PROMPT_END_USER+x} ]; then GIT_PROMPT_END_USER=" \n${White}${Time12a}${ResetColor} $ "; fi
|
||||
if [ -z ${GIT_PROMPT_END_ROOT+x} ]; then GIT_PROMPT_END_ROOT=" \n${White}${Time12a}${ResetColor} # "; fi
|
||||
|
||||
# Please do not add colors to these symbols
|
||||
if [ -z ${GIT_PROMPT_SYMBOLS_AHEAD+x} ]; then GIT_PROMPT_SYMBOLS_AHEAD="↑·"; fi # The symbol for "n versions ahead of origin"
|
||||
if [ -z ${GIT_PROMPT_SYMBOLS_BEHIND+x} ]; then GIT_PROMPT_SYMBOLS_BEHIND="↓·"; fi # The symbol for "n versions behind of origin"
|
||||
if [ -z ${GIT_PROMPT_SYMBOLS_PREHASH+x} ]; then GIT_PROMPT_SYMBOLS_PREHASH=":"; fi # Written before hash of commit, if no name could be found
|
||||
if [ -z ${GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING+x} ]; then GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="L"; fi # This symbol is written after the branch, if the branch is not tracked
|
||||
}
|
||||
|
||||
# call only from theme file
|
||||
reload_git_prompt_colors() {
|
||||
if [[ "${GIT_PROMPT_THEME_NAME}" != $1 ]]; then
|
||||
unset_git_prompt_colors
|
||||
define_helpers
|
||||
override_git_prompt_colors
|
||||
define_undefined_git_prompt_colors
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ "${GIT_PROMPT_THEME}" == "Default" && "${GIT_PROMPT_THEME_NAME}" != "Default" ]]; then
|
||||
define_helpers
|
||||
define_undefined_git_prompt_colors
|
||||
fi
|
||||
@@ -1,11 +0,0 @@
|
||||
# This is the default theme for gitprompt.sh
|
||||
# without the indicator of the last command state
|
||||
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="Default NoExitState"
|
||||
GIT_PROMPT_COMMAND_FAIL="${Red}✘" # indicator if the last command returned with an exit code of other than 0
|
||||
GIT_PROMPT_START_USER="${Yellow}${PathShort}${ResetColor}"
|
||||
GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}"
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "Default NoExitState"
|
||||
@@ -1,15 +0,0 @@
|
||||
# This is the default theme for gitprompt.sh
|
||||
# without the indicator of the last command state
|
||||
# tweaked for Ubuntu terminal fonts
|
||||
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="Default NoExitState Ubuntu"
|
||||
GIT_PROMPT_STAGED="${Red}● " # the number of staged files/directories
|
||||
GIT_PROMPT_CLEAN="${BoldGreen}✔ " # a colored flag indicating a "clean" repo
|
||||
GIT_PROMPT_COMMAND_OK="${Green}✔ " # indicator if the last command returned with an exit code of 0
|
||||
GIT_PROMPT_COMMAND_FAIL="${Red}✘ " # indicator if the last command returned with an exit code of other than 0
|
||||
GIT_PROMPT_START_USER="${Yellow}${PathShort}${ResetColor}"
|
||||
GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}"
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "Default NoExitState Ubuntu"
|
||||
@@ -1,11 +0,0 @@
|
||||
# This is the default theme for gitprompt.sh
|
||||
# tweaked for Ubuntu terminal fonts
|
||||
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="Default Ubuntu"
|
||||
GIT_PROMPT_STAGED="${Red}● " # the number of staged files/directories
|
||||
GIT_PROMPT_CLEAN="${BoldGreen}✔ " # a colored flag indicating a "clean" repo
|
||||
GIT_PROMPT_COMMAND_OK="${Green}✔ " # indicator if the last command returned with an exit code of 0
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "Default Ubuntu"
|
||||
@@ -1,30 +0,0 @@
|
||||
# This theme for gitprompt.sh is designed for dark color schemes
|
||||
# It is most suitable for Retina or high resolution displays
|
||||
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="Evermeet"
|
||||
|
||||
GIT_PROMPT_PREFIX="" # start of the git info string
|
||||
GIT_PROMPT_SUFFIX="" # the end of the git info string
|
||||
GIT_PROMPT_SEPARATOR="|" # separates each item
|
||||
|
||||
GIT_PROMPT_BRANCH="${Magenta}" # the git branch that is active in the current directory
|
||||
GIT_PROMPT_STAGED="${Cyan}●" # the number of staged files/directories
|
||||
GIT_PROMPT_CONFLICTS="${BoldRed}✖" # the number of files in conflict
|
||||
GIT_PROMPT_CHANGED="${Cyan}✚" # the number of changed files
|
||||
|
||||
GIT_PROMPT_UNTRACKED="${Cyan}…" # the number of untracked files/dirs
|
||||
GIT_PROMPT_STASHED="${Magenta}⚑" # the number of stashed files/dir
|
||||
GIT_PROMPT_CLEAN="${BoldGreen}✔" # a colored flag indicating a "clean" repo
|
||||
|
||||
GIT_PROMPT_UPSTREAM=" {${Magenta}_UPSTREAM_${ResetColor}}"
|
||||
|
||||
GIT_PROMPT_START_USER="[${BoldGreen}\u@\h${ResetColor} ${BoldYellow}\${?}${ResetColor} ${BoldBlue}\w${ResetColor}"
|
||||
GIT_PROMPT_START_ROOT="[${BoldRed}\u@\h${ResetColor} ${BoldYellow}\${?}${ResetColor} ${BoldBlue}\w${ResetColor}"
|
||||
GIT_PROMPT_END_USER="]$ "
|
||||
GIT_PROMPT_END_ROOT="]# "
|
||||
|
||||
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="⭑" # This symbol is written after the branch, if the branch is not tracked
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "Evermeet"
|
||||
@@ -1,32 +0,0 @@
|
||||
# This theme for gitprompt.sh is designed for dark color schemes
|
||||
# On lowres screens unicode characters like ✖ require a space after them
|
||||
# otherwise the following character may overlap with the unicode character
|
||||
# tweaked for low resolution and non-retina screens
|
||||
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="Evermeet_Lowres"
|
||||
|
||||
GIT_PROMPT_PREFIX="" # start of the git info string
|
||||
GIT_PROMPT_SUFFIX="" # the end of the git info string
|
||||
GIT_PROMPT_SEPARATOR="|" # separates each item
|
||||
|
||||
GIT_PROMPT_BRANCH="${Magenta}" # the git branch that is active in the current directory
|
||||
GIT_PROMPT_STAGED="${Cyan}●" # the number of staged files/directories
|
||||
GIT_PROMPT_CONFLICTS="${BoldRed}✖ " # the number of files in conflict
|
||||
GIT_PROMPT_CHANGED="${Cyan}✚ " # the number of changed files
|
||||
|
||||
GIT_PROMPT_UNTRACKED="${Cyan}…" # the number of untracked files/dirs
|
||||
GIT_PROMPT_STASHED="${Magenta}⚑" # the number of stashed files/dir
|
||||
GIT_PROMPT_CLEAN="${BoldGreen}✔" # a colored flag indicating a "clean" repo
|
||||
|
||||
GIT_PROMPT_UPSTREAM=" {${Magenta}_UPSTREAM_${ResetColor}}"
|
||||
|
||||
GIT_PROMPT_START_USER="[${BoldGreen}\u@\h${ResetColor} ${BoldYellow}\${?}${ResetColor} ${BoldBlue}\w${ResetColor}"
|
||||
GIT_PROMPT_START_ROOT="[${BoldRed}\u@\h${ResetColor} ${BoldYellow}\${?}${ResetColor} ${BoldBlue}\w${ResetColor}"
|
||||
GIT_PROMPT_END_USER="]$ "
|
||||
GIT_PROMPT_END_ROOT="]# "
|
||||
|
||||
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="⭑ " # This symbol is written after the branch, if the branch is not tracked
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "Evermeet_Lowres"
|
||||
@@ -1,32 +0,0 @@
|
||||
# This theme for gitprompt.sh is designed for dark color schemes
|
||||
# On lowres screens unicode characters like ✖ require a space after them
|
||||
# otherwise the following character may overlap with the unicode character
|
||||
# tweaked for Ubuntu terminal fonts
|
||||
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="Evermeet_Ubuntu"
|
||||
|
||||
GIT_PROMPT_PREFIX="" # start of the git info string
|
||||
GIT_PROMPT_SUFFIX="" # the end of the git info string
|
||||
GIT_PROMPT_SEPARATOR="|" # separates each item
|
||||
|
||||
GIT_PROMPT_BRANCH="${Magenta}" # the git branch that is active in the current directory
|
||||
GIT_PROMPT_STAGED="${Cyan}● " # the number of staged files/directories
|
||||
GIT_PROMPT_CONFLICTS="${BoldRed}✖ " # the number of files in conflict
|
||||
GIT_PROMPT_CHANGED="${Cyan}✚ " # the number of changed files
|
||||
|
||||
GIT_PROMPT_UNTRACKED="${Cyan}…" # the number of untracked files/dirs
|
||||
GIT_PROMPT_STASHED="${Magenta}⚑ " # the number of stashed files/dir
|
||||
GIT_PROMPT_CLEAN="${BoldGreen}✔ " # a colored flag indicating a "clean" repo
|
||||
|
||||
GIT_PROMPT_UPSTREAM=" {${Magenta}_UPSTREAM_${ResetColor}}"
|
||||
|
||||
GIT_PROMPT_START_USER="[${BoldGreen}\u@\h${ResetColor} ${BoldYellow}\${?}${ResetColor} ${BoldBlue}\w${ResetColor}"
|
||||
GIT_PROMPT_START_ROOT="[${BoldRed}\u@\h${ResetColor} ${BoldYellow}\${?}${ResetColor} ${BoldBlue}\w${ResetColor}"
|
||||
GIT_PROMPT_END_USER="]$ "
|
||||
GIT_PROMPT_END_ROOT="]# "
|
||||
|
||||
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="⭑ " # This symbol is written after the branch, if the branch is not tracked
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "Evermeet_Ubuntu"
|
||||
@@ -1,61 +0,0 @@
|
||||
##############################################################################
|
||||
# Changes the prompt to a Debian-style one that truncates pwd to a max length
|
||||
# depending on the terminal column width. Also uses the prompt_callback
|
||||
# function of bash-git-prompt to set the window title to almost the same
|
||||
# Debian-style. This version has been tweaked for Ubuntu standard terminal
|
||||
# fonts.
|
||||
#
|
||||
# The prompt will use a Debian-style on the form
|
||||
#
|
||||
# relative-path-from-git-toplevel-dir bash-git-prompt-info <exit status>
|
||||
# HH:MM:SS ▶
|
||||
#
|
||||
# The window title will have the form
|
||||
# relative-path-from-git-toplevel-dir
|
||||
#
|
||||
# Example usage:
|
||||
# if [ -f ~/.bash-git-prompt/gitprompt.sh ]; then
|
||||
# GIT_PROMPT_THEME=Minimal
|
||||
# source ~/.bash-git-prompt/gitprompt.sh
|
||||
# fi
|
||||
#
|
||||
# Imbibinebe <imbibinebe@gmail.com> [https://github.com/imbibinebe]
|
||||
##############################################################################
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="Minimal"
|
||||
|
||||
#Overrides the prompt_callback function used by bash-git-prompt
|
||||
function prompt_callback {
|
||||
GIT_CONTAINER_FOLDER_FULLPATH=$(git rev-parse --show-toplevel 2> /dev/null)
|
||||
GIT_CONTAINER_FOLDER=$(basename $GIT_CONTAINER_FOLDER_FULLPATH 2> /dev/null)
|
||||
CURRENT_FULLPATH=$(pwd)
|
||||
local PS1=$GIT_CONTAINER_FOLDER${CURRENT_FULLPATH#$GIT_CONTAINER_FOLDER_FULLPATH}
|
||||
gp_set_window_title "$PS1"
|
||||
echo -n "${BoldYellow}${PS1}${ResetColor}"
|
||||
}
|
||||
|
||||
Time12a="\$(date +%H:%M:%S)"
|
||||
GIT_PROMPT_BRANCH="${BoldMagenta}" # the git branch that is active in the current directory
|
||||
GIT_PROMPT_PREFIX="" # start of the git info string
|
||||
GIT_PROMPT_SUFFIX="" # the end of the git info string
|
||||
GIT_PROMPT_SEPARATOR="" # separates each item
|
||||
GIT_PROMPT_STAGED=" ${Green}●" # the number of staged files/directories
|
||||
GIT_PROMPT_CONFLICTS=" ${BoldRed}✖" # the number of files in conflict
|
||||
GIT_PROMPT_CHANGED=" ${BoldBlue}✚" # the number of changed files
|
||||
|
||||
# GIT_PROMPT_REMOTE=" " # the remote branch name (if any) and the symbols for ahead and behind
|
||||
GIT_PROMPT_UNTRACKED=" ${Cyan}…" # the number of untracked files/dirs
|
||||
GIT_PROMPT_STASHED=" ${BoldCyan}⚑" # the number of stashed files/dir
|
||||
GIT_PROMPT_CLEAN=" ${BoldGreen}✔" # a colored flag indicating a "clean" repo
|
||||
|
||||
local gp_end="_LAST_COMMAND_INDICATOR_\n${White}${Time12a}${ResetColor}"
|
||||
|
||||
GIT_PROMPT_START_USER=""
|
||||
GIT_PROMPT_END_USER="${gp_end} ▶ "
|
||||
GIT_PROMPT_END_ROOT="${gp_end} /!!!\ "
|
||||
|
||||
GIT_PROMPT_COMMAND_OK="${Green} ✔ " # indicator if the last command returned with an exit code of 0
|
||||
GIT_PROMPT_COMMAND_FAIL="${BoldRed} ✘-_LAST_COMMAND_STATE_" # indicator if the last command returned with an exit code of other than 0
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "Minimal"
|
||||
@@ -1,41 +0,0 @@
|
||||
# Plague Doctor's bash-git-prompt theme.
|
||||
#
|
||||
# Note 1: The theme is designed to work only in GIT Repos.
|
||||
# If one needs a coresponding prompt for non GIT locations, here is the code:
|
||||
#
|
||||
# if [ -f <path-to-prompt-colors.sh> ]; then
|
||||
# source <path-to-prompt-colors.sh>
|
||||
# MYPROMPT="${White}\A${ResetColor} ${BoldGreen}\\u${White}@${BoldYellow}\\h ${Cyan}\w${ResetColor}${BoldWhite} $ ${ResetColor}"
|
||||
# else
|
||||
# MYPROMPT="\[\033[37m\]\A \[\033[1m\]\[\033[32m\]\u\[\033[0m\]\[\033[37m\]@\[\033[1m\]\[\033[33m\]\h:\[\033[0m\]\[\033[36m\] \w\[\033[0m\]\[\033[1m\]\[\033[37m\] \$ \[\033[0m\]"
|
||||
# fi
|
||||
# export PS1=$MYPROMPT
|
||||
#
|
||||
# Note 2: The theme looks very nice with "FantasqueSansMono Nerd Font" https://github.com/ryanoasis/nerd-fonts
|
||||
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="Plague Doctor"
|
||||
GIT_PROMPT_ONLY_IN_REPO=1
|
||||
GIT_PROMPT_LEADING_SPACE=0
|
||||
|
||||
GIT_PROMPT_PREFIX="[ "
|
||||
GIT_PROMPT_SUFFIX=" ]"
|
||||
GIT_PROMPT_SEPARATOR=" |"
|
||||
GIT_PROMPT_STAGED=" ${Red}● ${ResetColor}"
|
||||
GIT_PROMPT_CONFLICTS=" ${Red}✖ ${ResetColor}"
|
||||
GIT_PROMPT_CHANGED=" ${Blue}✚ ${ResetColor}"
|
||||
GIT_PROMPT_UNTRACKED=" ${Cyan}…${ResetColor}"
|
||||
GIT_PROMPT_STASHED=" ${BoldBlue}⚑ ${ResetColor}"
|
||||
GIT_PROMPT_CLEAN=" ${BoldGreen}✔ ${ResetColor}"
|
||||
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="✭"
|
||||
|
||||
GIT_PROMPT_COMMAND_OK="${Green}✔ "
|
||||
GIT_PROMPT_COMMAND_FAIL="${Red}✘ "
|
||||
|
||||
GIT_PROMPT_START_USER="${BoldBlue} ${ResetColor}"
|
||||
GIT_PROMPT_START_ROOT="${BoldRed}❖ ${ResetColor}"
|
||||
GIT_PROMPT_END_USER="\n_LAST_COMMAND_INDICATOR_${White}${Time12a}${ResetColor} ${BoldGreen}\\u${White}@${BoldYellow}\\h ${Cyan}${PathShort}${ResetColor}${BoldWhite} $ ${ResetColor}"
|
||||
GIT_PROMPT_END_ROOT="\n_LAST_COMMAND_INDICATOR_${White}${Time12a}${ResetColor} ${BoldRed}\\u${White}@${BoldYellow}\\h ${Cyan}${PathShort}${ResetColor}${BoldRed} # ${ResetColor}"
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "Plague Doctor"
|
||||
@@ -1,11 +0,0 @@
|
||||
# This is an alternative approach. Single line in git repo.
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="Single_line"
|
||||
|
||||
GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${White}${Time12a}${ResetColor} ${BoldYellow}${PathShort}${ResetColor}"
|
||||
GIT_PROMPT_END_USER="${ResetColor} $ "
|
||||
GIT_PROMPT_END_ROOT="${BoldRed} # "
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "Single_line"
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
# This is an alternative approach. Single line in git repo.
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="Single_line_NoExitState"
|
||||
|
||||
GIT_PROMPT_COMMAND_FAIL="${Red}✘"
|
||||
GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${White}${Time12a}${ResetColor} ${BoldYellow}${PathShort}${ResetColor}"
|
||||
GIT_PROMPT_END_USER="${ResetColor} $ "
|
||||
GIT_PROMPT_END_ROOT="${BoldRed} # "
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "Single_line_NoExitState"
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
# This is a theme for gitprompt.sh,
|
||||
# it uses the default openSUSE bash prompt style
|
||||
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="Single_line_NoExitState_openSUSE"
|
||||
GIT_PROMPT_BRANCH="${Cyan}"
|
||||
GIT_PROMPT_UNTRACKED=" ${Cyan}…${ResetColor}"
|
||||
GIT_PROMPT_CHANGED="${Yellow}✚ "
|
||||
GIT_PROMPT_STAGED="${Magenta}●"
|
||||
|
||||
GIT_PROMPT_START_USER="\u@\h:\w"
|
||||
GIT_PROMPT_START_ROOT="${BoldRed}\h:\w"
|
||||
|
||||
GIT_PROMPT_END_USER="> "
|
||||
GIT_PROMPT_END_ROOT=" # ${ResetColor}"
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "Single_line_NoExitState_openSUSE"
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
# This is an alternative approach. Single line in git repo.
|
||||
# Theme optimised for Terminus and PowerLine compatible fonts.
|
||||
# This theme for gitprompt.sh is optimized for the "Solarized Dark" and "Solarized Light" color schemes
|
||||
# without the indicator of the last command state
|
||||
# tweaked for Ubuntu terminal fonts
|
||||
|
||||
define_helpers() {
|
||||
PathShort="${BoldBlue}\u:${Cyan}\W"
|
||||
}
|
||||
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="Single_line_Solarized"
|
||||
|
||||
|
||||
GIT_PROMPT_PREFIX="[ "
|
||||
GIT_PROMPT_SUFFIX=" ]"
|
||||
GIT_PROMPT_SEPARATOR=" |"
|
||||
GIT_PROMPT_STAGED=" ${Yellow}● ${ResetColor}"
|
||||
GIT_PROMPT_CONFLICTS=" ${Red}✖ ${ResetColor}"
|
||||
GIT_PROMPT_CHANGED=" ${Blue}✚ ${ResetColor}"
|
||||
GIT_PROMPT_UNTRACKED=" ${Cyan}…${ResetColor}"
|
||||
GIT_PROMPT_STASHED=" ${BoldMagenta}⚑ ${ResetColor}"
|
||||
GIT_PROMPT_CLEAN=" ${Green}✔ ${ResetColor}"
|
||||
|
||||
GIT_PROMPT_COMMAND_FAIL="${Red}✘"
|
||||
|
||||
GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${Yellow}${PathShort}${ResetColor}"
|
||||
GIT_PROMPT_END_USER="${BoldBlue} ➭ ${ResetColor}"
|
||||
GIT_PROMPT_END_ROOT="${BoldRed} # "
|
||||
|
||||
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="✭"
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "Single_line_Solarized"
|
||||
@@ -1,25 +0,0 @@
|
||||
# This is an alternative approach. Single line in git repo.
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="Single_line_Ubuntu"
|
||||
|
||||
GIT_PROMPT_PREFIX="[ "
|
||||
GIT_PROMPT_SUFFIX=" ]"
|
||||
GIT_PROMPT_SEPARATOR=" |"
|
||||
GIT_PROMPT_STAGED=" ${Red}● ${ResetColor}"
|
||||
GIT_PROMPT_CONFLICTS=" ${Red}✖ ${ResetColor}"
|
||||
GIT_PROMPT_CHANGED=" ${Blue}✚ ${ResetColor}"
|
||||
GIT_PROMPT_UNTRACKED=" ${Cyan}…${ResetColor}"
|
||||
GIT_PROMPT_STASHED=" ${BoldBlue}⚑ ${ResetColor}"
|
||||
GIT_PROMPT_CLEAN=" ${BoldGreen}✔ ${ResetColor}"
|
||||
|
||||
GIT_PROMPT_COMMAND_OK="${Green}✔ "
|
||||
GIT_PROMPT_COMMAND_FAIL="${Red}✘ "
|
||||
|
||||
GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${White}${Time12a}${ResetColor} ${Cyan}${PathShort}${ResetColor}"
|
||||
GIT_PROMPT_END_USER="${ResetColor} $ "
|
||||
GIT_PROMPT_END_ROOT="${BoldRed} # "
|
||||
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "Single_line_Ubuntu"
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
# This is a theme for gitprompt.sh,
|
||||
# it uses the default openSUSE bash prompt style with exit status
|
||||
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="Single_line_openSUSE"
|
||||
GIT_PROMPT_BRANCH="${Cyan}"
|
||||
GIT_PROMPT_UNTRACKED=" ${Cyan}…${ResetColor}"
|
||||
GIT_PROMPT_CHANGED="${Yellow}✚ "
|
||||
GIT_PROMPT_STAGED="${Magenta}●"
|
||||
|
||||
GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${ResetColor}\u@\h:\w"
|
||||
GIT_PROMPT_START_ROOT="_LAST_COMMAND_INDICATOR_ ${BoldRed}\h:\w"
|
||||
|
||||
GIT_PROMPT_END_USER="${ResetColor}> "
|
||||
GIT_PROMPT_END_ROOT=" # ${ResetColor}"
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "Single_line_openSUSE"
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
# This theme for gitprompt.sh is optimized for the "Solarized Dark" and "Solarized Light" color schemes
|
||||
# tweaked for Ubuntu terminal fonts
|
||||
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="Solarized"
|
||||
GIT_PROMPT_STAGED="${Yellow}●"
|
||||
GIT_PROMPT_STASHED="${BoldMagenta}⚑ "
|
||||
GIT_PROMPT_CLEAN="${Green}✔"
|
||||
GIT_PROMPT_END_USER=" \n${BoldBlue}${Time12a}${ResetColor} $ "
|
||||
GIT_PROMPT_END_ROOT=" \n${BoldBlue}${Time12a}${ResetColor} # "
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "Solarized"
|
||||
@@ -1,41 +0,0 @@
|
||||
# This theme for gitprompt.sh is optimized for the "Solarized Dark" and "Solarized Light" color schemes
|
||||
# tweaked for Ubuntu terminal fonts
|
||||
# some modifications on colors
|
||||
# added ruby prompt, and kernel version as well
|
||||
|
||||
override_git_prompt_colors() {
|
||||
if [ -e ~/.rvm/bin/rvm-prompt ]; then
|
||||
RUBY_PROMPT='{$(~/.rvm/bin/rvm-prompt i v)}'
|
||||
else
|
||||
if command -v rbenv > /dev/null; then
|
||||
RUBY_PROMPT='{$(rbenv version | sed -e "s/ (set.*$//")}'
|
||||
fi
|
||||
fi
|
||||
Time12a="\$(date +%H:%M:%S)"
|
||||
|
||||
GIT_PROMPT_THEME_NAME="Solarized Extravagant"
|
||||
GIT_PROMPT_STAGED="${Yellow}● "
|
||||
GIT_PROMPT_UNTRACKED="${Cyan}… "
|
||||
GIT_PROMPT_STASHED="${BoldMagenta}⚑ "
|
||||
GIT_PROMPT_CLEAN="${Green}✔ "
|
||||
GIT_PROMPT_COMMAND_OK="${Green}✔ "
|
||||
GIT_PROMPT_COMMAND_FAIL="${Red}✘ "
|
||||
|
||||
KERNEL_PROMPT='‹$(uname -r)›'
|
||||
|
||||
GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${BoldBlueFg}${Time12a} ${Green}${KERNEL_PROMPT} ${Cyan}${RUBY_PROMPT} ${Yellow}${PathShort}"
|
||||
GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}"
|
||||
if [ -n "$SSH_CLIENT" ]; then
|
||||
GIT_PROMPT_END_USER="\n${BoldRed} ➤ ${ResetColor}"
|
||||
GIT_PROMPT_END_ROOT="\n${BoldRed} » ${ResetColor}"
|
||||
else
|
||||
GIT_PROMPT_END_USER="\n${BoldBlue} ➭ ${ResetColor}"
|
||||
GIT_PROMPT_END_ROOT="\n${BoldRed} # ${ResetColor}"
|
||||
fi
|
||||
GIT_PROMPT_LEADING_SPACE=1
|
||||
GIT_PROMPT_PREFIX="${Cyan}["
|
||||
GIT_PROMPT_SUFFIX="${Cyan}]"
|
||||
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="✭"
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "Solarized Extravagant"
|
||||
@@ -1,16 +0,0 @@
|
||||
# This theme for gitprompt.sh is optimized for the "Solarized Dark" and "Solarized Light" color schemes
|
||||
# without the indicator of the last command state
|
||||
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="Solarized NoExitState"
|
||||
GIT_PROMPT_STAGED="${Yellow}●"
|
||||
GIT_PROMPT_STASHED="${BoldMagenta}⚑ "
|
||||
GIT_PROMPT_CLEAN="${Green}✔"
|
||||
GIT_PROMPT_COMMAND_FAIL="${Red}✘"
|
||||
GIT_PROMPT_START_USER="${Yellow}${PathShort}${ResetColor}"
|
||||
GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}"
|
||||
GIT_PROMPT_END_USER=" \n${BoldBlue}${Time12a}${ResetColor} $ "
|
||||
GIT_PROMPT_END_ROOT=" \n${BoldBlue}${Time12a}${ResetColor} # "
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "Solarized NoExitState"
|
||||
@@ -1,18 +0,0 @@
|
||||
# This theme for gitprompt.sh is optimized for the "Solarized Dark" and "Solarized Light" color schemes
|
||||
# without the indicator of the last command state
|
||||
# tweaked for Ubuntu terminal fonts
|
||||
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="Solarized NoExitState Ubuntu"
|
||||
GIT_PROMPT_STAGED="${Yellow}● "
|
||||
GIT_PROMPT_STASHED="${BoldMagenta}⚑ "
|
||||
GIT_PROMPT_CLEAN="${Green}✔ "
|
||||
GIT_PROMPT_COMMAND_OK="${Green}✔ "
|
||||
GIT_PROMPT_COMMAND_FAIL="${Red}✘ "
|
||||
GIT_PROMPT_START_USER="${Yellow}${PathShort}${ResetColor}"
|
||||
GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}"
|
||||
GIT_PROMPT_END_USER=" \n${BoldBlue}${Time12a}${ResetColor} $ "
|
||||
GIT_PROMPT_END_ROOT=" \n${BoldBlue}${Time12a}${ResetColor} # "
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "Solarized NoExitState Ubuntu"
|
||||
@@ -1,14 +0,0 @@
|
||||
# This theme for gitprompt.sh is optimized for the "Solarized Dark" and "Solarized Light" color schemes
|
||||
# tweaked for Ubuntu terminal fonts
|
||||
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="Solarized Ubuntu"
|
||||
GIT_PROMPT_STAGED="${Yellow}● "
|
||||
GIT_PROMPT_STASHED="${BoldMagenta}⚑ "
|
||||
GIT_PROMPT_CLEAN="${Green}✔ "
|
||||
GIT_PROMPT_COMMAND_OK="${Green}✔ "
|
||||
GIT_PROMPT_END_USER=" \n${BoldBlue}${Time12a}${ResetColor} $ "
|
||||
GIT_PROMPT_END_ROOT=" \n${BoldBlue}${Time12a}${ResetColor} # "
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "Solarized Ubuntu"
|
||||
@@ -1,23 +0,0 @@
|
||||
# This theme for gitprompt.sh is optimized for the "Solarized Dark" and "Solarized Light" color schemes
|
||||
# based on "Solarized Extravagant", with user@host on the second line and some things removed.
|
||||
|
||||
function override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME='Solarized UserHost'
|
||||
GIT_PROMPT_STAGED="${Yellow}● "
|
||||
GIT_PROMPT_UNTRACKED="${Cyan}… "
|
||||
GIT_PROMPT_STASHED="${BoldMagenta}⚑ "
|
||||
GIT_PROMPT_CLEAN="${Green}✔ "
|
||||
GIT_PROMPT_COMMAND_OK="${Green}✔ "
|
||||
GIT_PROMPT_COMMAND_FAIL="${Red}✘ "
|
||||
|
||||
GIT_PROMPT_START_USER="_LAST_COMMAND_INDICATOR_ ${Yellow}${PathShort}"
|
||||
GIT_PROMPT_START_ROOT="${GIT_PROMPT_START_USER}"
|
||||
GIT_PROMPT_END_USER="\n${Blue}\\u${White}@${BoldBlue}\\h ${BoldRed} ➤ ${ResetColor} "
|
||||
GIT_PROMPT_END_ROOT="\n${Blue}\\u${White}@${BoldBlue}\\h ${BoldRed} #️ ${ResetColor} "
|
||||
GIT_PROMPT_LEADING_SPACE=1
|
||||
GIT_PROMPT_PREFIX="${Cyan}["
|
||||
GIT_PROMPT_SUFFIX="${Cyan}]"
|
||||
GIT_PROMPT_SYMBOLS_NO_REMOTE_TRACKING="✭"
|
||||
}
|
||||
|
||||
reload_git_prompt_colors 'Solarized UserHost'
|
||||
@@ -1,40 +0,0 @@
|
||||
##############################################################################
|
||||
# Changes the prompt to a Debian-style one that truncates pwd to a max length
|
||||
# depending on the terminal column width. Also uses the prompt_callback
|
||||
# function of bash-git-prompt to set the window title to almost the same
|
||||
# Debian-style.
|
||||
#
|
||||
# The prompt will use a Debian-style on the form
|
||||
#
|
||||
# [user@host: <truncated PWD>] [bash-git-prompt-info] <exit status>
|
||||
# HH:MM $
|
||||
#
|
||||
# The window title will have the form
|
||||
# user@host: <truncated PWD>
|
||||
#
|
||||
# Example usage:
|
||||
# if [ -f ~/.bash-git-prompt/gitprompt.sh ]; then
|
||||
# GIT_PROMPT_THEME=TruncatedPwd_WindowTitle
|
||||
# source ~/.bash-git-prompt/gitprompt.sh
|
||||
# fi
|
||||
#
|
||||
# oGre <oGre@muppfarmen.se> [https://github.com/ogr3]
|
||||
##############################################################################
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="TruncatedPwd_WindowTitle"
|
||||
|
||||
#Overrides the prompt_callback function used by bash-git-prompt
|
||||
function prompt_callback {
|
||||
local PS1="\u@\h: $(gp_truncate_pwd)"
|
||||
gp_set_window_title "$PS1"
|
||||
echo -n "${Yellow}[${PS1}]${ResetColor}"
|
||||
}
|
||||
|
||||
local gp_end=" _LAST_COMMAND_INDICATOR_\n${White}${Time12a}${ResetColor}"
|
||||
|
||||
GIT_PROMPT_START_USER=""
|
||||
GIT_PROMPT_END_USER="${gp_end} $ "
|
||||
GIT_PROMPT_END_ROOT="${gp_end} # "
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "TruncatedPwd_WindowTitle"
|
||||
@@ -1,40 +0,0 @@
|
||||
##############################################################################
|
||||
# Changes the prompt to a Debian-style one that truncates pwd to a max length
|
||||
# depending on the terminal column width. Also uses the prompt_callback
|
||||
# function of bash-git-prompt to set the window title to almost the same
|
||||
# Debian-style.
|
||||
#
|
||||
# The prompt will use a Debian-style on the form
|
||||
#
|
||||
# [user@host: <truncated PWD>] [bash-git-prompt-info]
|
||||
# HH:MM $
|
||||
#
|
||||
# The window title will have the form
|
||||
# user@host: <truncated PWD>
|
||||
#
|
||||
# Example usage:
|
||||
# if [ -f ~/.bash-git-prompt/gitprompt.sh ]; then
|
||||
# GIT_PROMPT_THEME=TruncatedPwd_WindowTitle_NoExitState
|
||||
# source ~/.bash-git-prompt/gitprompt.sh
|
||||
# fi
|
||||
#
|
||||
# oGre <oGre@muppfarmen.se> [https://github.com/ogr3]
|
||||
##############################################################################
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="TruncatedPwd_WindowTitle_NoExitState"
|
||||
|
||||
#Overrides the prompt_callback function used by bash-git-prompt
|
||||
function prompt_callback {
|
||||
local PS1="\u@\h: $(gp_truncate_pwd)"
|
||||
gp_set_window_title "$PS1"
|
||||
echo -n "${Yellow}[${PS1}]${ResetColor}"
|
||||
}
|
||||
|
||||
local gp_end=" _LAST_COMMAND_INDICATOR_\n${White}${Time12a}${ResetColor}"
|
||||
|
||||
GIT_PROMPT_START_USER=""
|
||||
GIT_PROMPT_END_USER="${gp_end} $ "
|
||||
GIT_PROMPT_END_ROOT="${gp_end} # "
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "TruncatedPwd_WindowTitle_NoExitState"
|
||||
@@ -1,46 +0,0 @@
|
||||
##############################################################################
|
||||
# Changes the prompt to a Debian-style one that truncates pwd to a max length
|
||||
# depending on the terminal column width. Also uses the prompt_callback
|
||||
# function of bash-git-prompt to set the window title to almost the same
|
||||
# Debian-style. This version has been tweaked for Ubuntu standard terminal
|
||||
# fonts.
|
||||
#
|
||||
# The prompt will use a Debian-style on the form
|
||||
#
|
||||
# [user@host: <truncated PWD>] [bash-git-prompt-info]
|
||||
# HH:MM $
|
||||
#
|
||||
# The window title will have the form
|
||||
# user@host: <truncated PWD>
|
||||
#
|
||||
# Example usage:
|
||||
# if [ -f ~/.bash-git-prompt/gitprompt.sh ]; then
|
||||
# GIT_PROMPT_THEME=TruncatedPwd_WindowTitle_NoExitState_Ubuntu
|
||||
# source ~/.bash-git-prompt/gitprompt.sh
|
||||
# fi
|
||||
#
|
||||
# oGre <oGre@muppfarmen.se> [https://github.com/ogr3]
|
||||
##############################################################################
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="TruncatedPwd_WindowTitle_NoExitState_Ubuntu"
|
||||
|
||||
#Overrides the prompt_callback function used by bash-git-prompt
|
||||
function prompt_callback {
|
||||
local PS1="\u@\h: $(gp_truncate_pwd)"
|
||||
gp_set_window_title "$PS1"
|
||||
echo -n "${Yellow}[${PS1}]${ResetColor}"
|
||||
}
|
||||
|
||||
local gp_end=" _LAST_COMMAND_INDICATOR_\n${White}${Time12a}${ResetColor}"
|
||||
|
||||
GIT_PROMPT_START_USER=""
|
||||
GIT_PROMPT_END_USER="${gp_end} $ "
|
||||
GIT_PROMPT_END_ROOT="${gp_end} # "
|
||||
|
||||
GIT_PROMPT_STAGED="${Red}● " # the number of staged files/directories
|
||||
GIT_PROMPT_CLEAN="${BoldGreen}✔ " # a colored flag indicating a "clean" repo
|
||||
GIT_PROMPT_COMMAND_OK="${Green}✔ " # indicator if the last command returned with an exit code of 0
|
||||
GIT_PROMPT_COMMAND_FAIL="${Red}✘ " # indicator if the last command returned with an exit code of other than 0
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "TruncatedPwd_WindowTitle_NoExitState_Ubuntu"
|
||||
@@ -1,45 +0,0 @@
|
||||
##############################################################################
|
||||
# Changes the prompt to a Debian-style one that truncates pwd to a max length
|
||||
# depending on the terminal column width. Also uses the prompt_callback
|
||||
# function of bash-git-prompt to set the window title to almost the same
|
||||
# Debian-style. This version has been tweaked for Ubuntu standard terminal
|
||||
# fonts.
|
||||
#
|
||||
# The prompt will use a Debian-style on the form
|
||||
#
|
||||
# [user@host: <truncated PWD>] [bash-git-prompt-info] <exit status>
|
||||
# HH:MM $
|
||||
#
|
||||
# The window title will have the form
|
||||
# user@host: <truncated PWD>
|
||||
#
|
||||
# Example usage:
|
||||
# if [ -f ~/.bash-git-prompt/gitprompt.sh ]; then
|
||||
# GIT_PROMPT_THEME=TruncatedPwd_WindowTitle_Ubuntu
|
||||
# source ~/.bash-git-prompt/gitprompt.sh
|
||||
# fi
|
||||
#
|
||||
# oGre <oGre@muppfarmen.se> [https://github.com/ogr3]
|
||||
##############################################################################
|
||||
override_git_prompt_colors() {
|
||||
GIT_PROMPT_THEME_NAME="TruncatedPwd_WindowTitle_Ubuntu"
|
||||
|
||||
#Overrides the prompt_callback function used by bash-git-prompt
|
||||
function prompt_callback {
|
||||
local PS1="\u@\h: $(gp_truncate_pwd)"
|
||||
gp_set_window_title "$PS1"
|
||||
echo -n "${Yellow}[${PS1}]${ResetColor}"
|
||||
}
|
||||
|
||||
local gp_end=" _LAST_COMMAND_INDICATOR_\n${White}${Time12a}${ResetColor}"
|
||||
|
||||
GIT_PROMPT_START_USER=""
|
||||
GIT_PROMPT_END_USER="${gp_end} $ "
|
||||
GIT_PROMPT_END_ROOT="${gp_end} # "
|
||||
|
||||
GIT_PROMPT_STAGED="${Red}● " # the number of staged files/directories
|
||||
GIT_PROMPT_CLEAN="${BoldGreen}✔ " # a colored flag indicating a "clean" repo
|
||||
GIT_PROMPT_COMMAND_OK="${Green}✔ " # indicator if the last command returned with an exit code of 0
|
||||
}
|
||||
|
||||
reload_git_prompt_colors "TruncatedPwd_WindowTitle_Ubuntu"
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
os.system('meld "%s" "%s"' % (sys.argv[2], sys.argv[5]))
|
||||
Submodule
+1
Submodule dotbot added at 9cd5d073f2
@@ -0,0 +1,57 @@
|
||||
- defaults:
|
||||
link:
|
||||
relink: true
|
||||
|
||||
- clean: ['~']
|
||||
|
||||
- create:
|
||||
- ~/.config
|
||||
- ~/.config/bash
|
||||
- ~/.config/herdr
|
||||
- ~/.config/tmux
|
||||
- ~/.claude
|
||||
|
||||
- link:
|
||||
# git
|
||||
~/.gitconfig: home/gitconfig
|
||||
~/.config/.gitignore_global: home/config/gitignore_global
|
||||
|
||||
# bash
|
||||
~/.bashrc: home/bashrc
|
||||
~/.config/bash/.bash_profile: home/config/bash/bash_profile
|
||||
~/.git-completion.bash: home/config/bash/git-completion.bash
|
||||
~/.git-prompt-colors.sh: home/config/bash/git-prompt-colors.sh
|
||||
|
||||
# apps
|
||||
~/.config/alacritty: home/config/alacritty
|
||||
~/.config/btop: home/config/btop
|
||||
~/.config/herdr/config.toml: home/config/herdr/config.toml
|
||||
|
||||
# tmux
|
||||
~/.tmux.conf: home/tmux.conf
|
||||
~/.config/tmux/plugins: home/config/tmux/plugins
|
||||
~/.config/tmux/themes: home/config/tmux/themes
|
||||
|
||||
~/.config/.aliases: home/config/aliases
|
||||
|
||||
# vim
|
||||
~/.vim : home/vim
|
||||
~/.vimrc: home/vimrc
|
||||
|
||||
# zsh
|
||||
~/.zshenv: home/zshenv
|
||||
~/.config/zsh: home/config/zsh
|
||||
|
||||
# claude code
|
||||
~/.claude/skills: home/claude/skills
|
||||
|
||||
# mac os
|
||||
~/.hushlogin:
|
||||
if: '[ `uname` = Darwin ]'
|
||||
path: macos/hushlogin
|
||||
|
||||
- shell:
|
||||
- command: ./shell/setup.sh
|
||||
stdin: true
|
||||
stdout: true
|
||||
stderr: true
|
||||
@@ -0,0 +1,10 @@
|
||||
## TODO:
|
||||
## cask_personal using some variable?
|
||||
|
||||
- shell:
|
||||
- stdin: true
|
||||
stdout: true
|
||||
command: >
|
||||
if [ "$(uname)" = "Darwin" ]; then
|
||||
brew bundle --file ./macos/Caskfile.personal
|
||||
fi
|
||||
@@ -0,0 +1,15 @@
|
||||
- shell:
|
||||
-
|
||||
stdin: true
|
||||
stdout: true
|
||||
description: Setting Mac OS defaults
|
||||
command: >
|
||||
if [ "$(uname)" = "Darwin" ]; then
|
||||
xcode-select -p &>/dev/null || xcode-select --install
|
||||
./shell/macos_setup.sh
|
||||
fi
|
||||
-
|
||||
command: ./shell/clone.sh
|
||||
description: Cloning Git repos
|
||||
stdout: true
|
||||
quiet: false
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Usage: extract <file>
|
||||
# Description: extracts archived files / mounts disk images
|
||||
# Note: .dmg/hdiutil is macOS-specific.
|
||||
#
|
||||
# credit: http://nparikh.org/notes/zshrc.txt
|
||||
extract () {
|
||||
if [ -f $1 ]; then
|
||||
case $1 in
|
||||
*.tar.bz2) tar -jxvf $1 ;;
|
||||
*.tar.gz) tar -zxvf $1 ;;
|
||||
*.bz2) bunzip2 $1 ;;
|
||||
*.dmg) hdiutil mount $1 ;;
|
||||
*.gz) gunzip $1 ;;
|
||||
*.tar) tar -xvf $1 ;;
|
||||
*.tbz2) tar -jxvf $1 ;;
|
||||
*.tgz) tar -zxvf $1 ;;
|
||||
*.zip) unzip $1 ;;
|
||||
*.ZIP) unzip $1 ;;
|
||||
*.pax) cat $1 | pax -r ;;
|
||||
*.pax.Z) uncompress $1 --stdout | pax -r ;;
|
||||
*.rar) unrar x $1 ;;
|
||||
*.Z) uncompress $1 ;;
|
||||
*) echo "'$1' cannot be extracted/mounted via extract()" ;;
|
||||
esac
|
||||
else
|
||||
echo "'$1' is not a valid file"
|
||||
fi
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# set_alias_with_backup - A Bash function to alias a command while preserving the original.
|
||||
#
|
||||
# Usage:
|
||||
# set_alias_with_backup <alias_name> <new_command>
|
||||
#
|
||||
# Parameters:
|
||||
# alias_name: The alias name to override (e.g., "cat").
|
||||
# new_command: The command to alias to (e.g., "bat").
|
||||
#
|
||||
# Behavior:
|
||||
# - Checks if the new command exists.
|
||||
# - If it exists and the backup alias (alias_name with an underscore appended) isn't set,
|
||||
# it creates a backup alias pointing to the original command.
|
||||
# - Sets the alias (alias_name) to use the new command.
|
||||
#
|
||||
# Example:
|
||||
# To alias "bat" as "cat" and preserve the original "cat" as "cat_", run:
|
||||
# set_alias_with_backup cat bat
|
||||
set_alias_with_backup() {
|
||||
local alias_name="$1"
|
||||
local new_cmd="$2"
|
||||
|
||||
# Allow for extra parameters to be passed to the new command.
|
||||
shift 2
|
||||
local extra_params="$*"
|
||||
|
||||
# Check that both arguments are provided.
|
||||
if [ -z "$alias_name" ] || [ -z "$new_cmd" ]; then
|
||||
echo "Usage: set_alias_with_backup <alias_name> <new_command> [extra_params]"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Check that the new command exists.
|
||||
if type "$new_cmd" >/dev/null 2>&1; then
|
||||
# Define a backup alias by appending an underscore
|
||||
# (e.g., "cat_" for "cat")
|
||||
local backup_alias="${alias_name}_"
|
||||
|
||||
# If the backup alias isn't already set, create it pointing
|
||||
# to the original command.
|
||||
if ! type "$backup_alias" >/dev/null 2>&1; then
|
||||
alias "$backup_alias"="$(which "$alias_name")"
|
||||
fi
|
||||
|
||||
# Create the alias: e.g., alias "cat" to "bat" and pass any extra params.
|
||||
alias "$alias_name"="$new_cmd $extra_params"
|
||||
fi
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
[ -n "$PS1" ] && source ~/.config/bash/.bash_profile;
|
||||
|
||||
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
|
||||
@@ -0,0 +1,27 @@
|
||||
[general]
|
||||
import = [
|
||||
"~/.config/alacritty/tomorrow-night-gardev.toml"
|
||||
]
|
||||
|
||||
[window]
|
||||
padding = { x = 16, y = 8 }
|
||||
dynamic_title = true
|
||||
option_as_alt = "OnlyLeft"
|
||||
|
||||
[scrolling]
|
||||
history = 10000
|
||||
multiplier = 3
|
||||
|
||||
[font]
|
||||
normal = { family = "CaskaydiaCove Nerd Font Mono", style = "Regular" }
|
||||
size = 14
|
||||
offset = { y = 1 }
|
||||
|
||||
[cursor]
|
||||
style = { shape = "Beam", blinking = "Always" }
|
||||
|
||||
[[hints.enabled]]
|
||||
regex = "https?://[^\\s]+"
|
||||
hyperlinks = true
|
||||
command = { program = "open" }
|
||||
mouse = { enabled = true }
|
||||
@@ -0,0 +1,34 @@
|
||||
# Colors (Tomorrow Night)
|
||||
[colors]
|
||||
draw_bold_text_with_bright_colors = true
|
||||
|
||||
# Default colors
|
||||
[colors.primary]
|
||||
background = '#27292b'
|
||||
foreground = '#d0d2d0'
|
||||
|
||||
[colors.cursor]
|
||||
text = '#27292b'
|
||||
cursor = '#d0d2d0'
|
||||
|
||||
# Normal colors
|
||||
[colors.normal]
|
||||
black = '#777777'
|
||||
red = '#ca807b'
|
||||
green = '#c2c683'
|
||||
yellow = '#edd090'
|
||||
blue = '#98b0c7'
|
||||
magenta = '#bba7c4'
|
||||
cyan = '#a3c7c3'
|
||||
white = '#fefefe'
|
||||
|
||||
# Bright colors
|
||||
[colors.bright]
|
||||
black = '#999999'
|
||||
red = '#ca807b'
|
||||
green = '#c2c683'
|
||||
yellow = '#edd090'
|
||||
blue = '#98b0c7'
|
||||
magenta = '#bba7c4'
|
||||
cyan = '#a3c7c3'
|
||||
white = '#fefefe'
|
||||
@@ -0,0 +1,32 @@
|
||||
# Colors (Tomorrow Night)
|
||||
|
||||
# Default colors
|
||||
[colors.primary]
|
||||
background = '#1d1f21'
|
||||
foreground = '#c5c8c6'
|
||||
|
||||
[colors.cursor]
|
||||
text = '#1d1f21'
|
||||
cursor = '#ffffff'
|
||||
|
||||
# Normal colors
|
||||
[colors.normal]
|
||||
black = '#1d1f21'
|
||||
red = '#cc6666'
|
||||
green = '#b5bd68'
|
||||
yellow = '#e6c547'
|
||||
blue = '#81a2be'
|
||||
magenta = '#b294bb'
|
||||
cyan = '#70c0ba'
|
||||
white = '#373b41'
|
||||
|
||||
# Bright colors
|
||||
[colors.bright]
|
||||
black = '#666666'
|
||||
red = '#ff3334'
|
||||
green = '#9ec400'
|
||||
yellow = '#f0c674'
|
||||
blue = '#81a2be'
|
||||
magenta = '#b77ee0'
|
||||
cyan = '#54ced6'
|
||||
white = '#282a2e'
|
||||
@@ -0,0 +1,142 @@
|
||||
##### Platform independent #####
|
||||
|
||||
# Files
|
||||
alias ...="cd ../../"
|
||||
alias ....="cd ../../../"
|
||||
|
||||
alias ll='ls -alhFG'
|
||||
alias la='ls -AG'
|
||||
alias l='ls -CFG'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
alias fgrep='fgrep --color=auto'
|
||||
alias egrep='egrep --color=auto'
|
||||
|
||||
# CD-ing to some commonly used folders
|
||||
alias og="cd ~/Git"
|
||||
alias dotfiles="cd ~/Git/dotfiles"
|
||||
|
||||
# Editing files
|
||||
alias raliases="source ~/.config/.aliases && source ~/.config/.aliases.local"
|
||||
alias aliases="code ~/.config/.aliases"
|
||||
alias laliases="code ~/.config/.aliases.local"
|
||||
alias zshrc="code $ZDOTDIR/.zshrc"
|
||||
alias lzshrc="code $ZDOTDIR/.zshrc.local"
|
||||
alias vimrc="vim ~/.vimrc"
|
||||
|
||||
# NPM
|
||||
alias npr="npm run"
|
||||
|
||||
# IP addresses & networking
|
||||
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
|
||||
alias localip="ipconfig getifaddr en0"
|
||||
|
||||
# Misc
|
||||
alias c="clear"
|
||||
alias be="bundle exec"
|
||||
alias serve="python -m http.server 9000"
|
||||
alias yda="youtube-dl -x --audio-format mp3"
|
||||
|
||||
# tmux
|
||||
if type tmux >/dev/null 2>&1; then
|
||||
alias tm="tmux -2 attach-session -t "default" || tmux -2 new-session -s \"default\""
|
||||
alias tmv="tmux -2 attach-session -t "vscode" || tmux -2 new-session -s \"vscode\""
|
||||
alias tmks="tmux kill-session -t"
|
||||
alias tmas="tmux attach-session -t"
|
||||
alias tmls="tmux list-sessions"
|
||||
fi
|
||||
|
||||
# Docker
|
||||
if type docker >/dev/null 2>&1; then
|
||||
alias dc="docker compose"
|
||||
alias de="docker exec"
|
||||
alias dr="docker run"
|
||||
alias db="docker build"
|
||||
alias ds="docker stop"
|
||||
alias drm="docker rm"
|
||||
alias drmi="docker rmi"
|
||||
alias dps="docker ps"
|
||||
alias dl="docker logs"
|
||||
fi
|
||||
|
||||
# Git Aliases
|
||||
if type git >/dev/null 2>&1; then
|
||||
alias g="git"
|
||||
alias ga="git add"
|
||||
alias gr="git rm"
|
||||
alias gc="git commit"
|
||||
alias gs="git status -s"
|
||||
alias gss="git status"
|
||||
alias gd="git diff"
|
||||
alias gds="git diff --staged"
|
||||
alias gco="git checkout"
|
||||
alias gcom="git checkout master"
|
||||
alias gpom="git pull origin master"
|
||||
alias gbd="git branch -D"
|
||||
alias gm="git mergetool"
|
||||
alias gmc="git merge --continue"
|
||||
alias grc="git rebase --continue"
|
||||
alias gsf="git sf"
|
||||
alias gaf="git af"
|
||||
alias gmf="git mf"
|
||||
fi
|
||||
|
||||
# Github CLI Aliases
|
||||
if type gh >/dev/null 2>&1; then
|
||||
alias gp="gh pr"
|
||||
alias gps="gh pr status"
|
||||
|
||||
# my prs
|
||||
alias prso="gh pr list --author @me --state open"
|
||||
|
||||
function prsob() {
|
||||
gh pr list --author $1 --state open
|
||||
}
|
||||
|
||||
function prscb() {
|
||||
gh pr list --author $1 --state closed
|
||||
}
|
||||
fi
|
||||
|
||||
if type systemctl >/dev/null 2>&1; then
|
||||
alias ssc="sudo systemctl"
|
||||
alias sc="systemctl"
|
||||
alias scs="systemctl status"
|
||||
alias scst="systemctl start"
|
||||
fi
|
||||
|
||||
# eza aliases, if available
|
||||
if type eza >/dev/null 2>&1; then
|
||||
eza_params=(
|
||||
'--git' '--icons' '--group' '--group-directories-first'
|
||||
'--time-style=relative'
|
||||
)
|
||||
alias ls='eza $eza_params -1'
|
||||
alias l='eza --git-ignore $eza_params'
|
||||
alias ll='eza --all --header --long $eza_params'
|
||||
alias llm='eza --all --header --long --sort=modified $eza_params'
|
||||
alias la='eza -lbhHigUmuSa'
|
||||
alias lx='eza -lbhHigUmuSa@'
|
||||
alias lt='eza --tree $eza_params'
|
||||
alias tree='eza --tree $eza_params'
|
||||
|
||||
alias lA='ll --sort=acc'
|
||||
alias lC='ll --sort=cr'
|
||||
alias lM='ll --sort=mod'
|
||||
alias lS='ll --sort=size'
|
||||
alias lX='ll --sort=ext'
|
||||
fi
|
||||
|
||||
set_alias_with_backup cat bat
|
||||
set_alias_with_backup dig doggo
|
||||
set_alias_with_backup df duf
|
||||
set_alias_with_backup ping gping
|
||||
set_alias_with_backup du dust --no-percent-bars
|
||||
|
||||
##### Mac OS Specific #####
|
||||
if [ "$(uname)" = "Darwin" ]; then
|
||||
alias fl="open -a ForkLift"
|
||||
alias flushdns="sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder"
|
||||
alias copyssh="pbcopy < $HOME/.ssh/id_ed25519.pub"
|
||||
alias scr="open -b com.apple.ScreenSaver.Engine"
|
||||
fi
|
||||
@@ -0,0 +1 @@
|
||||
.bash_profile.local
|
||||
Submodule
+1
Submodule home/config/bash/bash-git-prompt added at 622e337d11
@@ -0,0 +1,96 @@
|
||||
# Set prompt
|
||||
IFS='.' read -ra split_hostname <<<$(hostname | tr '[:upper:]' '[:lower:]')
|
||||
HOSTNAME=${split_hostname[0]}
|
||||
PS1='\[\e[1;4;36m\]$HOSTNAME\[\e[1;0m\] \[\e[1;32m\]\w\[\e[m\]\[\e[1;0m\] \[\e[0m\] \[\e[1;0m\]'
|
||||
export TERM=xterm-256color
|
||||
|
||||
shopt -s cdspell
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# Enable some Bash 4 features when possible:
|
||||
# * `autocd`, e.g. `**/qux` will enter `./foo/bar/baz/qux`
|
||||
# * Recursive globbing, e.g. `echo **/*.txt`
|
||||
for option in autocd globstar; do
|
||||
shopt -s "$option" 2> /dev/null;
|
||||
done;
|
||||
|
||||
# Disable Caret-C output
|
||||
stty -ctlecho
|
||||
|
||||
set -o vi
|
||||
bind -m vi-insert "\C-l":clear-screen
|
||||
|
||||
#so as not to be disturbed by Ctrl-S ctrl-Q in terminals:
|
||||
stty -ixon
|
||||
|
||||
######################
|
||||
# History Management #
|
||||
######################
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
|
||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||
HISTSIZE=5000
|
||||
HISTFILESIZE=2000
|
||||
|
||||
# don't put duplicate lines or lines starting with space in the history.
|
||||
# See bash(1) for more options
|
||||
HISTCONTROL=ignoreboth
|
||||
|
||||
######################
|
||||
# Aliases #
|
||||
######################
|
||||
|
||||
# enable color support of ls
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
fi
|
||||
|
||||
# Editor
|
||||
export EDITOR='code -w'
|
||||
|
||||
# bash-git-prompt
|
||||
GIT_PROMPT_ONLY_IN_REPO=1
|
||||
GIT_PROMPT_START="\[\e[1;4;36m\]$HOSTNAME\[\e[1;0m\] \[\e[1;32m\]\w\[\e[m\]"
|
||||
GIT_PROMPT_END="\[\e[1;m\] \[\e[1;m\]"
|
||||
|
||||
|
||||
# Disable deprecation warning on mac
|
||||
export BASH_SILENCE_DEPRECATION_WARNING=1
|
||||
|
||||
######################
|
||||
# Sources & exports #
|
||||
######################
|
||||
|
||||
if [ -f ~/.config/.aliases ]; then
|
||||
source ~/.config/.aliases
|
||||
fi
|
||||
|
||||
if [ -f ~/.config/.aliases.local ]; then
|
||||
. ~/.config/.aliases.local
|
||||
fi
|
||||
|
||||
|
||||
if [ -f ~/.config/bash/.bash_profile.local ]; then
|
||||
source ~/.config/bash/.bash_profile.local
|
||||
fi
|
||||
|
||||
# bash-git prompt
|
||||
if [ -f ~/.config/bash/bash-git-prompt/gitprompt.sh ]; then
|
||||
source ~/.config/bash/bash-git-prompt/gitprompt.sh
|
||||
fi
|
||||
|
||||
# enable programmable completion features (you don't need to enable
|
||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
# sources /etc/bash.bashrc).
|
||||
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
|
||||
source /etc/bash_completion
|
||||
fi
|
||||
|
||||
# Git completion
|
||||
if [ -f ~/.config/bash/git-completion.bash ]; then
|
||||
source ~/.config/bash/git-completion.bash
|
||||
fi
|
||||
+1
-1
@@ -13,7 +13,7 @@ override_git_prompt_colors() {
|
||||
GIT_PROMPT_CONFLICTS="${BoldRed}✖"
|
||||
GIT_PROMPT_CLEAN="${BoldCyan}✔"
|
||||
|
||||
GIT_PROMPT_SYMBOLS_AHEAD="${BoldBlack}↑"
|
||||
GIT_PROMPT_SYMBOLS_AHEAD="${BoldYellow}↑"
|
||||
GIT_PROMPT_SYMBOLS_BEHIND="${BoldMagenta}↓"
|
||||
GIT_PROMPT_SYMBOLS_PREHASH="${BoldRed}:"
|
||||
|
||||
@@ -0,0 +1,218 @@
|
||||
#? Config file for btop v. 1.4.0
|
||||
|
||||
#* Name of a btop++/bpytop/bashtop formatted ".theme" file, "Default" and "TTY" for builtin themes.
|
||||
#* Themes should be placed in "../share/btop/themes" relative to binary or "$HOME/.config/btop/themes"
|
||||
color_theme = "/usr/share/btop/themes/matcha-dark-sea.theme"
|
||||
|
||||
#* If the theme set background should be shown, set to False if you want terminal background transparency.
|
||||
theme_background = False
|
||||
|
||||
#* Sets if 24-bit truecolor should be used, will convert 24-bit colors to 256 color (6x6x6 color cube) if false.
|
||||
truecolor = True
|
||||
|
||||
#* Set to true to force tty mode regardless if a real tty has been detected or not.
|
||||
#* Will force 16-color mode and TTY theme, set all graph symbols to "tty" and swap out other non tty friendly symbols.
|
||||
force_tty = False
|
||||
|
||||
#* Define presets for the layout of the boxes. Preset 0 is always all boxes shown with default settings. Max 9 presets.
|
||||
#* Format: "box_name:P:G,box_name:P:G" P=(0 or 1) for alternate positions, G=graph symbol to use for box.
|
||||
#* Use whitespace " " as separator between different presets.
|
||||
#* Example: "cpu:0:default,mem:0:tty,proc:1:default cpu:0:braille,proc:0:tty"
|
||||
presets = "cpu:1:default,proc:0:default cpu:0:default,mem:0:default,net:0:default cpu:0:block,net:0:tty"
|
||||
|
||||
#* Set to True to enable "h,j,k,l,g,G" keys for directional control in lists.
|
||||
#* Conflicting keys for h:"help" and k:"kill" is accessible while holding shift.
|
||||
vim_keys = False
|
||||
|
||||
#* Rounded corners on boxes, is ignored if TTY mode is ON.
|
||||
rounded_corners = True
|
||||
|
||||
#* Default symbols to use for graph creation, "braille", "block" or "tty".
|
||||
#* "braille" offers the highest resolution but might not be included in all fonts.
|
||||
#* "block" has half the resolution of braille but uses more common characters.
|
||||
#* "tty" uses only 3 different symbols but will work with most fonts and should work in a real TTY.
|
||||
#* Note that "tty" only has half the horizontal resolution of the other two, so will show a shorter historical view.
|
||||
graph_symbol = "braille"
|
||||
|
||||
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
|
||||
graph_symbol_cpu = "default"
|
||||
|
||||
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
|
||||
graph_symbol_mem = "default"
|
||||
|
||||
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
|
||||
graph_symbol_net = "default"
|
||||
|
||||
# Graph symbol to use for graphs in cpu box, "default", "braille", "block" or "tty".
|
||||
graph_symbol_proc = "default"
|
||||
|
||||
#* Manually set which boxes to show. Available values are "cpu mem net proc" and "gpu0" through "gpu5", separate values with whitespace.
|
||||
shown_boxes = "cpu mem net proc"
|
||||
|
||||
#* Update time in milliseconds, recommended 2000 ms or above for better sample times for graphs.
|
||||
update_ms = 2000
|
||||
|
||||
#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct",
|
||||
#* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly.
|
||||
proc_sorting = "cpu lazy"
|
||||
|
||||
#* Reverse sorting order, True or False.
|
||||
proc_reversed = False
|
||||
|
||||
#* Show processes as a tree.
|
||||
proc_tree = False
|
||||
|
||||
#* Use the cpu graph colors in the process list.
|
||||
proc_colors = True
|
||||
|
||||
#* Use a darkening gradient in the process list.
|
||||
proc_gradient = True
|
||||
|
||||
#* If process cpu usage should be of the core it's running on or usage of the total available cpu power.
|
||||
proc_per_core = True
|
||||
|
||||
#* Show process memory as bytes instead of percent.
|
||||
proc_mem_bytes = True
|
||||
|
||||
#* Show cpu graph for each process.
|
||||
proc_cpu_graphs = True
|
||||
|
||||
#* Use /proc/[pid]/smaps for memory information in the process info box (very slow but more accurate)
|
||||
proc_info_smaps = False
|
||||
|
||||
#* Show proc box on left side of screen instead of right.
|
||||
proc_left = False
|
||||
|
||||
#* (Linux) Filter processes tied to the Linux kernel(similar behavior to htop).
|
||||
proc_filter_kernel = False
|
||||
|
||||
#* In tree-view, always accumulate child process resources in the parent process.
|
||||
proc_aggregate = False
|
||||
|
||||
#* Sets the CPU stat shown in upper half of the CPU graph, "total" is always available.
|
||||
#* Select from a list of detected attributes from the options menu.
|
||||
cpu_graph_upper = "Auto"
|
||||
|
||||
#* Sets the CPU stat shown in lower half of the CPU graph, "total" is always available.
|
||||
#* Select from a list of detected attributes from the options menu.
|
||||
cpu_graph_lower = "Auto"
|
||||
|
||||
#* Toggles if the lower CPU graph should be inverted.
|
||||
cpu_invert_lower = True
|
||||
|
||||
#* Set to True to completely disable the lower CPU graph.
|
||||
cpu_single_graph = False
|
||||
|
||||
#* Show cpu box at bottom of screen instead of top.
|
||||
cpu_bottom = False
|
||||
|
||||
#* Shows the system uptime in the CPU box.
|
||||
show_uptime = True
|
||||
|
||||
#* Show cpu temperature.
|
||||
check_temp = True
|
||||
|
||||
#* Which sensor to use for cpu temperature, use options menu to select from list of available sensors.
|
||||
cpu_sensor = "Auto"
|
||||
|
||||
#* Show temperatures for cpu cores also if check_temp is True and sensors has been found.
|
||||
show_coretemp = True
|
||||
|
||||
#* Set a custom mapping between core and coretemp, can be needed on certain cpus to get correct temperature for correct core.
|
||||
#* Use lm-sensors or similar to see which cores are reporting temperatures on your machine.
|
||||
#* Format "x:y" x=core with wrong temp, y=core with correct temp, use space as separator between multiple entries.
|
||||
#* Example: "4:0 5:1 6:3"
|
||||
cpu_core_map = ""
|
||||
|
||||
#* Which temperature scale to use, available values: "celsius", "fahrenheit", "kelvin" and "rankine".
|
||||
temp_scale = "celsius"
|
||||
|
||||
#* Use base 10 for bits/bytes sizes, KB = 1000 instead of KiB = 1024.
|
||||
base_10_sizes = False
|
||||
|
||||
#* Show CPU frequency.
|
||||
show_cpu_freq = True
|
||||
|
||||
#* Draw a clock at top of screen, formatting according to strftime, empty string to disable.
|
||||
#* Special formatting: /host = hostname | /user = username | /uptime = system uptime
|
||||
clock_format = "%X"
|
||||
|
||||
#* Update main ui in background when menus are showing, set this to false if the menus is flickering too much for comfort.
|
||||
background_update = False
|
||||
|
||||
#* Custom cpu model name, empty string to disable.
|
||||
custom_cpu_name = ""
|
||||
|
||||
#* Optional filter for shown disks, should be full path of a mountpoint, separate multiple values with whitespace " ".
|
||||
#* Begin line with "exclude=" to change to exclude filter, otherwise defaults to "most include" filter. Example: disks_filter="exclude=/boot /home/user".
|
||||
disks_filter = ""
|
||||
|
||||
#* Show graphs instead of meters for memory values.
|
||||
mem_graphs = True
|
||||
|
||||
#* Show mem box below net box instead of above.
|
||||
mem_below_net = False
|
||||
|
||||
#* Count ZFS ARC in cached and available memory.
|
||||
zfs_arc_cached = True
|
||||
|
||||
#* If swap memory should be shown in memory box.
|
||||
show_swap = False
|
||||
|
||||
#* Show swap as a disk, ignores show_swap value above, inserts itself after first disk.
|
||||
swap_disk = False
|
||||
|
||||
#* If mem box should be split to also show disks info.
|
||||
show_disks = True
|
||||
|
||||
#* Filter out non physical disks. Set this to False to include network disks, RAM disks and similar.
|
||||
only_physical = True
|
||||
|
||||
#* Read disks list from /etc/fstab. This also disables only_physical.
|
||||
use_fstab = True
|
||||
|
||||
#* Setting this to True will hide all datasets, and only show ZFS pools. (IO stats will be calculated per-pool)
|
||||
zfs_hide_datasets = False
|
||||
|
||||
#* Set to true to show available disk space for privileged users.
|
||||
disk_free_priv = False
|
||||
|
||||
#* Toggles if io activity % (disk busy time) should be shown in regular disk usage view.
|
||||
show_io_stat = True
|
||||
|
||||
#* Toggles io mode for disks, showing big graphs for disk read/write speeds.
|
||||
io_mode = False
|
||||
|
||||
#* Set to True to show combined read/write io graphs in io mode.
|
||||
io_graph_combined = False
|
||||
|
||||
#* Set the top speed for the io graphs in MiB/s (100 by default), use format "mountpoint:speed" separate disks with whitespace " ".
|
||||
#* Example: "/mnt/media:100 /:20 /boot:1".
|
||||
io_graph_speeds = ""
|
||||
|
||||
#* Set fixed values for network graphs in Mebibits. Is only used if net_auto is also set to False.
|
||||
net_download = 100
|
||||
|
||||
net_upload = 100
|
||||
|
||||
#* Use network graphs auto rescaling mode, ignores any values set above and rescales down to 10 Kibibytes at the lowest.
|
||||
net_auto = True
|
||||
|
||||
#* Sync the auto scaling for download and upload to whichever currently has the highest scale.
|
||||
net_sync = True
|
||||
|
||||
#* Starts with the Network Interface specified here.
|
||||
net_iface = ""
|
||||
|
||||
#* Show battery stats in top right if battery is present.
|
||||
show_battery = False
|
||||
|
||||
#* Which battery to use if multiple are present. "Auto" for auto detection.
|
||||
selected_battery = "Auto"
|
||||
|
||||
#* Show power stats of battery next to charge indicator.
|
||||
show_battery_watts = False
|
||||
|
||||
#* Set loglevel for "~/.config/btop/btop.log" levels are: "ERROR" "WARNING" "INFO" "DEBUG".
|
||||
#* The level set includes all lower levels, i.e. "DEBUG" will show all logging info.
|
||||
log_level = "WARNING"
|
||||
@@ -0,0 +1,8 @@
|
||||
(deflisten window :initial "..." "./lib/get-active-window.sh")
|
||||
|
||||
(defwidget active-window []
|
||||
(box
|
||||
:halign "center"
|
||||
(label :class "bar-group" :text "${window?: 'none'}")
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1,51 @@
|
||||
; (include "./bar/brightness.yuck")
|
||||
(include "./bar/active-window.yuck")
|
||||
(include "./bar/clock.yuck")
|
||||
(include "./bar/kbd-layout.yuck")
|
||||
(include "./bar/media.yuck")
|
||||
(include "./bar/power.yuck")
|
||||
(include "./bar/updates.yuck")
|
||||
(include "./bar/weather.yuck")
|
||||
(include "./bar/workspaces.yuck")
|
||||
|
||||
(defwidget bar-tray []
|
||||
(box :class "bar-group"
|
||||
:orientation "h"
|
||||
:halign "end"
|
||||
:space-evenly false
|
||||
(systray :hexpand true :class "systray" :icon-size 18 :spacing 4)
|
||||
(kbd-layout-tray-item)
|
||||
(media-tray-item)
|
||||
; (brightness)
|
||||
(weather-tray-item)
|
||||
(clock-tray-item)
|
||||
(power-tray-item)
|
||||
)
|
||||
)
|
||||
|
||||
(defwidget bar [monitor-workspaces]
|
||||
(box :class "bar" :orientation "h"
|
||||
(workspaces :monitor-workspaces monitor-workspaces)
|
||||
(active-window)
|
||||
|
||||
(box :orientation "h" :halign "end" :space-evenly false :spacing 8
|
||||
(pacman-updates-widget)
|
||||
(bar-tray)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defwindow bar [monitor monitor-workspaces]
|
||||
:monitor monitor
|
||||
:geometry (geometry :x "0%"
|
||||
:y "4px"
|
||||
:width "99.7%"
|
||||
:height "32px"
|
||||
:anchor "top center"
|
||||
)
|
||||
:exclusive true
|
||||
:windowtype "dock"
|
||||
:wm-ignore false
|
||||
:focusable false
|
||||
(bar :monitor-workspaces monitor-workspaces)
|
||||
)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user