Brew

Ставим консольные пакеты:

$ brew leaves

caddy
certbot
cloc
dos2unix
eza
f3
ffmpeg
git
git-lfs
hadolint
htop
httpie
jq
kopia
midnight-commander
ncdu
nvm
openjdk@17
sloc
ssh-copy-id
tmux
tree
vim
wakeonlan
yarn
yq

GUI для Git-комитов:

$ brew install cask rowanj-gitx

UI Apps

Ставим графические приложения:

  • Magnet
  • The Unarchiver
  • Amphetamine
  • iTerm
  • ScreenBrush
  • Microsoft Remote Desktop
  • VS Code
  • IntelliJ IDEA
  • Rancher Desktop
  • Google Chrome

Настроечные файлы

У меня 2 основных файла.

~/.zshrc:

if [ -d "$HOME/bin" ] ; then
  export PATH=$HOME/bin:$PATH
fi

if [ -d "$HOME/.bin" ] ; then
  export PATH=$HOME/.bin:$PATH
fi

if [ -d "/opt/bin" ] ; then
  export PATH=/opt/bin:$PATH
fi

# mkdir .git/safe in the root of repositories you trust
export PATH=".git/safe/../../bin:$PATH"

export EDITOR='vim'
export VISUAL=$EDITOR
export CLICOLOR=1

setopt autocd
alias -g ...='../..'
alias -g ....='../../..'
alias -g .....='../../../..'
alias -g ......='../../../../..'

# tab complection like in mc
zstyle ':complection:*:*:*:*:*' menu select

#Hot keys for Mac
bindkey '\e\e[C' forward-word
bindkey '\e\e[D' backward-word

# Disable global history
unsetopt share_history

alias on_nas="wakeonlan 11:22:33:44:55:66"

eval "$(/opt/homebrew/bin/brew shellenv)"

# Rancher Desktop
export PATH="$PATH:${HOME}/.rd/bin"

alias k=kubectl
alias d=docker
alias kg="kubectl get"
alias kga="kubectl get all"
alias kgp="kubectl get pods"
alias kd="kubectl describe"
alias kdp="kubectl describe pod"
alias kds="kubectl describe service"
alias kl="kubectl logs"
alias knonr="kubectl get pods|grep -v 1/1|grep -v 2/2|grep -v 3/3|grep -v 4/4|grep -v 5/5|grep -v 6/6"
function ke(){
  kubectl exec -it "$@" -- bash
}
function kes(){
  kubectl exec -it "$@" -- sh
}

#Theme
function check_last_exit_code() {
  local LAST_EXIT_CODE=$?
  if [[ $LAST_EXIT_CODE -ne 0 ]]; then
    local EXIT_CODE_PROMPT=' '
    EXIT_CODE_PROMPT+="%{$fg[red]%}-%{$reset_color%}"
    EXIT_CODE_PROMPT+="%{$fg_bold[red]%}$LAST_EXIT_CODE%{$reset_color%}"
    EXIT_CODE_PROMPT+="%{$fg[red]%}-%{$reset_color%}"
    echo "$EXIT_CODE_PROMPT"
  fi
}

function __git_prompt_git() {
  GIT_OPTIONAL_LOCKS=0 command git "$@"
}

function git_prompt_info() {
  # If we are on a folder not tracked by git, get out.
  # Otherwise, check for hide-info at global and local repository level
  if ! __git_prompt_git rev-parse --git-dir &> /dev/null \
     || [[ "$(__git_prompt_git config --get oh-my-zsh.hide-info 2>/dev/null)" == 1 ]]; then
    return 0
  fi

  local ref
  ref=$(__git_prompt_git symbolic-ref --short HEAD 2> /dev/null) \
  || ref=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) \
  || return 0

  # Use global ZSH_THEME_GIT_SHOW_UPSTREAM=1 for including upstream remote info
  local upstream
  if (( ${+ZSH_THEME_GIT_SHOW_UPSTREAM} )); then
    upstream=$(__git_prompt_git rev-parse --abbrev-ref --symbolic-full-name "@{upstream}" 2>/dev/null) \
    && upstream=" -> ${upstream}"
  fi

  echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref:gs/%/%%}${upstream:gs/%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
}

# Checks if working tree is dirty
function parse_git_dirty() {
  local STATUS
  local -a FLAGS
  FLAGS=('--porcelain')
  if [[ "$(__git_prompt_git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
    if [[ "${DISABLE_UNTRACKED_FILES_DIRTY:-}" == "true" ]]; then
      FLAGS+='--untracked-files=no'
    fi
    case "${GIT_STATUS_IGNORE_SUBMODULES:-}" in
      git)
        # let git decide (this respects per-repo config in .gitmodules)
        ;;
      *)
        # if unset: ignore dirty submodules
        # other values are passed to --ignore-submodules
        FLAGS+="--ignore-submodules=${GIT_STATUS_IGNORE_SUBMODULES:-dirty}"
        ;;
    esac
    STATUS=$(__git_prompt_git status ${FLAGS} 2> /dev/null | tail -n 1)
  fi
  if [[ -n $STATUS ]]; then
    echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
  else
    echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
  fi
}

setopt PROMPT_SUBST
PROMPT='%~$(git_prompt_info)%(?.%(!.#.$).%{$fg[red]%}%(!.#.$)%{$reset_color%}) '
if [[ -n $SSH_CONNECTION ]];
then
  RPROMPT="$(check_last_exit_code)%{$fg_bold[grey]%}%n@%m%{$reset_color%}"
else
  RPROMPT='$(check_last_exit_code)'
fi

ZSH_THEME_GIT_PROMPT_PREFIX=" ("
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
ZSH_THEME_GIT_PROMPT_DIRTY=" *"
ZSH_THEME_GIT_PROMPT_CLEAN=""

~/.gitconfig:

[user]
	name = My Name
	email = myName@example.com
[http]
	sslCAinfo = /Users/stepin/home/certs/traefik.lan.cer
	sslverify = true
[apply]
	whitespace = nowarn
[alias]
	s  = status
	st = status
	ci = commit
	co = checkout
	br = branch
	df = diff
	cp = cherry-pick
	lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
	ls = log --all -i --grep
	files = "!git diff --name-status $1^ $1"
	changes = "!git log $1..HEAD --pretty=format: --name-only | sort | uniq -c | sort -rg"
[color]
	ui = auto
[gui]
	fontui = -family \"Lucida Grande CY\" -size 13 -weight normal -slant roman -underline 0 -overstrike 0
	fontdiff = -family \"Charcoal CY\" -size 10 -weight normal -slant roman -underline 0 -overstrike 0
[core]
	whitespace=fix,-indent-with-non-tab,cr-at-eol
	ignorecase = false
	editor = code --wait
[diff]
	tool = vscode
[difftool "vscode"]
	cmd = code --wait --diff $LOCAL $REMOTE
[github]
	user = myGithubUsername
	token = token
	username = myGithubUsername
[merge]
	tool = vscode
[commit]
	template = ~/.gitmessage
[branch]
	autosetupmerge = true
[push]
	default = simple
[mergetool "vscode"]
	cmd = code -w $MERGED
[filter "lfs"]
	smudge = git-lfs smudge -- %f
	process = git-lfs filter-process
	required = true
	clean = git-lfs clean -- %f
[includeIf "gitdir:~/workFolder/"]
	path = ~/workFolder/.gitconfig
[init]
	defaultBranch = main