Skip to content

Instantly share code, notes, and snippets.

@mrroot5
Last active October 4, 2022 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrroot5/91661b21245c52822628e42f5e9bf301 to your computer and use it in GitHub Desktop.
Save mrroot5/91661b21245c52822628e42f5e9bf301 to your computer and use it in GitHub Desktop.
Zsh alias. Asegúrate de que en .zshrc se hace referencia a este fichero, mira el ejemplo.Ambos ficheros deben estar en la home.
# Functions
#
# System functions
#
find_kill_process() {
# This function shows the process list and search on it
# Requires fzf available
pid=$(ps -ef | sed 1d | eval "fzf $FZF_DEFAULT_OPTS -m --header='[kill:process]'" | awk '{print $2}')
if [ ! -z "$pid" ]
then
if [ -z "$1" ]
then
kill $pid
else
kill $1 $pid
fi
fi
}
# End system functions
# Git functions
#
git_merge_develop() {
if [ -z "$1" ]
then
git merge --log develop
else
git merge --log $1
fi
}
# End git function
#
# Virtualenv functions
#
init_virtualenv() {
if [ -z "$1" ]
then
. env/bin/activate
else
. $1/bin/activate
fi
}
close_virtualenv() {
deactivate
}
# End virtualenv functions
#
# Alias List
#
# System
alias ls='ls -lah'
alias kp=find_kill_process
#
# Git
alias gmodl=git_merge_develop
alias kp=find_kill_process
#
# Virtualenv
alias onenv=init_virtualenv
alias offenv=close_virtualenv
# Add at bottom of .zshrc
if [ -f ~/.zsh_aliases ]; then
source ~/.zsh_aliases
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment