commit 1fd583d71269ee2ab25163bc5c5fcd2913881332 Author: Alexander Schäferdiek Date: Sun Sep 18 08:57:40 2022 +0200 Add initial version for dotfiles-server diff --git a/.chezmoi.yaml.tmpl b/.chezmoi.yaml.tmpl new file mode 100644 index 0000000..b93c9ef --- /dev/null +++ b/.chezmoi.yaml.tmpl @@ -0,0 +1,3 @@ +encryption: gpg +edit: + command: vim diff --git a/.chezmoiexternal.toml b/.chezmoiexternal.toml new file mode 100644 index 0000000..fa97461 --- /dev/null +++ b/.chezmoiexternal.toml @@ -0,0 +1,22 @@ +[".vim/autoload/plug.vim"] + type = "file" + url = "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" + refreshPeriod = "168h" +[".vim/plugged/base16-vim"] + type = "archive" + url = "https://github.com/chriskempson/base16-vim/archive/master.tar.gz" + exact = true + stripComponents = 1 + refreshPeriod = "168h" +[".vim/plugged/dracula"] + type = "archive" + url = "https://github.com/dracula/vim/archive/master.tar.gz" + exact = true + stripComponents = 1 + refreshPeriod = "168h" +[".vim/plugged/vim-easy-align"] + type = "archive" + url = "https://github.com/junegunn/vim-easy-align/archive/master.tar.gz" + exact = true + stripComponents = 1 + refreshPeriod = "168h" \ No newline at end of file diff --git a/.chezmoiignore b/.chezmoiignore new file mode 100644 index 0000000..bf4a6c0 --- /dev/null +++ b/.chezmoiignore @@ -0,0 +1,3 @@ +README.md +*.dat +*.data \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..ef9eadd --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# chezmoi dotfiles + +```shell +# init and clone on new machine +chezmoi init --apply --verbose ssh://git@git.myservermanager.com:10022/alexander.schaeferdiek/dotfiles.git + +# apply changes +chezmoi apply -R + +# pull updates +chezmoi update --apply -R +``` \ No newline at end of file diff --git a/dot_nanorc b/dot_nanorc new file mode 100644 index 0000000..310398f --- /dev/null +++ b/dot_nanorc @@ -0,0 +1,5 @@ +set nowrap +set tabsize 4 +set tabstospaces + +include "/usr/share/nano/*.nanorc" \ No newline at end of file diff --git a/dot_vim/vimrc b/dot_vim/vimrc new file mode 100644 index 0000000..5054f6c --- /dev/null +++ b/dot_vim/vimrc @@ -0,0 +1,41 @@ +" to use themes, comment out the example themes (Plug and below) +" enter vim and type :PlugInstall or :PlugUpdate + +filetype plugin indent on +syntax on + +set ai +set bs=2 +set cc=80,120 +set fdm=syntax +set formatoptions+=j +"set lcs=tab:\│\ ,trail:·,eol:¬ +set ls=2 +set nu +set rnu +set ru +set si +set sta +set sw=4 +set ts=4 +set ttyfast +set udf +set wmnu +" disable folding +set nofoldenable + +" Specify a directory for plugins +" - Avoid using standard Vim directory names like 'plugin' +call plug#begin('~/.vim/plugged') + Plug 'chriskempson/base16-vim' + Plug 'dracula/vim', { 'as': 'dracula' } + Plug 'junegunn/vim-easy-align' +" Initialize plugin system +call plug#end() + +colorscheme base16-atelier-forest +"colorscheme dracula + +if has('gui_running') + set go=m +endif diff --git a/dot_zprofile b/dot_zprofile new file mode 100644 index 0000000..bca40e7 --- /dev/null +++ b/dot_zprofile @@ -0,0 +1,2 @@ +#!/bin/zsh +loadkeys de diff --git a/dot_zsh_archlinux b/dot_zsh_archlinux new file mode 100644 index 0000000..c5058a1 --- /dev/null +++ b/dot_zsh_archlinux @@ -0,0 +1,33 @@ +#!/usr/bin/env zsh + +alias pkgfile-update="sudo pkgfile --update" +alias pac="yay" +# recommended hooks: pacman-cleanup-hook +alias pkg-upgrade="yay && pacman-orphans && sync" +alias pkg-upgrade-full="yay -Syyu --devel && pacman-orphans && sync" +alias pacdiff-merge='sudo DIFFPROG=vimdiff DIFFSEARCHPATH="/boot /etc /usr" pacdiff' +alias font-cache-update='sudo fc-cache -vf' +alias mkinitcpio-linux='sudo mkinitcpio -p linux' + +pacman-orphans() { + if [[ ! -n $(pacman -Qdt) ]]; then + echo "No orphans to remove." + else + sudo pacman -Rns $(pacman -Qdtq) + fi +} + +pacman-unneeded() { + ignoregrp="base base-devel" + ignorepkg="" + + comm -23 <(pacman -Qqt | sort) <(echo $ignorepkg | tr ' ' '\n' | cat <(pacman -Sqg $ignoregrp) - | sort -u) +} + +pacman-modified() { + pacman -Qii | awk '/^MODIFIED/ {print $2}' +} + +pacman-disowned() { + sudo lostfiles +} diff --git a/dot_zsh_systemd b/dot_zsh_systemd new file mode 100644 index 0000000..d31f8ed --- /dev/null +++ b/dot_zsh_systemd @@ -0,0 +1,37 @@ +#!/usr/bin/env zsh + +alias systemctl-list-running-services="sudo systemctl --type=service" +alias systemctl-list-units='sudo systemctl list-units' +alias systemctl-list-unit-files='sudo systemctl list-unit-files' +alias systemctl-failed='sudo systemctl --failed' +alias systemctl-daemon-reload='sudo systemctl daemon-reload' +alias journalctl-error='sudo journalctl -b --priority 0..3' +alias journalctl-user='journalctl -b' + +shutdown-timer() { + bash -c 'echo "System is going to shutdown in $1 minute(s)..." + sleep $1m + systemctl poweroff' -- $1 +} + +hibernate-timer() { + bash -c 'echo "System is going to hibernate in $1 minute(s)..." + sleep $1m + systemctl hibernate' -- $1 +} + +shutdown() { + systemctl poweroff +} + +hibernate() { + systemctl hibernate +} + +standby() { + systemctl suspend +} + +restart() { + systemctl reboot +} \ No newline at end of file diff --git a/dot_zshenv b/dot_zshenv new file mode 100644 index 0000000..ce2ff3a --- /dev/null +++ b/dot_zshenv @@ -0,0 +1,2 @@ +# misc +export EDITOR="vim" diff --git a/dot_zshrc b/dot_zshrc new file mode 100644 index 0000000..772771a --- /dev/null +++ b/dot_zshrc @@ -0,0 +1,118 @@ +# This configuration makes use of zsh-syntax-highlighting. +# Some alias will call pre-defined applications. +# Ensure to install them if a command is not working. +# +# SETTINGS +autoload -U compinit promptinit +autoload -U colors && colors +compinit +promptinit +prompt walters +zstyle ':completion:*' menu select +setopt completealiases +setopt HIST_IGNORE_DUPS + +PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg_no_bold[yellow]%}%1~%{$reset_color%} #" +RPROMPT="[%{$fg_no_bold[yellow]%}%?%{$reset_color%}]" +LS_COLORS='rs=0:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:'; + +# HISTORY +HISTFILE=~/.zsh_history +HISTSIZE=10000 +SAVEHIST=10000 + +# EXPORTS +export LS_COLORS + +# ALIAS & FUNCTIONS +alias ls="ls --color -F" +alias ll="ls --color -lh -a" +alias ll-octal-dir='stat -c "%a %n" *' +alias ip='ip -c' +alias n="$EDITOR" +alias v="$EDITOR" +alias ..='cd ..' +alias grep='grep --color=auto' +alias egrep='egrep --color=auto' +alias fgrep='fgrep --color=auto' +alias fd='fd -H' + +alias e='$EDITOR' +alias edit='$EDITOR' + +alias free-cached-memory='sync && sudo echo 3 > /proc/sys/vm/drop_caches' + +function chpwd() { + ll +} + +process-name() { + ps -p $1 -o comm= +} + +man() { + env \ + LESS_TERMCAP_mb=$(printf "\e[1;31m") \ + LESS_TERMCAP_md=$(printf "\e[1;31m") \ + LESS_TERMCAP_me=$(printf "\e[0m") \ + LESS_TERMCAP_se=$(printf "\e[0m") \ + LESS_TERMCAP_so=$(printf "\e[1;44;33m") \ + LESS_TERMCAP_ue=$(printf "\e[0m") \ + LESS_TERMCAP_us=$(printf "\e[1;32m") \ + man "$@" +} + +# SOURCE CUSTOM USER-SPECIFIC +if [ -f ~/.zsh_custom ]; then + source ~/.zsh_custom +fi +if [ -f ~/.zsh_systemd ]; then + source ~/.zsh_systemd +fi +if [ -f ~/.zsh_archlinux ]; then + source ~/.zsh_archlinux +fi + +# KEYBINDINGS +typeset -A key + +key[Home]=${terminfo[khome]} +key[End]=${terminfo[kend]} +key[Insert]=${terminfo[kich1]} +key[Delete]=${terminfo[kdch1]} +key[Up]=${terminfo[kcuu1]} +key[Down]=${terminfo[kcud1]} +key[Left]=${terminfo[kcub1]} +key[Right]=${terminfo[kcuf1]} +key[PageUp]=${terminfo[kpp]} +key[PageDown]=${terminfo[knp]} + +[[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line +[[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line +[[ -n "${key[Insert]}" ]] && bindkey "${key[Insert]}" overwrite-mode +[[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char +[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-history +[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-history +[[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char +[[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char +[[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" beginning-of-buffer-or-history +[[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" end-of-buffer-or-history + +bindkey '^R' history-incremental-search-backward + +if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then + function zle-line-init () { + printf '%s' "${terminfo[smkx]}" + } + function zle-line-finish () { + printf '%s' "${terminfo[rmkx]}" + } + zle -N zle-line-init + zle -N zle-line-finish +fi + +# HIGHLIGHTING +if [ -f "/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ]; then + ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern) + source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +fi