diff options
| author | Simen A. W. Olsen <hello@simenandre.no> | 2024-12-27 20:09:44 +0100 |
|---|---|---|
| committer | Simen A. W. Olsen <hello@simenandre.no> | 2024-12-27 20:09:44 +0100 |
| commit | 240106d9782a6f35d1cc0cf6ad56126d42bf5764 (patch) | |
| tree | d0293c643d82a7307e48a50b8ec4b7bfd6e7b408 /zsh/.config | |
| parent | b2bdcbc530b7482126118acd3ca2efcbf0014cdb (diff) | |
| download | dotfiles-240106d9782a6f35d1cc0cf6ad56126d42bf5764.tar.gz dotfiles-240106d9782a6f35d1cc0cf6ad56126d42bf5764.zip | |
add zsh setup
Diffstat (limited to 'zsh/.config')
| -rw-r--r-- | zsh/.config/zsh/.zshenv | 3 | ||||
| -rwxr-xr-x | zsh/.config/zsh/aliases | 31 | ||||
| -rwxr-xr-x | zsh/.config/zsh/extras | 28 | ||||
| -rwxr-xr-x | zsh/.config/zsh/path | 13 |
4 files changed, 75 insertions, 0 deletions
diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv new file mode 100644 index 0000000..51b9cf4 --- /dev/null +++ b/zsh/.config/zsh/.zshenv @@ -0,0 +1,3 @@ +export ZDOTDIR=$HOME/.config/zsh + +. "$HOME/.cargo/env" diff --git a/zsh/.config/zsh/aliases b/zsh/.config/zsh/aliases new file mode 100755 index 0000000..ebda55c --- /dev/null +++ b/zsh/.config/zsh/aliases @@ -0,0 +1,31 @@ +# Git aliases +alias git-unpushed='git log --branches --not --remotes --no-walk --decorate --oneline' +alias gb='git checkout -b' +alias gfr='git fetch upstream && git rebase upstream/main' +alias git-undo='git reset --soft HEAD~1' +alias git-clean-branches="git for-each-ref --format '%(refname:short)' refs/heads | grep -v 'master\|main' | xargs git branch -D" +alias :q='exit' +alias ls='ls --color' + +# Generic / Random / Utility +alias rg="rg --hidden --glob '!.git' --glob '!node_modules'" +alias r='cd $REPOS/github.com/' +alias c='clear' +alias afk='pmset displaysleepnow' +alias dl="cd ~/Downloads" +alias l='ls -l' +alias todo='nt' +alias tasks="open 'obsidian://open?file=-%20Oppgaver'" +alias todos="mt ~/ghq/github.com/simenandre/notes/" +# alias docker-compose=podman-compose +alias today="open 'obsidian://advanced-uri?daily=true'" +alias tre="tree -I '.git|node_modules'" +alias timeliste="open 'https://tripletex.no/execute/updateHourlist?contextId=11208568'" +alias t="open 'https://tripletex.no/execute/updateHourlist?contextId=11208568'" +alias fork-cleaner="fork-cleaner --token $(cat ~/.secrets/github-token)" +alias vi="nvim" +alias vim="nvim" +alias v="nvim" + +alias dump-issues="getBjerkIssues > ~/Downloads/issues-$(date -I).json" + diff --git a/zsh/.config/zsh/extras b/zsh/.config/zsh/extras new file mode 100755 index 0000000..0647ca0 --- /dev/null +++ b/zsh/.config/zsh/extras @@ -0,0 +1,28 @@ +NOTES_DIR=$HOME/ghq/github.com/simenandre/notes/ +function note() { + if [ $1 ]; then + FILE=$NOTES_DIR/$(date +%Y-%m-%d).md + + if [ $2 ]; then + FILE=$2 + fi + + echo $1 >> $FILE + fi +} + +function nt() { + if [ $1 ]; then + CONTENT="- [ ] $1" + note $CONTENT $2 + fi +} + +function getBjerkIssues() { + gh issue list --repo bjerkio/internal \ + --search "-label:backlog -label:kind/system" \ + --json title,body,url,createdAt,assignees,number,labels,comments \ + --jq 'map({url, createdAt, title, labels: [.labels[].name], assignees: [.assignees[].login], body, number: "#\(.number)", comments: .comments | map({ body: .body, createdAt: .createdAt })})' +} + + diff --git a/zsh/.config/zsh/path b/zsh/.config/zsh/path new file mode 100755 index 0000000..ef41549 --- /dev/null +++ b/zsh/.config/zsh/path @@ -0,0 +1,13 @@ +#!/bin/bash + +# Add directories to the PATH and prevent to add the same directory multiple times upon shell reload. +add_to_path() { + if [[ -d "$1" ]] && [[ ":$PATH:" != *":$1:"* ]]; then + export PATH="$1:$PATH" + fi +} + +# Add ghq to PATH +add_to_path "$GOPATH/bin" +add_to_path "/Library/Frameworks/Firebird.framework/Resources/bin" + |
