Skip to content

Instantly share code, notes, and snippets.

@saippuakauppias
Created September 16, 2025 08:02
Show Gist options
  • Select an option

  • Save saippuakauppias/8fae99cb50c87ea7b7cc2efdfee28d00 to your computer and use it in GitHub Desktop.

Select an option

Save saippuakauppias/8fae99cb50c87ea7b7cc2efdfee28d00 to your computer and use it in GitHub Desktop.
~/.zshrc
# Обязательно https://ohmyz.sh/
#
# Тут дефолтное содержимое файла ~/.zshrc
# Дальше – кастомное (https://gitlab.corp.mail.ru/-/snippets/2069)
#
#
# git shortcuts
#
function git_commit_with_prefix () {
# Добавляет номер задачи к каждому коммиту
local message=$1
if [[ -z "${message}" ]]
then
>&2 echo 'Empty commit message'
return 1
fi
local branch="$(git_current_branch)"
local issue_id="$(echo ${branch} | grep -oE '^[a-zA-Z]+\-\d+' | awk '{ print toupper($0) }')"
if [[ -z "${issue_id}" ]]
then
>&2 echo "Branch name does not match the pattern. Current branch is: ${branch}"
return 1
fi
git commit -a -m "${issue_id}: ${message}"
}
alias gc=git_commit_with_prefix
alias gst='git status'
alias gcd='git checkout'
alias gcd-='git checkout -' # previous branch
alias gcm='git checkout $(git_main_branch)'
alias gb='git branch'
alias glg='git log --stat --max-count=5'
alias ga='git add'
alias gd='git diff'
alias gds='git diff --staged'
alias ggpull='git pull origin $(git_current_branch)'
alias ggpush='git push origin $(git_current_branch)'
#alias gf='git fetch'
alias greset='git reset HEAD~1'
#
# Плагины
# see also: ~/.oh-my-zsh/plugins/git/git.plugin.zsh
# Не забыть выполнить после сохранения этого конфига в новом табе(!): zplug install
#
export ZPLUG_HOME=/opt/homebrew/opt/zplug
source $ZPLUG_HOME/init.zsh
zplug "plugins/colored-man-pages", from:oh-my-zsh
# в основном добавляют автодополнение для команд
zplug "plugins/docker-compose", from:oh-my-zsh
zplug "plugins/docker", from:oh-my-zsh
zplug "plugins/brew", from:oh-my-zsh
#
# direnv + pyenv
# Установка:
# brew install direnv pyenv
#
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
eval "$(direnv hook zsh)"
#
# usefull aliases
#
alias ll="ls -lah"
#
# individual history: https://superuser.com/questions/1245273/iterm2-version-3-individual-history-per-tab
#
unsetopt inc_append_history
unsetopt share_history
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment