diff --git a/.gitconfig b/.gitconfig index c4e1a71..8dd0dd2 100644 --- a/.gitconfig +++ b/.gitconfig @@ -5,8 +5,9 @@ lola = log --graph --decorate=full\n--pretty=oneline --abbrev-commit --all logf = "!echo \"Remember to add -S\" ; 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 @@ -20,4 +21,11 @@ [branch] autosetuprebase = always [init] - defaultBranch = master + defaultBranch = master +[filter "lfs"] + clean = git-lfs clean -- %f + smudge = git-lfs smudge -- %f + process = git-lfs filter-process + required = true +[gpg] + format = ssh diff --git a/.zshrc b/.zshrc index cda7796..cb62e9e 100644 --- a/.zshrc +++ b/.zshrc @@ -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 diff --git a/aliases.zsh b/aliases.zsh deleted file mode 100644 index 7b89d43..0000000 --- a/aliases.zsh +++ /dev/null @@ -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 -- 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)" &} -} - diff --git a/prompt.zsh b/prompt.zsh deleted file mode 100644 index 1b37505..0000000 --- a/prompt.zsh +++ /dev/null @@ -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 "" -} diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh new file mode 100644 index 0000000..9ea5878 --- /dev/null +++ b/zsh/aliases.zsh @@ -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 +} + diff --git a/options.zsh b/zsh/options.zsh similarity index 92% rename from options.zsh rename to zsh/options.zsh index ad26045..50fcb15 100644 --- a/options.zsh +++ b/zsh/options.zsh @@ -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 - +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 diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh new file mode 100644 index 0000000..dffed9f --- /dev/null +++ b/zsh/prompt.zsh @@ -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=""