This commit is contained in:
Morten Olsen
2023-09-16 12:33:21 +02:00
parent 6dbaad1bbe
commit 33f79566b7
65 changed files with 387 additions and 228 deletions

View File

@@ -0,0 +1,2 @@
export PATH="$PATH:$HOME/.local/bin"

View File

@@ -0,0 +1,34 @@
alias ..="cd .."
alias g="git"
alias ls="eza"
alias mutt="neomutt"
alias gr="cd \`git rev-parse --show-toplevel\`"
# Enable aliases to be sudoed
alias sudo='sudo '
# Get week number
alias week='date +%V'
# macOS has no `md5sum`, so use `md5` as a fallback
command -v md5sum > /dev/null || alias md5sum="md5"
# macOS has no `sha1sum`, so use `shasum` as a fallback
command -v sha1sum > /dev/null || alias sha1sum="shasum"
# Print each PATH entry on a separate line
alias path='echo -e ${PATH//:/\\n}'
# Enable tab completion for `g` by marking it as an alias for `git`
command -v _git > /dev/null && command -v complete > /dev/null && complete -o default -o nospace -F _git g
command -v xsel > /dev/null || alias copy='xsel -ib'
command -v urxvt > /dev/null || alias n="setsid urxvt &>/dev/null"
alias sc="sudo systemctl"
alias usermount="sudo mount -o gid=users,fmask=113,dmask=002"
alias fzf="fzf --preview 'bat {} --line-range 0:100 --color always'"
alias stmux="tmux a -t base || tmux new -s base"

View File

@@ -0,0 +1,6 @@
if hash bat &> /dev/null; then
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
export BAT_THEME="MonokaiExtended"
alias cat="bat"
fi

View File

@@ -0,0 +1,8 @@
export TMPDIR=${TMPDIR:-/tmp}
if ! pgrep -U "$UID" ssh-agent > /dev/null; then
ssh-agent > "$XDG_RUNTIME_DIR/ssh-agent.env"
fi
if [[ ! "$SSH_AUTH_SOCK" ]]; then
eval "$(<"$XDG_RUNTIME_DIR/ssh-agent.env")"
fi

View File

@@ -0,0 +1,7 @@
export GH_TOKEN=${GH_TOKEN:-unset}
export NPM_GH_TOKEN=${GH_TOKEN:-unset}
export NPM_NPM_TOKEN=${NPM_NPM_TOKEN:-unset}
export PUBLISH_NPM_GITLAB_TOKEN=${NPM_NPM_TOKEN:-unset}
export NPM_PRIVATE_TOKEN=${NPM_PRIVATE_TOKEN:-unset}
npm set prefix ~/.npm-global

View File

@@ -0,0 +1 @@
export FZF_DEFAULT_COMMAND='ag -g ""'

View File

@@ -0,0 +1,5 @@
export GPG_TTY="$(tty)"
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
gpgconf --launch gpg-agent
gpg-connect-agent updatestartuptty /bye > /dev/null

View File

@@ -0,0 +1,3 @@
export EDITOR=nvim
alias vim=nvim

View File

@@ -0,0 +1,26 @@
function _bw_replace_env() {
env | while IFS= read -r line; do
value=${line#*=}
name=${line%%=*}
if [[ $value = bw://* ]]; then;
item=${value:5}
secret=`bw get password $item`
export $name="$secret"
fi
done
}
function clam-open() {
command=$1
if [[ -z "$BW_SESSION" ]]; then;
export BW_SESSION=`bw unlock --raw`
fi
_bw_replace_env
if [[ ! -z "$command" ]]; then;
eval $command
fi
}
function clam-close() {
unset BW_SESSION
}