initial commit

Signed-off-by: Jochen Maes <jochen@sejo-it.be>
This commit is contained in:
Jochen Maes 2023-11-27 07:48:55 +01:00
commit 98b5f34043
11 changed files with 2290 additions and 0 deletions

79
.aliases Normal file
View File

@ -0,0 +1,79 @@
#!/bin/zsh
#
# .aliases - Set whatever shell aliases you want.
#
# single character aliases - be sparing!
alias _=sudo
alias l=ls
# mask built-ins with better defaults
alias vi=vim
# more ways to ls
alias ll='ls -lh'
alias la='ls -lAh'
alias ldot='ls -ld .*'
# fix common typos
alias quit='exit'
alias cd..='cd ..'
# tar
alias tarls="tar -tvf"
alias untar="tar -xf"
# find
alias fd='find . -type d -name'
alias ff='find . -type f -name'
# url encode/decode
alias urldecode='python3 -c "import sys, urllib.parse as ul; \
print(ul.unquote_plus(sys.argv[1]))"'
alias urlencode='python3 -c "import sys, urllib.parse as ul; \
print (ul.quote_plus(sys.argv[1]))"'
# misc
alias please=sudo
alias zshrc='${EDITOR:-vim} "${ZDOTDIR:-$HOME}"/.zshrc'
alias zbench='for i in {1..10}; do /usr/bin/time zsh -lic exit; done'
alias zdot='cd ${ZDOTDIR:-~}'
# kangaroot asciidoc
#
alias asciidoc="asciidoctor-pdf -a pdf-style=kanga-theme.yml -a pdf-stylesdir=/home/sejo/workspace/kangaroot/asciidoc -a pdf-fontsdir=/home/sejo/workspace/kangaroot/asciidoc/font $@"
# kubernetes alias
alias k="kubectl"
# git aliases
alias gb='git branch'
alias gba='git branch --all'
alias gbd='git branch --delete'
alias gbD='git branch --delete --force'
alias gbl='git blame -w'
alias gco='git checkout'
alias glgg='git log --graph'
alias glgga='git log --graph --decorate --all'
alias glgm='git log --graph --max-count=10'
alias glods='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset" --date=short'
alias glod='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset"'
alias glola='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --all'
alias glols='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --stat'
alias glol='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset"'
alias glo='git log --oneline --decorate'
alias glog='git log --oneline --decorate --graph'
alias gloga='git log --oneline --decorate --graph --all'
alias glg='git log --stat'
alias glgp='git log --stat --patch'
alias gignored='git ls-files -v | grep "^[[:lower:]]"'
alias gfg='git ls-files | grep'
alias gl='git pull'
alias gp='git push'
alias gpd='git push --dry-run'
alias gst='git status --short --branch'
#aliases for rusttools
alias ls="exa --icons"
alias cat="bat --style=auto"

14
.gitignore vendored Normal file
View File

@ -0,0 +1,14 @@
### .gitignore
.antidote/
.zcompcache/
.zsh_sessions/
.zcompdump*
.zsh_history
.zsh_plugins.zsh
*.bak
*.local
*.local.zsh
*.zwc
*.zwc.old
~*

1833
.p10k.zsh Normal file

File diff suppressed because it is too large Load Diff

37
.zprofile Normal file
View File

@ -0,0 +1,37 @@
#!/bin/zsh
#
# .zprofile - Zsh file loaded on login.
#
#
# Browser
#
if [[ "$OSTYPE" == darwin* ]]; then
export BROWSER="${BROWSER:-open}"
fi
#
# Editors
#
export EDITOR="${EDITOR:-vim}"
export VISUAL="${VISUAL:-vim}"
export PAGER="${PAGER:-less}"
#
# Paths
#
# Ensure path arrays do not contain duplicates.
typeset -gU path fpath
# Set the list of directories that zsh searches for commands.
path=(
$HOME/{,s}bin(N)
$HOME/.cargo/bin
$HOME/.local/{,s}bin(N)
/opt/{homebrew,local}/{,s}bin(N)
/usr/local/{,s}bin(N)
$path
)

230
.zsh_plugins.txt Normal file
View File

@ -0,0 +1,230 @@
#!/bin/zsh
#
# .zsh_plugins.txt - antidote plugins file
#
### Overview
#
# The `.zsh_plugins.txt` file is used by antidote to configure Zsh bundles. Bundles are
# just a fancy way of referring to Zsh utilities, frameworks, prompts, or plugins.
# `.zsh_plugins.txt` is used by antidote to generate a static `.zsh_plugins.zsh` file,
# which can then be sourced in your `.zshrc`. You can use this file as a starting point
# for your own config. Strip out instructional comments (ie: lines beginning with a '#')
# and any plugins you don't need, then add what you like and make it yours!
#
# NOTE: Order matters in this file! Some bundles need to be last, and others are
# prerequisites. Read the documentation for the plugins you use to ensure proper
# configuration.
#
###
### Regular Plugins
#
# Plugins are the simplest kind of bundles. You can point to a full git URL, or if you
# assume GitHub.com, then you can use the user/repo shorthand.
#
###
https://github.com/peterhurford/up.zsh
rummik/zsh-tailf
mattmc3/zman
agkozak/zsh-z
### Local Plugins
#
# Plugins don't have to come from GitHub. You can also use local files or directories to
# host your own custom plugins.
#
###
$ZDOTDIR/.aliases
#$ZDOTDIR/custom/plugins/example
### Local Plugins with Variables
#
# If you want to use variables in this file, you will need to use the envsubst utility.
# It may come installed on your system, or be available in your OS package manager. Or,
# you can use the Python one-liner wrapper function included in this sample project.
# To replace environment variables, you need to change your `antidote bundle` call to
# this.
#
# zsh_plugins=${ZDOTDIR:-~}/.zsh_plugins.zsh
# envsubst <${zsh_plugins:r}.txt | antidote bundle >|$zsh_plugins
#
###
# reference your own plugins
# $ZSH_CUSTOM/plugins/nodejs
# $ZSH_CUSTOM/plugins/python
# $ZSH_CUSTOM/plugins/ruby
### Prompts
#
# You can make certain themes available to the built-in Zsh prompt command using the
# `kind:fpath` annotation. A theme is not active for the prompt until this command is
# run:
#
# autoload -Uz promptinit && promptinit
# prompt ${prompt_name:-pure}
#
# There are two ways to load prompts.
# - Add multiple prompt plugins to your `$fpath` with `kind:fpath` and then later in
# your .zshrc run the Zsh built-in `prompt` to select the theme.
# - Or, just load one prompt like a regular plugin.
#
###
# Use kind:fpath for prompts you want available to promptinit.
romkatv/powerlevel10k
# Or, just load a prompt plugin the normal way.
#sindresorhus/pure
### Utilities
#
# Utilities aren't traditional Zsh plugins - they aren't sourced Zsh scripts. Instead
# they provide commands that can be executed from your terminal session. One good
# example is zsh-bench, which is a utility that benchmarks your Zsh config. Utility
# bundles can often be made available simply with the `kind:path` annotation.
#
###
romkatv/zsh-bench kind:path
### Frameworks
#
# Frameworks are a collection of Zsh features, settings, and plugins meant to ease
# Zsh configuration. Unfortunately, all that power can come with serious drawbacks.
# Frameworks can often set more settings or aliases than you need, cluttering your Zsh
# config and slowing things down. Use with caution!
#
# Frameworks are handled in antidote using the `path:location/of/plugin` annotation.
#
###
### Framework: Oh-My-Zsh
#
# Oh-My-Zsh is a very popular Zsh framework. You might choose to use plugins from OMZ
# in your own config. Depending on which plugins you use, you may also need to include
# OMZ's entire "lib" directory. If you do this, be careful - "lib" configures a lot of
# very broad settings. If you are familiar with what you are doing, you may choose to
# only include parts of "lib".
#
# # use all of lib
# ohmyzsh/ohmyzsh path:lib
# # -OR-, only use only the specific files we care about
# ohmyzsh/ohmyzsh path:lib/clipboard.zsh
#
####
# ohmyzsh/ohmyzsh path:lib
#ohmyzsh/ohmyzsh path:plugins/copybuffer
# ohmyzsh/ohmyzsh path:plugins/copyfile
# ohmyzsh/ohmyzsh path:plugins/copypath
# ohmyzsh/ohmyzsh path:plugins/extract
# ohmyzsh/ohmyzsh path:plugins/magic-enter
# ohmyzsh/ohmyzsh path:plugins/fancy-ctrl-z
#ohmyzsh/ohmyzsh path:plugins/git
#ohmyzsh/ohmyzsh path:plugins/kubectl
### Framework: Prezto
#
# Prezto is another popular Zsh framework. You might choose to use parts of it in your
# config alongside/instead of OMZ. Prezto has some key differences from OMZ. For
# starters, it doesn't have a lib directory and it calls its plugins 'modules'. Its
# modules also often have functions directories that need autoloaded. And, because it's
# meant to be used as an integrated framework, Prezto modules don't operate well as
# cherry-picking independent plugins, so using Prezto with antidote is not recommended
# for anyone but the most advanced Zsh users.
#
###
# Prezto can be difficult to assemble because it's so interdependent.
# Use at your own risk.
# sorin-ionescu/prezto path:modules/helper/functions kind:autoload
# sorin-ionescu/prezto path:modules/helper
# sorin-ionescu/prezto path:modules/environment
# sorin-ionescu/prezto path:modules/terminal
# sorin-ionescu/prezto path:modules/editor
# sorin-ionescu/prezto path:modules/directory
# sorin-ionescu/prezto path:modules/git/functions kind:autoload
# sorin-ionescu/prezto path:modules/git
# And Prezto has tons more...
# sorin-ionescu/prezto path:modules/history
# sorin-ionescu/prezto path:modules/spectrum
# sorin-ionescu/prezto path:modules/utility/functions kind:autoload
# sorin-ionescu/prezto path:modules/utility
# sorin-ionescu/prezto path:modules/completion
# sorin-ionescu/prezto path:modules/history-substring-search
# sorin-ionescu/prezto path:modules/prompt/functions kind:autoload
# sorin-ionescu/prezto path:modules/prompt
# sorin-ionescu/prezto path:modules/python
# sorin-ionescu/prezto path:modules/python/functions kind:autoload
# sorin-ionescu/prezto path:modules/osx conditional:ismacos
# sorin-ionescu/prezto path:modules/osx/functions kind:autoload conditional:ismacos
### Framework: zsh-utils
#
# zsh-utils is a micro-framework that is also well suited to pair with antidote. It
# provides much of the same core functionality from other bigger frameworks without the
# bloat or performance hit. Using zsh-utils, you may find you don't need much else.
# If you want a really thin framework, this is great.
#
###
belak/zsh-utils path:history
belak/zsh-utils path:utility
belak/zsh-utils path:editor
### Deferred Plugins
#
# Antidote allows you to defer loading plugins. This is similar to concepts like "turbo
# mode" in other plugin managers. Antidote handles deferring plugins by leveraging
# romkatv/zsh-defer, which "defers execution of a zsh command until zsh has nothing else
# to do and is waiting for user input". In general, you should not defer plugins unless
# you know for sure they properly support deferred loading, and there are no adverse
# side-effects (see: https://github.com/romkatv/zsh-defer#Caveats). However, for
# certain plugins, this can greatly increase your zsh startup speed.
#
###
# Syntax highlighting
#zsh-users/zsh-syntax-highlighting kind:defer
zdharma-continuum/fast-syntax-highlighting kind:defer
### Completions
#
# You may want to add some additional completions to Zsh. Completions look in your fpath
# for completion functions, which are functions named with a leading underscore
# (eg: _git). You need to add all supplemental completions to your fpath prior to
# running `compinit` to use completions functionality properly. You will want to find
# a completion plugin that runs `compinit` for you, or you can run it yourself in
# your .zshrc after antidote loads like this:
#
# autoload -Uz compinit && compinit
#
###
# zsh-users/zsh-completions is a popular plugin for adding supplemental completions.
# We combine the `path:` and `kind:fpath` annotations here:
zsh-users/zsh-completions path:src kind:fpath
# Compinit plugins should be near the end of .zsh_plugins.txt so that $fpath has been
# fully populated. Use zsh-utils for its completion plugin.
belak/zsh-utils path:completion
### Final Plugins
#
# Remember plugin order matters! Put plugins that need run last at the bottom of your
# .zsh_plugins.txt file.
#
###
# These popular core plugins should be loaded at the end
zsh-users/zsh-autosuggestions kind:defer
zsh-users/zsh-history-substring-search

15
.zshenv Normal file
View File

@ -0,0 +1,15 @@
#!/bin/zsh
#
# .zshenv - Zsh environment file, loaded always.
#
# NOTE: .zshenv needs to live at ~/.zshenv, not in $ZDOTDIR!
# Set ZDOTDIR if you want to re-home Zsh.
export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
export ZDOTDIR=${ZDOTDIR:-$XDG_CONFIG_HOME/zsh}
# You can use .zprofile to set environment vars for non-login, non-interactive shells.
if [[ ( "$SHLVL" -eq 1 && ! -o LOGIN ) && -s "${ZDOTDIR:-$HOME}/.zprofile" ]]; then
source "${ZDOTDIR:-$HOME}/.zprofile"
fi

47
.zshrc Normal file
View File

@ -0,0 +1,47 @@
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.config/zsh/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
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
#!/bin/zsh
#
# .zshrc - Zsh file loaded on interactive shell sessions.
#
# Zsh options.
setopt extended_glob auto_cd
# Autoload functions you might want to use with antidote.
ZFUNCDIR=${ZFUNCDIR:-$ZDOTDIR/functions}
fpath=($ZFUNCDIR $fpath)
autoload -Uz $fpath[1]/*(.:t)
# Source zstyles you might use with antidote.
[[ -e ${ZDOTDIR:-~}/.zstyles ]] && source ${ZDOTDIR:-~}/.zstyles
# Clone antidote if necessary.
[[ -d ${ZDOTDIR:-~}/.antidote ]] ||
git clone https://github.com/mattmc3/antidote ${ZDOTDIR:-~}/.antidote
# Create an amazing Zsh config using antidote plugins.
source ${ZDOTDIR:-~}/.antidote/antidote.zsh
antidote load
# zsh-history-substring-search configuration
bindkey '^[[A' history-substring-search-up # or '\eOA'
bindkey '^[[B' history-substring-search-down # or '\eOB'
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
# add kubectl autocomplete
source <(kubectl completion zsh)
# add fluxcd autocomplete
source <(flux completion zsh)
# To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh.
[[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh

11
.zstyles Normal file
View File

@ -0,0 +1,11 @@
#!/bin/zsh
#
# .zstyles - Set zstyle settings for plugins that need them.
#
#
# Antidote
#
# zstyle ':antidote:bundle' file ${ZDOTDIR:-~}/.zplugins.txt
# zstyle ':antidote:bundle' use-friendly-names 'yes'

10
README.md Normal file
View File

@ -0,0 +1,10 @@
# install
```
ZDOTDIR=~/.config/zsh
git clone ssh://git@gitea.sejo-it.be:3022/sejo/zshrepo.git $ZDOTDIR
# symlink .zshenv
[[ -f ~/.zshenv ]] && mv -f ~/.zshenv ~/.zshenv.bak
ln -s $ZDOTDIR/.zshenv ~/.zshenv
```

10
functions/envsubst Normal file
View File

@ -0,0 +1,10 @@
#!/bin/zsh
##? envsubst - fall-back wrapper in the event the envsubst command does not exist.
#function envsubst {
if (( $+commands[envsubst] )); then
command envsubst "$@"
else
python -c 'import os,sys;[sys.stdout.write(os.path.expandvars(l)) for l in sys.stdin]'
fi
#}

4
functions/ismacos Normal file
View File

@ -0,0 +1,4 @@
#!/bin/zsh
#function ismacos {
[[ $OSTYPE = *darwin* ]] || return 1
#}