summaryrefslogtreecommitdiff
path: root/.config/zsh
diff options
context:
space:
mode:
authorRoger Gonzalez <roger@rogs.me>2022-08-11 10:02:06 -0300
committerRoger Gonzalez <roger@rogs.me>2022-08-11 10:02:06 -0300
commit70dcf12bedb745c731682871e92a9e3d3983d776 (patch)
tree3ab074fb0a5144dca361887a13042c2244d6e37d /.config/zsh
parent269c2695f989c68c2aadff12c7f57741c0363c64 (diff)
Add zsh config
Diffstat (limited to '.config/zsh')
-rw-r--r--.config/zsh/config.d/abbreviations.zsh105
-rw-r--r--.config/zsh/config.d/alias.zsh41
2 files changed, 146 insertions, 0 deletions
diff --git a/.config/zsh/config.d/abbreviations.zsh b/.config/zsh/config.d/abbreviations.zsh
new file mode 100644
index 00000000..376eab03
--- /dev/null
+++ b/.config/zsh/config.d/abbreviations.zsh
@@ -0,0 +1,105 @@
+#!/usr/bin/env zsh
+
+### SETUP ABREVIATIONS ###
+# declare a list of expandable aliases to fill up later
+typeset -a ealiases
+ealiases=()
+
+# write a function for adding an alias to the list mentioned above
+function abbrev-alias() {
+ alias $1
+ ealiases+=(${1%%\=*})
+}
+
+# expand any aliases in the current line buffer
+function expand-ealias() {
+ if [[ $LBUFFER =~ "\<(${(j:|:)ealiases})\$" ]]; then
+ zle _expand_alias
+ zle expand-word
+ fi
+ zle magic-space
+}
+zle -N expand-ealias
+
+# Bind the space key to the expand-alias function above, so that space will expand any expandable aliases
+bindkey ' ' expand-ealias
+bindkey '^ ' magic-space # control-space to bypass completion
+bindkey -M isearch " " magic-space # normal space during searches
+
+# A function for expanding any aliases before accepting the line as is and executing the entered command
+expand-alias-and-accept-line() {
+ expand-ealias
+ zle .backward-delete-char
+ zle .accept-line
+}
+zle -N accept-line expand-alias-and-accept-line
+
+# Arch
+abbrev-alias i='sudo pacman -S'
+abbrev-alias r='sudo pacman -Rsu'
+
+# NPM
+abbrev-alias ni='npm install'
+abbrev-alias nis='npm install --save'
+abbrev-alias nisd='npm install --save-dev'
+abbrev-alias nig='npm install -g'
+abbrev-alias np='npm prune'
+abbrev-alias nl='npm list'
+abbrev-alias nr='npm remove'
+abbrev-alias nu='npm update'
+abbrev-alias ns='npm start'
+abbrev-alias nt='npm test'
+
+# Git
+abbrev-alias g='git'
+abbrev-alias ga.='git add .'
+abbrev-alias ga='git add'
+abbrev-alias gb='git branch'
+abbrev-alias gbd='git branch -D'
+abbrev-alias gcm='git checkout master'
+abbrev-alias gco='git checkout'
+abbrev-alias gcob='git checkout -b'
+abbrev-alias gcod='git checkout development'
+abbrev-alias gi='gitignore'
+abbrev-alias gm='git merge'
+abbrev-alias gpl='git pull'
+abbrev-alias gps='git push'
+abbrev-alias gpsu='git push -u origin master'
+abbrev-alias gs='git status'
+abbrev-alias gc='git clone'
+abbrev-alias gd='git diff'
+abbrev-alias gcd='git checkout develop'
+abbrev-alias gpd='git pull origin develop'
+abbrev-alias gpm='git pull origin master'
+abbrev-alias gst='git stash'
+abbrev-alias gsta='git stash apply'
+abbrev-alias gr='git reset --hard'
+
+# <a href="https://github.com/petervanderdoes/gitflow-avh">Git Flow AVH</a>
+abbrev-alias gf='git flow'
+abbrev-alias gfi='git flow init -d'
+
+abbrev-alias gff='git flow feature'
+abbrev-alias gffs='git flow feature start'
+abbrev-alias gfff='git flow feature finish'
+abbrev-alias gffp='git flow feature publish'
+abbrev-alias gfft='git flow feature track'
+abbrev-alias gffco='git flow feature checkout'
+abbrev-alias gfr='git flow release'
+abbrev-alias gfrs='git flow release start'
+abbrev-alias gfrf='git flow release finish'
+abbrev-alias gfrp='git flow release publish'
+abbrev-alias gfrt='git flow release track'
+abbrev-alias gfrco='git flow release checkout'
+abbrev-alias gfb='git flow bugfix'
+abbrev-alias gfbs='git flow bugfix start'
+abbrev-alias gfbf='git flow bugfix finish'
+abbrev-alias gfbp='git flow bugfix publish'
+abbrev-alias gfbt='git flow bugfix track'
+abbrev-alias gfbco='git flow bugfix checkout'
+abbrev-alias gfh='git flow hotfix'
+abbrev-alias gfhs='git flow hotfix start'
+abbrev-alias gfhf='git flow hotfix finish'
+abbrev-alias gfhp='git flow hotfix publish'
+abbrev-alias gfht='git flow hotfix track'
+abbrev-alias gfhco='git flow hotfix checkout'
diff --git a/.config/zsh/config.d/alias.zsh b/.config/zsh/config.d/alias.zsh
new file mode 100644
index 00000000..4c491d1e
--- /dev/null
+++ b/.config/zsh/config.d/alias.zsh
@@ -0,0 +1,41 @@
+#!/usr/bin/env zsh
+
+# Colorize grep output (good for log files)
+alias grep='grep --color=auto'
+alias egrep='egrep --color=auto'
+alias fgrep='fgrep --color=auto'
+
+# confirm before overwriting something
+alias cp="cp -i"
+alias mv='mv -i'
+alias rm='rm -i'
+
+alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
+alias ..='cd ..'
+alias df='df -h' # human-readable sizes
+alias free='free -m' # show sizes in MB
+
+
+alias ls='exa -la --color=always --group-directories-first'
+alias pr='ping rogs.me'
+alias my-ip="curl ifconfig.me"
+alias emacs="emacsclient -c -a 'emacs'"
+alias prometeo="cd ~/code/prometeo/prometeo"
+alias prometeo-vpn="sudo wg-quick down wg0 && mullvad disconnect && sudo wg-quick up wg0"
+
+# GIT
+alias gcd="git checkout develop"
+
+# SSH
+alias cloud="ssh root@cloud.rogs.me"
+
+# Python
+
+alias mkv="mkv .venv"
+
+mvenv() {
+ deactivate || true
+ rm -rf .venv
+ mkv
+ pip install -r "$1"
+}