Compare commits

...

9 Commits

8 changed files with 43 additions and 110 deletions

1
.zshrc

@ -4,6 +4,7 @@
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
export ZSH_DISABLE_COMPFIX=true
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"

@ -6,7 +6,7 @@ Linux:
```apt install git vim zsh```
macOS:
```brew install git vim zsh```
```brew install git vim zsh lsd```
From your users home directory (~/), execute:
```git clone git@git.24unix.net:tracer/dotfiles.git .config/dotfiles```
@ -34,4 +34,4 @@ https://www.linux-magazin.de/ausgaben/2019/09/snapshot-18/
CHANGES:
added brew instal …
removed lsd from precompiled Darwin binaries
removed lsd from precompiled Darwin binaries

BIN
cdbm/Darwin/arm64/cdbm Executable file

Binary file not shown.

10
cdbm/go.mod Normal file

@ -0,0 +1,10 @@
module cdbm
go 1.21.6
require (
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect
github.com/manifoldco/promptui v0.9.0 // indirect
github.com/mattn/go-sqlite3 v1.14.19 // indirect
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b // indirect
)

10
cdbm/go.sum Normal file

@ -0,0 +1,10 @@
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA=
github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg=
github.com/mattn/go-sqlite3 v1.14.19 h1:fhGleo2h1p8tVChob4I9HpmVFIAkKGpiukdrgQbWfGI=
github.com/mattn/go-sqlite3 v1.14.19/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b h1:MQE+LT/ABUuuvEZ+YQAMSXindAdUh7slEmAkup74op4=
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

@ -1,102 +0,0 @@
#
# Cobalt2 Theme - https://github.com/wesbos/Cobalt2-iterm
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://gist.github.com/1595572).
##
### Segment drawing
# A few utility functions to make it easy and re-usable to draw segmented prompts
CURRENT_BG='NONE'
SEGMENT_SEPARATOR=''
# Begin a segment
# Takes two arguments, background and foreground. Both can be omitted,
# rendering default background/foreground.
prompt_segment() {
local bg fg
[[ -n $1 ]] && bg="%K{$1}" || bg="%k"
[[ -n $2 ]] && fg="%F{$2}" || fg="%f"
if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then
echo -n " %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} "
else
echo -n "%{$bg%}%{$fg%} "
# echo $(pwd | sed -e "s,^$HOME,~," | sed "s@\(.\)[^/]*/@\1/@g")
# echo $(pwd | sed -e "s,^$HOME,~,")
fi
CURRENT_BG=$1
[[ -n $3 ]] && echo -n $3
}
# End the prompt, closing any open segments
prompt_end() {
if [[ -n $CURRENT_BG ]]; then
echo -n " %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR"
else
echo -n "%{%k%}"
fi
echo -n "%{%f%}"
CURRENT_BG=''
}
### Prompt components
# Each component will draw itself, and hide itself if no information needs to be shown
# Context: user@hostname (who am I and where am I)
prompt_context() {
local user=`whoami`
if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
prompt_segment black default "%(!.%{%F{yellow}%}.)✝"
fi
}
# Git: branch/detached head, dirty status
prompt_git() {
local ref dirty
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
ZSH_THEME_GIT_PROMPT_DIRTY='±'
dirty=$(parse_git_dirty)
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git show-ref --head -s --abbrev |head -n1 2> /dev/null)"
if [[ -n $dirty ]]; then
prompt_segment yellow black
else
prompt_segment green black
fi
echo -n "${ref/refs\/heads\// }$dirty"
fi
}
# Dir: current working directory
prompt_dir() {
prompt_segment blue black '%3~'
# prompt_segment blue black "…${PWD: -30}"
}
# Status:
# - was there an error
# - am I root
# - are there background jobs?
prompt_status() {
local symbols
symbols=()
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘"
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙"
[[ -n "$symbols" ]] && prompt_segment black default "$symbols"
}
## Main prompt
build_prompt() {
RETVAL=$?
prompt_status
prompt_context
prompt_dir
prompt_git
prompt_end
}
PROMPT='%{%f%b%k%}$(build_prompt) '

26
setup.sh Normal file → Executable file

@ -1,7 +1,15 @@
#!/bin/sh
#
#set -x
cp Settings/.zshrc Settings/.vimrc Settings/.zprofile Settings/.gitconfig Settings/.p10k.zsh .
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
dotPath=".config/dotfiles"
cp $dotPath/.zshrc $dotPath/.vimrc $dotPath/.zprofile $dotPath/.gitconfig $dotPath/.p10k.zsh .
if [ -d ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k ]; then
echo "pl10k already exists, skipping"
else
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
fi
if [ $(id -u) -ne 0 ]
then
@ -11,12 +19,18 @@ else
OS=`uname`
case "$OS" in
Darwin)
cp Settings/cdbm/Darwin/cdbm /usr/local/bin
cp Settings/lsd/Darwin/lsd /usr/local/bin
ARCH=`uname -m`
case "$ARCH" in
arm64)
cp $dotPath/cdbm/Darwin/arm64/cdbm /usr/local/bin
;;
*)
cp $dotPath/cdbm/Darwin/x86_64/cdbm /usr/local/bin
;;
esac
;;
Linux)
cp Settings/cdbm/Linux/cdbm /usr/local/bin
cp Settings/lsd/Linux/lsd /usr/local/bin
cp $dotPath//cdbm/Linux/cdbm /usr/local/bin
;;
*)
$OS is not supported