refactor: moved dotfile examples to the correct folder, added new ones

This commit is contained in:
Michele Cereda
2023-07-02 23:23:06 +02:00
parent b7ffd7a11b
commit 12083d0458
21 changed files with 798 additions and 3 deletions

View File

@@ -0,0 +1 @@
# See Brewfile.

View File

@@ -0,0 +1,15 @@
################################################################################
## ~/.azure/config
##
## Sources:
## - https://learn.microsoft.com/en-us/cli/azure/azure-cli-configuration
################################################################################
[cloud]
name = AzureCloud
[core]
collect_telemetry = false
[defaults]
location = eastus

View File

@@ -0,0 +1,25 @@
################################################################################
## ~/.bash_profile
##
## There are 3 different types of shells in Bash:
## - the login shell;
## - the interactive non-login shell;
## - the non-interactive non-login shell.
## Login shells read /etc/profile, and only the first one found between
## '~/.bash_profile', '~/.bash_login' and '~/.profile' in this order.
## Interactive non-login shells read /etc/bashrc and ~/.bashrc.
## Non-interactive non-login shell read the file which name is the value of the
## '$BASH_ENV' variable.
## In this setup, ~/.bash_profile sources ~/.bashrc, which means that all
## changes made here will also take effect in a login shell.
##
## This file is sourced by all Bash *login* shells on startup.
################################################################################
# Load the user's interactive settings.
# This lines are recommended by the Bash info pages.
: "${BASHRC=$HOME/.bashrc}"
if [[ -r "$BASHRC" ]]
then
source "$BASHRC"
fi

247
examples/dotfiles/.bashrc Normal file
View File

@@ -0,0 +1,247 @@
################################################################################
## ~/.bashrc
##
## There are 3 different types of shells in Bash:
## - the login shell;
## - the interactive non-login shell;
## - the non-interactive non-login shell.
## Login shells read '/etc/profile', and only the first one found between
## '~/.bash_profile', '~/.bash_login' and '~/.profile' in this order.
## Interactive non-login shells read '/etc/bashrc' and '~/.bashrc'.
## Non-interactive non-login shells read the file which name is the value of the
## '$BASH_ENV' variable.
## In this setup, '~/.bash_profile' sources '~/.bashrc', which means that all
## changes made here will also take effect in a login shell.
##
## This file is sourced by all *interactive* Bash shells on startup, including
## some apparently interactive shells such as `scp` and `rcp` which can't
## tolerate any output.
## Make sure this doesn't display anything or bad things will happen!
##
## It is recommended to put language settings in '~/.bash_profile',
## '~/.bash_login' or '~/.profile' rather than here, as multilingual X sessions
## would not work properly if '$LANG' is overridden in every subshell.
##
## References:
## - https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html
################################################################################
# Automatically logout after 60 minutes of inactivity.
export TMOUT="3600"
########################################
# Ensure primary XDG variables are set.
########################################
: "${XDG_CONFIG_HOME:=${HOME}/.config}"
: "${XDG_CACHE_HOME:=${HOME}/.cache}"
: "${XDG_DATA_HOME:=${HOME}/.local/share}"
: "${XDG_STATE_HOME:=${HOME}/.local/state}"
: "${XDG_DATA_DIRS:=/usr/local/share:/usr/share}"
: "${XDG_CONFIG_DIRS:=/etc/xdg}"
########################################
# Ensure PATH contains common binary directories.
# Prefer user's and local paths.
########################################
export PATH="/Users/user/.local/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH"
########################################
# Basic utility aliases and functions.
#
# Used to simplify checks later.
# Needed in all shells.
# Ordered alphabetically and by dependencies.
########################################
alias disable-xtrace='set +o xtrace'
alias enable-xtrace='set -o xtrace'
# Print the whole current environment.
alias printallenv='set -o posix && set'
is-symlink-broken () { [[ ! -e "$1" ]] ; }
is-shell-interactive () {
# From Bash's manpage:
# '$PS1' is set and '$-' includes 'i' if the shell is interactive.
[[ $- =~ i ]] || [[ -t 0 ]]
}
is-shell-login () {
# From Bash's manpage:
# A login shell is one whose first character of argument zero is a '-', or
# one started with the '--login' option.
[[ $0 =~ ^- ]] || [[ $(shopt login_shell | cut -f 2) == 'on' ]]
}
to-lower () {
# Bash3 has no built-in means to convert case of a string, fallback to `tr`.
echo "$(echo "$1" | tr '[:upper:]' '[:lower:]')"
}
to-upper () {
# Bash3 has no built-in means to convert case of a string, fallback to `tr`.
echo "$(echo "$1" | tr '[:lower:]' '[:upper:]')"
}
is-true () {
# Needs to return 0 or 1 and not `true` or `false`.
# Input's case is lowered to save on match options.
local LOWERED_INPUT="$(to-lower "$1")"
[[ "$LOWERED_INPUT" =~ ^1|on|true|yes$ ]]
}
# If this is a non-interactive shell, do nothing else.
# There is no need to set anything past this point for scp and rcp, and it's
# important to refrain from outputting anything in those cases.
is-shell-interactive || return
########################################
# Shell configuration.
########################################
# Check the window size of the current terminal window after each command.
# If necessary, update the values of the LINES and COLUMNS variables.
shopt -s checkwinsize
# If Readline is being used, do not attempt to search PATH for possible
# completions when the line is empty and wait a long time for this.
shopt -s no_empty_cmd_completion
# Add "/" to links to directories in autocompletion.
set mark-symlinked-directories on
####################
# History management.
####################
# Erase duplicates and ignore lines starting with spaces.
HISTCONTROL="ignorespace:erasedups"
# Number of lines or commands allowed in the history file.
HISTFILESIZE=100000
# Number of lines or commands stored in memory as the history of the current
# session.
HISTSIZE=50000
# Format how the history's entries are stored.
HISTTIMEFORMAT="%Y-%m-%d %T "
# Attempt to save all lines of a multi-line command in the same history entry.
# This allows easy re-editing of such commands.
shopt -s cmdhist
# Append the history entries in memory to the HISTFILE when exiting the shell,
# rather than just overwriting the file.
shopt -s histappend
# If readline is being used, load the results of history substitution into the
# editing buffer, allowing further modification before execution.
shopt -s histverify
########################################
# Utility aliases and functions.
#
# Ordered and grouped by dependencies.
########################################
alias decomment='grep -Ev "^#|^$"'
alias redo='$(history -p !!)'
alias please='sudo'
alias sedo='sudo redo'
ask-for-confirmation () {
is-true "$DEBUG" && enable-xtrace
read -p 'Continue? ' REPLY
if ! is-true "$REPLY"
then
echo "aborting"
return 1
fi
local RETURN_VALUE=$?
is-true "$DEBUG" && disable-xtrace
return $RETURN_VALUE
}
swap () {
is-true "$DEBUG" && enable-xtrace
if [[ ! $# -eq 2 ]]
then
echo "Usage: $0 file1 file2"
echo "Example: $0 /etc/resolv.conf resolv.new"
return 1
fi
local TMPFILE="tmp.$$"
mv "$1" "$TMPFILE"
mv "$2" "$1"
mv "$TMPFILE" "$2"
local RETURN_VALUE=$?
is-true "$DEBUG" && disable-xtrace
return $RETURN_VALUE
}
########################################
# Applications settings and shortcuts.
########################################
# Set the default editor.
export EDITOR="/usr/bin/vim"
# Enable colors.
alias grep='grep --color=always'
alias ls='ls -G'
####################
# GnuPG.
####################
# Integrate with the SSH agent.
export SSH_AUTH_SOCK="$(/opt/homebrew/bin/gpgconf --list-dirs 'agent-ssh-socket')"
/opt/homebrew/bin/gpgconf --launch 'gpg-agent'
# Integrate with Pinentry.
export GPG_TTY="$(tty)"
####################
# SSH.
####################
alias ssh-load-keys='eval `ssh-agent` && ssh-add'
####################
# Kubernetes.
####################
alias kubectl-current-context='kubectl config current-context'
kubectl-decode () { echo "$1" | base64 -d ; }
kubectl-encode () { echo -n "$1" | base64 ; }
kubectl-nodes-with-issues () {
kubectl get nodes -o jsonpath='{.items[]}' \
| jq '
{
"node": .metadata.name,
"issues": [
.status.conditions[] | select(
.status != "False" and
.type != "Ready"
)
]
} | select( .issues|length > 0 )
' -
}
alias kubectl-nodes-with-issues-in-yaml='kubectl-nodes-with-issues | yq -y "." -'

View File

@@ -0,0 +1,19 @@
################################################################################
## ~/.config/chezmoi/.chezmoi.yaml
##
## Chezmoi configuration file in one of the supported formats (JSON, JSONC,
## TOML, and YAML).
## If multiple configuration file formats are present, chezmoi will report an
## error.
##
## Sources:
## - https://www.chezmoi.io/reference/configuration-file/
################################################################################
data:
email: user.name@example.com
hashedHostname: "965415361"
encryption: gpg
git:
autoPush: true
sourceDir: /home/user/.dotfiles

View File

@@ -0,0 +1,126 @@
################################################################################
## ~/.config/git/config or ~/.gitconfig
##
## Global git configuration file. Settings in here override the system's ones,
## and are in turn overridden by the repositories' local ones.
## Check the resolved configuration in full and its origins with the following:
## `git config --list --show-origin`.
##
## Sources:
## - https://git-scm.com/docs/git-config
## - https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration
################################################################################
[alias]
branch-get-default = "!f() { \
git remote show origin \
| awk '/HEAD branch/ {print $NF}' \
;} && f"
branch-get-gone = "!f() { \
git fetch -p && \
git branch -vv \
| awk '/origin/&&/gone/{print $1}' \
;} && f"
branch-prune-gone = "!f() { \
git branch-get-gone \
| xargs \
git branch -D \
;} && f"
checkout-default-branch = "!f() { \
git checkout $(git branch-get-default) \
;} && f"
config-show-final = "!f() { \
git config --list \
| awk -F '=' '{print $1}' \
| sort -u \
| xargs -I {} \
sh -c 'printf \"{}=\" && git config --get {}' \
;} && f"
pull-from-all-remotes = "!f() { \
git remote show \
| xargs -I{} \
git pull {} ${1-$(git branch --show-current)} \
;} && f"
pull-from-all-remotes-once = "!f() { \
git remote-show-unique \
| xargs -I{} \
git pull {} ${1-$(git branch --show-current)} \
;} && f"
pull-from-reachable-remotes = "!f() { \
git remote show \
| xargs -I{} \
sh -c \"timeout 1 git ls-remote -hq {} HEAD >/dev/null 2>&1 && echo {}\" \
| xargs -I{} \
git pull {} ${1-$(git branch --show-current)} \
;} && f"
pull-from-reachable-remotes-once = "!f() { \
git remote-show-unique \
| xargs -I{} \
sh -c \"timeout 1 git ls-remote -hq {} HEAD >/dev/null 2>&1 && echo {}\" \
| xargs -I{} \
git pull {} ${1-$(git branch --show-current)} \
;} && f"
push-to-all-remotes = "!f() { \
git remote show \
| xargs -I{} \
git push {} ${1-$(git branch --show-current)} \
;} && f"
push-to-all-remotes-once = "!f() { \
git remote-show-unique \
| xargs -I{} \
git push {} ${1-$(git branch --show-current)} \
;} && f"
push-to-reachable-remotes = "!f() { \
git remote show \
| xargs -I{} \
sh -c \"timeout 1 git ls-remote -hq {} HEAD >/dev/null 2>&1 && echo {}\" \
| xargs -I{} \
git push {} ${1-$(git branch --show-current)} \
;} && f"
push-to-reachable-remotes-once = "!f() { \
git remote-show-unique \
| xargs -I{} \
sh -c \"timeout 1 git ls-remote -hq {} HEAD >/dev/null 2>&1 && echo {}\" \
| xargs -I{} \
git push {} ${1-$(git branch --show-current)} \
;} && f"
remote-show-unique = "!f() { \
git remote -v \
| sort -k2 -u \
| awk '{print $1}' \
| sort -u \
;} && f"
statis = status
statsu = status
switch-default-branch = "!f() { \
git switch $(git branch-get-default) \
;} && f"
top-level = "rev-parse --show-toplevel"
[core]
# 'input' on unix, 'true' on windows
# 'false' only if you know what you are doing
autocrlf = input
[diff]
wsErrorHighlight = all
[init]
defaultBranch = main
[pull]
rebase = false
[submodule]
recurse = true
[user]
email = name.surname@company.com
name = Name Surname
# Enable LFS.
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
# Always sign commits.
[commit]
gpgSign = true
[user]
signingKey = 89C324BA

View File

@@ -0,0 +1,15 @@
################################################################################
## ~/.config/pip/pip.conf
##
## Sources:
## - https://pip.pypa.io/en/stable/topics/configuration/
################################################################################
[global]
timeout = 60
index-url = https://download.zope.org/ppix
no-cache-dir = false
[install]
no-compile = no
no-warn-script-location = false

View File

@@ -0,0 +1 @@
# See ~/.config/git/config.

View File

@@ -0,0 +1,7 @@
################################################################################
## ~/.gnupg/gpg-agent.conf
################################################################################
default-cache-ttl 600
enable-ssh-support
max-cache-ttl 7200

View File

@@ -0,0 +1,3 @@
auto-key-retrieve
no-emit-version
default-key 7425E3348BAB159F4DBD1B9C9C74759518CB109F

View File

@@ -0,0 +1,18 @@
################################################################################
## ~/.gnupg/sshcontrol
##
## List of allowed ssh keys.
## Only keys present in this file are used in the SSH protocol.
## The ssh-add tool may add new entries to this file to enable them; you may
## also add them manually.
## Comment lines, like this one, as well as empty lines are ignored. Lines do
## have a certain length limit but this is not serious limitation as the format
## of the entries is fixed and checked by gpg-agent. A non-comment line starts
## with optional white spaces, followed by the key grip of the key given as 40
## hex digits, optionally followed by a caching TTL in seconds, and another
## optional field for arbitrary flags.
## Prepend the key grip with an '!' mark to disable it.
################################################################################
0123456789ABCDEF0123456789ABCDEF01234567
FEDCBA9876543210FEDCBA9876543210FEDCBA98 0

View File

@@ -0,0 +1,24 @@
################################################################################
## ~/.inputrc
##
## Control the behavior of the readline library, used e.g. by Bash in its
## interactive mode for line editing.
##
## This file is NOT used by ZSH.
################################################################################
# The bell style used e.g. on error or tab completion, possible values
# are `none', `visible', and `audible' the ringing the bell.
# set bell-style none
# If set to on, words which have more than one possible completion without
# any possible partial completion cause the matches to be listed immediately
# instead of ringing the bell.
# set show-all-if-unmodified on
# If set to on, words which have more than one possible completion cause the
# matches to be listed immediately instead of ringing the bell.
# set show-all-if-ambiguous on
# If set to on, disable case sensitivity for completion purposes.
set completion-ignore-case on

View File

@@ -0,0 +1,26 @@
################################################################################
## ~/.kube/config
##
## Sources:
## - https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/
################################################################################
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMvakNDQWVhZ0F3SUJBZ0lCQURBTkJna3Foa2lHOVcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJeU1URXhNakV6TWpBME5sb1hEVE15TVRFd09URXpNakEwTmxvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTlZyCnQ3eUtZQkp1eVUvaGY0TTJOc0pzVFBxeENPYktDYUl0UmR4SGs3akJRM2lBRENadHVQZk9EbWZpaG9MUzR0REoKcVZvVlh4dTlzRXhVM0FpSmppWHpNaXlCbVJWM3Q1TWcvUUJQWGdpbk4wUWdLLcFyVGQ3L2pIb0ZwSEN4UzhmbwpKWmxQaVhnQk1LQ3puR0I3UWJmUWFkVG9JUC9jU2Z3OXBDZzVZZUxET3ppMk0rOU1yZlhKSFRVamFXNUlIb2o0CnJGNnZZS3dkdy84WEdvRlZOVUZ6SXI4c3dTbTNQdHRqYm5PRmtuMkRWT01yTEM1QmsrQnVKMVFWcUpKUnJhTXMKbHk2WGl4M2dRZ2sydXZ3NU1UNXBkNCtqNXlCekpoOXlwTVRleG1CVFZTbzIrN2hpSEtPSS8rVXlhckVZOWRvdgo0TzFjaFEvZ3NVQzV3RzB1UVU4Q0F3RUFBYU5aTUZjd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0hRWURWUjBPQkJZRUZOb0Eybkd2dTUxNnBBNGllN05BNEF3a1p2ZGxNQlVHQTFVZEVRUU8KTUF6q7NtdDFZbVZ5Ym1WMFpYTXdEUVlKS29aSWh2Y05BUUVMQlFBRGdnRUJBS0ZOU3pIVkpzTzJZYVg4djJXLwppVG56UHFweDZLRDFjQnptZGxVTk5LblNLendhOWxscmVwTldpVUJuOXFZVmdlQ0Y0VUpEVGpSK2tuS3owdmVwCnZUWG1ReXpXaThVQ0p3bXo0RjR2UWlBSEdHb1U1UEVIMW5lb0RlRXU5ZTNvdStuVzV2SmYzRDEzb3ZjUFhseWkKak1JRzNaWndVTkJYMjF6SHdZaFhjd3pIZEN0dxBrcmVTRW9hY0x5UW5XL1lGZ0ZtcXZQOXExRVRDNXFHQlZycgpPeFZyOFFNZ1Npdk1wcXpXVkl1eElPM1FOWjhIWnJUenZvNDdrS1JuZFFqcE9UK09nNGNEWkVkZDBWT0pZQzREClFrVXJNSDlCcVNyUWdLejRLTGtqN2NWaDFQWUZmSnRubHpWWFlKeENtVWtZc3tvbWh6NkZSOGpPSG4ITUUwcjYKcDJnPQotLS6tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
server: https://kubernetes.docker.internal:6443
name: docker-desktop
contexts:
- context:
cluster: docker-desktop
user: docker-desktop
name: docker-desktop
current-context: docker-desktop
kind: Config
preferences: {}
users:
- name: docker-desktop
user:
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ9FURS0tLS0tCk1JSURPakNDqWlxZ2F3SUJBZ0lJVnIyeUwxQjlzLzR3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TWpFeE1USXhNekl3TkRaYUZ3MHlOREEyTURJeU1ERXpNVGhhTURZeApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sc3dHUVlEV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MXJvTDRUZTlFdGVFMApuZ3poR1pYTlFxRjNSZDh4ZG1DbG5EbkJNdEdSMmJTRTdJQVVaaERGWDExTFR6NmV1QVBEWEJ4RE96ZUxDQWF3CkZRVjlYTUVDZ1lCa0FON1ZYZ2RrQnRtT2JHZXUvbkJZcnpibGRkTmgwUjRHbUNjSjlHNmtSYlFzNEpkWEhtMC8KM0J0dzVSUS9LWHFNaHV6elNhSnBHdUJEcy9Td1BhU09abTNtOTRFbHpIcnQ2UnJ3cWRxWUE0SnI3dk1ZOEVKdwpDYUd0MVVjN2lId0tCZ1lHdzJ6cHA5V2s1aTNzQ01lRkpScWNoV2tiRWxEYTU5VThUcm5Qdnc9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=

View File

@@ -0,0 +1,13 @@
################################################################################
## ~/.oci/config
##
## Sources:
## - https://docs.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm
################################################################################
[DEFAULT]
user=ocid1.user.oc1..aaaaaaaayap6nsl77k2u34v2k7t47uidv27qfhv43av7ryn2xp37tezezlha
fingerprint=aa:bb:cc:dd:ee:ff:00:11:22:33:44:55:66:77:88:99
key_file=/home/user/.oci/oci_api_key.pem
tenancy=ocid1.tenancy.oc1..aaaaaaaawtuhnzgr175bto5wmddky4nqorr9txnjxugmtrcsoatsbv4nn6qt4
region=eu-amsterdam-1

View File

@@ -0,0 +1,15 @@
################################################################################
## ~/.screenrc
################################################################################
defscrollback 1000000
hardstatus alwayslastline
hardstatus string '%{gk}[%{G}%H%{g}][%= %{wk}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= kw}%?%+Lw%?%?%= %{g}]%{=b C}[%m/%d/%y %C %A]%{W}'
logfile flush
logtstamp after 1
logtstamp on
shell -$SHELL
startup_message off
termcapinfo xterm ti@:te@
termcapinfo xterm-color ti@:te@
vbell off

View File

@@ -0,0 +1,51 @@
################################################################################
## ~/.tmux.conf
################################################################################
###
# Tmux behavior
#################
set -g xterm-keys on
# scrollback size
set -g history-limit 100000
# enable mouse control (clickable windows, panes, resizable panes)
set -g mouse on
###
# Tmux visuals
#################
set -g default-terminal "screen-256color"
set -g status-right '#H %Y-%m-%d %H:%M'
###
# Window visuals
##################
# renumber windows when one is closed
set -g renumber-windows on
# set the terminals' title
set -g set-titles on
# rename a window to the current program
set-window-option -g automatic-rename on
###
# Activity monitor
####################
# highlight the active window
# set-window-option -g window-status-current-style 'bg=red dim'
# highlight a window's tab when it has activity
set -g monitor-activity on
# notify of a window's activity in the status bar
set -g visual-activity on

View File

@@ -0,0 +1,19 @@
################################################################################
## ~/.tool-versions
##
## Only versions or "system" are supported here, not "latest".
## Put the version to use as default first, followed by all fallback versions
## in order.
##
## Sources:
## - https://asdf-vm.com/manage/configuration.html#tool-versions
################################################################################
python 3.11.0 system 3.10.7 3.9.7
ruby 2.7.7 system
azure-cli system 2.40.0
terraform 1.2.9 1.3.7 system
hadolint 2.12.0
shellcheck 0.8.0

113
examples/dotfiles/.vimrc Normal file
View File

@@ -0,0 +1,113 @@
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"" ~/.vimrc
""
"" Sources:
"" - http://vimdoc.sourceforge.net/htmldoc/filetype.html
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Attempt to determine the type of a file based on its name and possibly its
" contents.
" Allow intelligent auto-indenting for each filetype, and for plugins that are
" filetype specific.
filetype indent plugin on
" Enable syntax highlighting.
syntax on
" Display line numbers on the left-hand side.
set number
" Highlight the line underneath the cursor.
set cursorline
" Highlight the column underneath the cursor.
" set cursorcolumn
" Highlight matching brackets.
set showmatch
" Show typed partial commands in the last line of the screen.
set showcmd
" Show the mode you are on the last line.
" set showmode
" Display the cursor position on the last line of the screen or in the status
" line of a window.
set ruler
" Use visual bell instead of beeping when doing something wrong.
set visualbell
" Raise a dialogue asking if you wish to save changed files instead of failing a
" command because of unsaved changes.
set confirm
" Do not redraw the screen during important tasks.
" Leads to smoother and faster macros.
set lazyredraw
""""""""""""""""""""""""""""""""""""""""
" Search.
""""""""""""""""""""""""""""""""""""""""
" Ignore capital letters during search.
set ignorecase
" Override the ignorecase option if searching for capital letters.
" This allows to search specifically for capital letters.
set smartcase
" Highlight during a search.
set hlsearch
" Highlight matching characters as you type while searching though a file
" incrementally.
set incsearch
" Show matching words during a search.
set showmatch
""""""""""""""""""""""""""""""""""""""""
" Indentation.
""""""""""""""""""""""""""""""""""""""""
" Copy indentation from the current line when starting a new line
set autoindent
" Adjust indentation on special events (e.g. after a bracket start)
set smartindent
" Insert spaces instead of a tab
set expandtab
" Draw a tab as 4 spaces
set tabstop=4
" Number of spaces to use for each (auto)indent step
set shiftwidth=4
" Number of spaces the cursor moves right when a Tab is inserted and moves left
" when Backspace is used to erase a tab.
" A negative value sets it to fall back to the value of 'shiftwidth'
set softtabstop=-1
" Overrides for shell files
" Use tabs for indentation instead of spaces
autocmd Filetype sh setlocal softtabstop=0 noexpandtab
""""""""""""""""""""""""""""""""""""""""
" Line wrap
""""""""""""""""""""""""""""""""""""""""
" Paint the background of the 81st character to draw a vertical indicator.
set colorcolumn=81
" Make it black in Graphical Vim.
" See :help gui-colors for a list of suggested color names.
" See :help guibg for how to specify specific rgb/hex colors.
highlight ColorColumn guibg=Black
" Make it dark grey in terminal vim.
" See :help cterm-colors for a list of colors that can be used in the terminal.
highlight ColorColumn ctermbg=DarkGrey

94
examples/dotfiles/.zshenv Normal file
View File

@@ -0,0 +1,94 @@
################################################################################
## ~/.zshenv
##
## This file is sourced by *all* zsh shells on startup.
################################################################################
########################################
# Ensure primary XDG variables are set.
########################################
: "${XDG_CONFIG_HOME:=${HOME}/.config}"
: "${XDG_CACHE_HOME:=${HOME}/.cache}"
: "${XDG_DATA_HOME:=${HOME}/.local/share}"
: "${XDG_STATE_HOME:=${HOME}/.local/state}"
: "${XDG_DATA_DIRS:=/usr/local/share:/usr/share}"
: "${XDG_CONFIG_DIRS:=/etc/xdg}"
########################################
# Basic utility aliases and functions.
#
# Used to simplify checks later.
# Needed in all shells.
# Ordered alphabetically and by dependencies.
########################################
alias disable-xtrace='unsetopt xtrace'
alias enable-xtrace='setopt xtrace'
alias is-shell-interactive='[[ -o interactive ]]'
alias is-shell-login='[[ -o login ]]'
# Print the whole current environment.
alias printallenv='setopt posixbuiltins && set'
to-lower () {
echo "${1:l}"
}
to-upper () {
echo "${1:u}"
}
is-true () {
# Needs to return 0 or 1 and not `true` or `false`.
# Input's case is lowered to save on match options.
local LOWERED_INPUT="$(to-lower "$1")"
[[ "$LOWERED_INPUT" =~ '^1|on|true|yes$' ]]
}
# Make PATHs' entries unique for better performances.
typeset -aU {f,info,man,}path
########################################
# Shell configuration.
#
# https://zsh.sourceforge.io/Doc/Release/Options.html
########################################
# Require 'cd' to change directory.
unsetopt auto_cd
########################################
# Utility aliases and functions.
#
# Ordered and grouped by dependencies.
########################################
alias decomment='grep -Ev "^#|^$"'
alias please='sudo'
########################################
# Applications' settings and shortcuts.
########################################
####################
# Python.
####################
# See also:
# - https://docs.python.org/3/using/cmdline.html#environment-variables
PYTHONCACHE=1
####################
# GnuPG.
####################
# Integrate with the SSH agent.
export SSH_AUTH_SOCK="$(/opt/homebrew/bin/gpgconf --list-dirs 'agent-ssh-socket')"
/opt/homebrew/bin/gpgconf --launch 'gpg-agent'
# Integrate with Pinentry.
export GPG_TTY="$(tty)"

186
examples/dotfiles/.zshrc Normal file
View File

@@ -0,0 +1,186 @@
################################################################################
## ~/.zshrc
##
## This file is sourced by all *interactive* zsh shells on startup, including
## some apparently interactive shells such as scp and rcp that can't tolerate
## any output.
## Make sure this doesn't display anything or bad things will happen!
##
## It is recommended to make language settings in ~/.zprofile rather than here,
## since multilingual X sessions would not work properly if LANG is overridden
## in every subshell.
################################################################################
# Enable this and the last line to debug performance.
# zmodload zsh/zprof
########################################
# Shell configuration.
# Sane defaults that could easily be overridden later.
########################################
# If a pattern for filename generation has no matches, print an error instead of
# leaving it unchanged in the argument list.
# This also applies to file expansion of an initial '~' or '='.
setopt no_match
# Treat '#' as a comment starter instead of matching patterns.
setopt interactive_comments
# Remind compinstall where it wrote zstyle statements last time.
# This lets one run compinstall again to update them.
zstyle ':compinstall' filename ~/.zshrc
# Automatically update completions after PATH changes.
zstyle ':completion:*' rehash true
# Enable cache for completions.
zstyle ':completion:*' use-cache true
# Load extensions.
autoload -Uz bashcompinit compinit promptinit
# Enable completions.
bashcompinit
compinit
# Enable prompt management.
promptinit
# Automatically logout after 60 minutes of inactivity.
export TMOUT="3600"
####################
# History management.
####################
# The file to save the history into when an interactive shell exits.
# If unset, the history is not saved.
: "${HISTFILE:=$HOME/.zsh_history}"
# Set the number of lines or commands allowed in the history file
SAVEHIST=50000
# Set the number of lines or commands stored in memory as history list during an
# ongoing session
HISTSIZE=100000
# Append the session's history list to the history file, rather than replace it.
# Multiple parallel sessions will all have the new entries from their history
# lists added to the history file, in the order that they exit. The file will
# still be periodically re-written to trim it when the number of lines grows 20%
# beyond the value specified by $SAVEHIST
setopt append_history
# When searching for history entries in the line editor, do not display
# duplicates of a line previously found
# setopt hist_find_no_dups
# If a new command line being added to the history list duplicates an older one,
# the older command is removed from the list
setopt hist_ignore_all_dups
# Remove command lines from the history list when the first character on the
# line is a space, or when one of the expanded aliases contains a leading space.
# Only normal aliases (not global or suffix aliases) have this behavior. Note
# that the command lingers in the internal history until the next command is
# entered before it vanishes, allowing you to briefly reuse or edit the line.
# If you want to make it vanish right away without entering another command,
# type a space and press return
setopt hist_ignore_space
# Remove superfluous blanks from each command line being added to the history
setopt hist_reduce_blanks
# Omit older commands duplicating newer ones when writing out the history file
# setopts hist_save_no_dups
# Whenever the user enters a line with history expansion, perform history
# expansion and reload the line into the editing buffer instead of executing it
setopt hist_verify
########################################
# Utility aliases and functions.
#
# Ordered and grouped by dependencies.
########################################
####################
# History management.
####################
alias redo='$(history -p !!)'
alias sedo='sudo $(history -p !!)'
########################################
# Applications settings and shortcuts.
########################################
# Set the default editor.
export EDITOR="/usr/bin/vim"
# Enable colors.
alias grep='grep --color=always'
alias ls='ls -G'
####################
# SSH.
####################
alias ssh-load-keys='eval `ssh-agent` && ssh-add'
####################
# Kubernetes.
####################
alias kubectl-current-context='kubectl config current-context'
kubectl-decode () { echo "$1" | base64 -d ; }
kubectl-encode () { echo -n "$1" | base64 ; }
kubectl-nodes-with-issues () {
kubectl get nodes -o jsonpath='{.items[]}' \
| jq '
{
"node": .metadata.name,
"issues": [
.status.conditions[] | select(
.status != "False" and
.type != "Ready"
)
]
} | select( .issues|length > 0 )
' -
}
alias kubectl-nodes-with-issues-in-yaml='kubectl-nodes-with-issues | yq -y "." -'
# Reassign the expected behaviour to the delete, end and home keys.
bindkey "^[[3~" delete-char
bindkey "^[[F" end-of-line
bindkey "^[[H" beginning-of-line
########################################
# Configuration freeze.
# Finalize customizations and try to set the current configuration immutable.
########################################
# Clean up PATHs.
# Remove non-existing directories, follow symlinks and clean up remaining paths.
if command which realpath >/dev/null 2>&1
then
[[ -n "${fpath[@]}" ]] && fpath=( $(realpath -q ${fpath[@]}) )
[[ -n "${infopath[@]}" ]] && infopath=( $(realpath -q ${infopath[@]}) )
[[ -n "${manpath[@]}" ]] && manpath=( $(realpath -q ${manpath[@]}) )
[[ -n "${path[@]}" ]] && path=( $(realpath -q ${path[@]}) )
fi
# Freeze (-f) or unfreeze (-u) the tty. When the tty is frozen, no changes made
# to the tty settings by external programs will be honored by the shell, except
# for changes in the size of the screen; the shell will simply reset the
# settings to their previous values as soon as each command exits or is
# suspended.
# Freezing the tty only causes future changes to the state to be blocked.
ttyctl -f
# Enable this and the module inclusion on the first line to debug performance.
# zprof