Update dotfiles

This commit is contained in:
2025-11-06 10:01:30 +01:00
parent b41eb3bfef
commit 2465032eef
7 changed files with 76 additions and 91 deletions

View File

@@ -5,8 +5,9 @@
lola = log --graph --decorate=full\n--pretty=oneline --abbrev-commit --all
logf = "!echo \"Remember to add -S<string>\" ; git log --color -p --source --all"
[user]
name = olemorud
email = ole.kristian.morud@cern.ch
name = Ole Morud
email = ole-morud-git.football131@simplelogin.com
signingkey = /home/ole/.ssh/id_ed25519.pub
[color]
ui = true
diff = auto
@@ -21,3 +22,10 @@
autosetuprebase = always
[init]
defaultBranch = master
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[gpg]
format = ssh

5
.zshrc
View File

@@ -1,7 +1,6 @@
#!/usr/bin/awk BEGIN{print "Error: this script should be sourced!"; exit 1}
if [[ ! -v ZSH_CUSTOM ]]; then
$ZSH_CUSTOM=$HOME
fi
ZSH_CUSTOM="$HOME/zsh"
source $ZSH_CUSTOM/aliases.zsh
source $ZSH_CUSTOM/options.zsh

View File

@@ -1,67 +0,0 @@
#!/usr/bin/false
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
alias pacman="sudo pacman"
alias apt="sudo apt"
alias dnf="sudo dnf"
alias history="history 0" # force zsh to show the complete history
alias docker=_docker
_docker() {
local args
args=""
if [ "$1" = "runx" ] ; then
args="run -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix"
fi
docker "$args" "$@"
}
# lazy <source file> -- compiles and runs c/c++ in one go
alias lazy=_lazy
_lazy() {
local file
file=$1
cc $file -o "${file:0:-2}.out" -lm -g3 && gdb -q -ex run ./${file:0:-2}.out
}
# create directory and set it as cwd
alias take=_take
_take() {
if [ -z "$1" ]; then
printf 'usage: %s directory' $0 > /dev/stderr
return 1
fi
mkdir -p $1
cd $1
}
# compile markdown to html and view in browser
alias m=_m
_m() {
local file
local css
file="$1"
css="$2"
if [ -z "$file" ]; then
file="README.md"
print "Using $file as file"
fi
if [ -z "$css" ]; then
css="$HOME/air.css"
print "Using $css as stylesheet"
fi
pandoc "$file" -f gfm --css="$css" --self-contained --metadata title="$file" | { chromium-browser "data:text/html;base64,$(base64 -w 0)" &}
}

View File

@@ -1,13 +0,0 @@
#!/usr/bin/false
configure_prompt() {
PROMPT=" 🐢 %F{240}%~
$%f "
RPROMPT="%T - %?"
}
precmd() {
# Print the previously configured title
print -Pnr -- "$TERM_TITLE"
print ""
}

26
zsh/aliases.zsh Normal file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/false
# LC_COLLATE=C: sort case-sensitive, i.e. README before aaa.py
alias ls='LC_COLLATE=C ls --color --group-directories-first'
alias ll='LC_COLLATE=C ls -la'
alias la='LC_COLLATE=C ls -A'
alias l='LC_COLLATE=C ls -CF'
alias xo='xdg-open'
alias pacman="sudo pacman"
alias history="history 0" # force zsh to show the complete history
# create directory and set it as cwd
alias take=_take
_take() {
if [ -z "$1" ]; then
printf 'usage: %s directory' $0 > /dev/stderr
return 1
fi
mkdir -p $1
cd $1
}

View File

@@ -1,4 +1,3 @@
#!/usr/bin/false
#setopt autocd # change directory just by typing its name
#setopt correct # auto correct mistakes
@@ -33,17 +32,20 @@ zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
# History configurations
HISTFILE=~/.zsh_history
HISTSIZE=1000
SAVEHIST=2000
HISTSIZE=10000
SAVEHIST=20000
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it
setopt share_history # share command history data
# configure `time` format
TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P'
# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line
bindkey "^[[3~" delete-char

30
zsh/prompt.zsh Normal file
View File

@@ -0,0 +1,30 @@
autoload -Uz add-zsh-hook
autoload -Uz vcs_info
add-zsh-hook precmd vcs_info
precmd() {
# Print the previously configured title
print -Pnr -- "$TERM_TITLE"
print ""
}
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:git:*' stagedstr '+'
zstyle ':vcs_info:git:*' unstagedstr '!'
zstyle ':vcs_info:git:*' formats '(%s %b%u%c)'
zstyle ':vcs_info:git:*' actionformats '(%s %b%u%c %a)'
zstyle ':vcs_info:*:*' actionformats '(%s %b)'
setopt prompt_subst
setopt print_exit_value
# ternary example: "%(?.A.B)"
# (here ? is the previous return)
PROMPT='%F{240} [%T] %~ ${vcs_info_msg_0_}
$%f '
RPROMPT=""