Add zsh
This commit is contained in:
117
zsh/.zshrc
Normal file
117
zsh/.zshrc
Normal file
@@ -0,0 +1,117 @@
|
||||
## Brew configuration
|
||||
# used fix for git completions
|
||||
# https://stackoverflow.com/a/77774933
|
||||
|
||||
# Init Homebrew to get `HOMEBREW_PREFIX`
|
||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||
|
||||
# Delete brew's objectively worse git completion
|
||||
remove_conflicting_git_completions() {
|
||||
local git_completion_bash="$HOMEBREW_PREFIX/share/zsh/site-functions/git-completion.bash"
|
||||
local git_completion_zsh="$HOMEBREW_PREFIX/share/zsh/site-functions/_git"
|
||||
|
||||
[ -e "$git_completion_bash" ] && rm "$git_completion_bash"
|
||||
[ -e "$git_completion_zsh" ] && rm "$git_completion_zsh"
|
||||
}
|
||||
|
||||
# This needs to run every time since brew sometimes brings those files back
|
||||
remove_conflicting_git_completions
|
||||
|
||||
# Add Homebrew's site functions to fpath (minus git, because that causes conflicts)
|
||||
# This will give you autocomplete for _other_ things you installed
|
||||
# from brew (like `just`, or `exa`, or `k6`)
|
||||
fpath=($HOMEBREW_PREFIX/share/zsh/site-functions $fpath)
|
||||
|
||||
# Path to your oh-my-zsh installation.
|
||||
export ZSH="/Users/liquidpredator/.oh-my-zsh"
|
||||
|
||||
# Set name of the theme to load
|
||||
#ZSH_THEME="dracula"
|
||||
|
||||
#Plugin configurations
|
||||
zstyle ':omz:plugins:eza' 'dirs-first' yes
|
||||
zstyle ':omz:plugins:eza' 'icons' yes
|
||||
|
||||
# Which plugins would you like to load?
|
||||
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
|
||||
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
|
||||
# Example format: plugins=(rails git textmate ruby lighthouse)
|
||||
# Add wisely, as too many plugins slow down shell startup.
|
||||
plugins=(
|
||||
aws
|
||||
docker
|
||||
eza
|
||||
fancy-ctrl-z
|
||||
fzf
|
||||
gcloud
|
||||
gitfast
|
||||
gitignore
|
||||
helm
|
||||
k9s
|
||||
kubectl
|
||||
mise
|
||||
starship
|
||||
terraform
|
||||
thefuck
|
||||
zoxide
|
||||
zsh-autosuggestions
|
||||
)
|
||||
|
||||
# Run oh-my-zsh
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
## User configuration
|
||||
|
||||
# Preferred editor for local and remote sessions
|
||||
if [[ -n $SSH_CONNECTION ]]; then
|
||||
export EDITOR='vim'
|
||||
else
|
||||
export EDITOR='nvim'
|
||||
fi
|
||||
|
||||
# Set personal aliases, overriding those provided by oh-my-zsh libs,
|
||||
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
|
||||
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
|
||||
# For a full list of active aliases, run `alias`.
|
||||
#
|
||||
# Example aliases
|
||||
# alias zshconfig="mate ~/.zshrc"
|
||||
# alias ohmyzsh="mate ~/.oh-my-zsh"
|
||||
alias vi="nvim"
|
||||
alias vim="nvim"
|
||||
alias vimdiff="nvim -d"
|
||||
alias ovim="/usr/bin/vim"
|
||||
|
||||
alias vimz="nvim ~/.config/zsh/.zshrc"
|
||||
alias vimn="nvim ~/.config/nvim"
|
||||
|
||||
alias gh="cd ~ && clear"
|
||||
alias gw="cd ~/work && clear"
|
||||
alias gp="cd ~/personal && clear"
|
||||
|
||||
# Functions
|
||||
|
||||
#Generate strong password
|
||||
pwg() {
|
||||
pwgen -cny -r \[\]\{\}\(\)\"\'\-\|\:\;\`\,\<\>\$\= 32 1
|
||||
}
|
||||
|
||||
# Yazi
|
||||
function y() {
|
||||
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd
|
||||
yazi "$@" --cwd-file="$tmp"
|
||||
if cwd="$(command cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
|
||||
builtin cd -- "$cwd"
|
||||
fi
|
||||
rm -f -- "$tmp"
|
||||
}
|
||||
|
||||
# YandexCloud CLI completion
|
||||
# NOTE: Versions checked from utility version output
|
||||
source "$HOMEBREW_PREFIX/Caskroom/yandex-cloud-cli/$(yc --version | egrep -o "([0-9]{1,}\.)+[0-9]{1,}")/yandex-cloud-cli/completion.zsh.inc"
|
||||
|
||||
# TFEnv yandex mirror
|
||||
export TFENV_REMOTE=https://hashicorp-releases.yandexcloud.net
|
||||
|
||||
# Add Docker Desktop for Mac (docker)
|
||||
export PATH="$PATH:/Applications/Docker.app/Contents/Resources/bin/"
|
||||
14
zsh/README.md
Normal file
14
zsh/README.md
Normal file
@@ -0,0 +1,14 @@
|
||||
### Configuration
|
||||
|
||||
Create file `~/.zprofile` with content
|
||||
```
|
||||
export ZDOTDIR="$HOME/.config/zsh"
|
||||
```
|
||||
|
||||
### Requirements
|
||||
#### ohmyzsh
|
||||
https://github.com/ohmyzsh/ohmyzsh
|
||||
|
||||
```shell
|
||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
||||
```
|
||||
Reference in New Issue
Block a user