Last active
January 2, 2024 12:24
-
-
Save Alistair1231/aaedcf19be1102ae3d1472407f1f380e to your computer and use it in GitHub Desktop.
installs antigen and applies my personal config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
# curl -L "https://gist.githubusercontent.com/Alistair1231/aaedcf19be1102ae3d1472407f1f380e/raw/.antigen-setup.sh" | bash && zsh | |
# curl -L "https://gist.githubusercontent.com/Alistair1231/aaedcf19be1102ae3d1472407f1f380e/raw/.antigen-setup.sh" | sudo bash && sudo zsh | |
case $(command -v apt pacman dnf zypper 2>/dev/null) in | |
*apt) sudo apt update; sudo apt install build-essential git zsh -y;; | |
*pacman) sudo pacman -Sy; sudo pacman -S --noconfirm --needed base-devel git zsh;; | |
*dnf) sudo dnf install make automake gcc gcc-c++ kernel-devel git zsh;; | |
*zypper) sudo zypper -n install -t pattern devel_basis; sudo zypper -n install git zsh;; | |
esac | |
tee ~/.zshrc << "EOF" | |
source "${HOME}/.profile" | |
if [ -f "${HOME}/.antigen.zsh" ]; then | |
source "${HOME}/.antigen.zsh" | |
else | |
curl -L git.io/antigen > "${HOME}/.antigen.zsh" | |
source "${HOME}/.antigen.zsh" | |
fi | |
# completions, checks if the file exists and if the command is installed | |
for i in kompose kubectl minikube helm docker; do | |
if [[ ! -f /usr/share/zsh/vendor-completions/_$i ]] && which $i > /dev/null; then | |
echo "adding $i completion"; | |
$i completion zsh | sudo tee /usr/share/zsh/vendor-completions/_$i >/dev/null; | |
fi; | |
done | |
autoload -U compinit; compinit | |
#antigen theme ohm7yzsh/ohmyzsh themes/ys | |
antigen bundle zsh-users/zsh-completions | |
antigen bundle zsh-users/zsh-syntax-highlighting | |
antigen bundle zsh-users/zsh-autosuggestions | |
antigen bundle gantsign/zsh-plugins kubeadm | |
antigen bundle go/rancher-zsh-completion | |
antigen bundle srijanshetty/zsh-pip-completion | |
antigen bundle conda-incubator/conda-zsh-completion | |
#auto generate from --help | |
# go install github.com/dim-an/cod@latest | |
antigen bundle dim-an/cod | |
antigen bundle nix-community/nix-zsh-completions | |
#antigen bundle RobSis/zsh-completion-generator | |
#zstyle :plugin:zsh-completion-generator programs croc | |
antigen bundle Aloxaf/fzf-tab | |
antigen bundle zsh-users/zsh-history-substring-search | |
antigen apply | |
bindkey "$terminfo[kcuu1]" history-substring-search-up # | |
bindkey "$terminfo[kcud1]" history-substring-search-down | |
#bindkey '^[[A' history-substring-search-up # or '\eOA' | |
#bindkey '^[[B' history-substring-search-down # or '\eOB' | |
HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=1 | |
# history | |
setopt APPEND_HISTORY | |
setopt SHARE_HISTORY | |
HISTFILE=$HOME/.zhistory | |
SAVEHIST=1000 | |
HISTSIZE=999 | |
setopt HIST_EXPIRE_DUPS_FIRST | |
setopt EXTENDED_HISTORY | |
# prompt | |
autoload -Uz promptinit; promptinit | |
prompt_fade_setup blue | |
my-forward-delete-word () { | |
# do not stop deleting for these chars (in addition to normal chars) | |
local WORDCHARS='~!#$%^&*(){}[]<>?+;' | |
zle kill-word | |
} | |
zle -N my-forward-delete-word | |
my-backward-delete-word () { | |
# do not stop deleting for these chars (in addition to normal chars) | |
local WORDCHARS='~!#$%^&*(){}[]<>?+;' | |
zle backward-delete-word | |
} | |
zle -N my-backward-delete-word | |
bindkey '\e^?' my-backward-delete-word | |
# kill ford forward (alt+del) # bindkey '^[[3;3~' kill-word | |
bindkey '^[[3;3~' my-forward-delete-word | |
# Ctrl + Arrow | |
bindkey "^[[1;5C" forward-word | |
bindkey "^[[1;5D" backward-word | |
# paths | |
if [[ -d "/mnt/c/Users/alist/AppData/Local/Programs/Microsoft\ VS\ Code/bin/" ]]; then | |
export PATH="$PATH/mnt/c/Users/alist/AppData/Local/Programs/Microsoft\ VS\ Code/bin/:" | |
fi | |
if [[ -d "/mnt/d/Programs/_path" ]]; then | |
export PATH="$PATH/mnt/d/Programs/_path:" | |
fi | |
# aliases | |
if which nala > /dev/null; then | |
alias apt='\nala' | |
alias apt-get='\nala' | |
alias dapt='\apt' | |
alias nala='\nala' | |
alias sudo='sudo ' | |
fi | |
alias k='kubectl' | |
alias km='kubectl -n db-tests' | |
if which exa > /dev/null; then | |
alias ls='exa --icons'; | |
alias l='exa -al --icons'; | |
alias ll='exa -l --icons'; | |
alias tree='exa -T'; | |
else | |
echo "exa not found, using ls, consider installing exa"; | |
alias ls='\ls -h --color=auto'; | |
alias l='\ls -alh'; | |
alias ll='\ls -lh'; | |
fi | |
if which lvim > /dev/null; then | |
alias vim='lvim'; | |
alias vi='lvim'; | |
fi | |
# locate firefox | fzfp | |
# pastes the selected file path to the command line | |
if which fzf > /dev/null; then | |
alias fzfp='() { print -z -- "$(fzf)"; }'; | |
fi | |
EOF | |
# change default shell | |
sudo chsh -s /bin/zsh $USER | |
# fix for wsl | |
if grep -q Microsoft /proc/version; then | |
# this fixes tab completion taking forever in wsl! | |
echo "unsetopt PATH_DIRS" >> ~/.zshrc | |
fi | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Authors: | |
# Sorin Ionescu <sorin.ionescu@gmail.com> | |
# | |
# | |
# General | |
# | |
# Set case-sensitivity for completion, history lookup, etc. | |
zstyle ':prezto:*:*' case-sensitive 'no' | |
# Color output (auto set to 'no' on dumb terminals). | |
zstyle ':prezto:*:*' color 'yes' | |
# Add additional directories to load prezto modules from | |
# zstyle ':prezto:load' pmodule-dirs $HOME/.zprezto-contrib | |
# Allow module overrides when pmodule-dirs causes module name collisions | |
# zstyle ':prezto:load' pmodule-allow-overrides 'yes' | |
# Set the Zsh modules to load (man zshmodules). | |
# zstyle ':prezto:load' zmodule 'attr' 'stat' | |
# Set the Zsh functions to load (man zshcontrib). | |
# zstyle ':prezto:load' zfunction 'zargs' 'zmv' | |
# Set the Prezto modules to load (browse modules). | |
# The order matters. | |
zstyle ':prezto:load' pmodule \ | |
'history' \ | |
'pacman' \ | |
'gnu-utility' \ | |
'environment' \ | |
'terminal' \ | |
'directory' \ | |
'spectrum' \ | |
'utility' \ | |
'completion' \ | |
'prompt' \ | |
'syntax-highlighting' \ | |
'history-substring-search' \ | |
'autosuggestions' | |
# | |
# Autosuggestions | |
# | |
# Set the query found color. | |
# zstyle ':prezto:module:autosuggestions:color' found '' | |
# | |
# Completions | |
# | |
# Set the entries to ignore in static */etc/hosts* for host completion. | |
# zstyle ':prezto:module:completion:*:hosts' etc-host-ignores \ | |
# '0.0.0.0' '127.0.0.1' | |
# | |
# Editor | |
# | |
# Set the key mapping style to 'emacs' or 'vi'. | |
# zstyle ':prezto:module:editor' key-bindings 'vi' | |
# Auto convert .... to ../.. | |
# zstyle ':prezto:module:editor' dot-expansion 'yes' | |
# Allow the zsh prompt context to be shown. | |
#zstyle ':prezto:module:editor' ps-context 'yes' | |
# | |
# Git | |
# | |
# Ignore submodules when they are 'dirty', 'untracked', 'all', or 'none'. | |
# zstyle ':prezto:module:git:status:ignore' submodules 'all' | |
# | |
# GNU Utility | |
# | |
# Set the command prefix on non-GNU systems. | |
zstyle ':prezto:module:gnu-utility' prefix 'g' | |
# | |
# History Substring Search | |
# | |
# Set the query found color. | |
# zstyle ':prezto:module:history-substring-search:color' found '' | |
# Set the query not found color. | |
# zstyle ':prezto:module:history-substring-search:color' not-found '' | |
# Set the search globbing flags. | |
# zstyle ':prezto:module:history-substring-search' globbing-flags '' | |
# | |
# macOS | |
# | |
# Set the keyword used by `mand` to open man pages in Dash.app | |
# zstyle ':prezto:module:osx:man' dash-keyword 'manpages' | |
# | |
# Pacman | |
# | |
# Set the Pacman frontend. | |
zstyle ':prezto:module:pacman' frontend 'yay' | |
# | |
# Prompt | |
# | |
# Set the prompt theme to load. | |
# Setting it to 'random' loads a random theme. | |
# Auto set to 'off' on dumb terminals. | |
zstyle ':prezto:module:prompt' theme 'fade' | |
# Set the working directory prompt display length. | |
# By default, it is set to 'short'. Set it to 'long' (without '~' expansion) | |
# for longer or 'full' (with '~' expansion) for even longer prompt display. | |
# zstyle ':prezto:module:prompt' pwd-length 'short' | |
# Set the prompt to display the return code along with an indicator for non-zero | |
# return codes. This is not supported by all prompts. | |
# zstyle ':prezto:module:prompt' show-return-val 'yes' | |
# | |
# Python | |
# | |
# Auto switch the Python virtualenv on directory change. | |
# zstyle ':prezto:module:python:virtualenv' auto-switch 'yes' | |
# Automatically initialize virtualenvwrapper if pre-requisites are met. | |
# zstyle ':prezto:module:python:virtualenv' initialize 'yes' | |
# | |
# Ruby | |
# | |
# Auto switch the Ruby version on directory change. | |
# zstyle ':prezto:module:ruby:chruby' auto-switch 'yes' | |
# | |
# Screen | |
# | |
# Auto start a session when Zsh is launched in a local terminal. | |
# zstyle ':prezto:module:screen:auto-start' local 'yes' | |
# Auto start a session when Zsh is launched in a SSH connection. | |
# zstyle ':prezto:module:screen:auto-start' remote 'yes' | |
# | |
# SSH | |
# | |
# Set the SSH identities to load into the agent. | |
# zstyle ':prezto:module:ssh:load' identities 'id_rsa' 'id_rsa2' 'id_github' | |
# | |
# Syntax Highlighting | |
# | |
# Set syntax highlighters. | |
# By default, only the main highlighter is enabled. | |
zstyle ':prezto:module:syntax-highlighting' highlighters \ | |
'main' \ | |
'brackets' \ | |
'pattern' \ | |
'line' \ | |
'cursor' \ | |
'root' | |
# | |
# Set syntax highlighting styles. | |
# zstyle ':prezto:module:syntax-highlighting' styles \ | |
# 'builtin' 'bg=blue' \ | |
# 'command' 'bg=blue' \ | |
# 'function' 'bg=blue' | |
# | |
# Set syntax pattern styles. | |
# zstyle ':prezto:module:syntax-highlighting' pattern \ | |
# 'rm*-rf*' 'fg=white,bold,bg=red' | |
# | |
# Terminal | |
# | |
# Auto set the tab and window titles. | |
# zstyle ':prezto:module:terminal' auto-title 'yes' | |
# Set the window title format. | |
# zstyle ':prezto:module:terminal:window-title' format '%n@%m: %s' | |
# Set the tab title format. | |
# zstyle ':prezto:module:terminal:tab-title' format '%m: %s' | |
# Set the terminal multiplexer title format. | |
# zstyle ':prezto:module:terminal:multiplexer-title' format '%s' | |
# | |
# Tmux | |
# | |
# Auto start a session when Zsh is launched in a local terminal. | |
# zstyle ':prezto:module:tmux:auto-start' local 'yes' | |
# Auto start a session when Zsh is launched in a SSH connection. | |
# zstyle ':prezto:module:tmux:auto-start' remote 'yes' | |
# Integrate with iTerm2. | |
# zstyle ':prezto:module:tmux:iterm' integrate 'yes' | |
# Set the default session name: | |
# zstyle ':prezto:module:tmux:session' name 'YOUR DEFAULT SESSION NAME' | |
# | |
# Utility | |
# | |
# Enabled safe options. This aliases cp, ln, mv and rm so that they prompt | |
# before deleting or overwriting files. Set to 'no' to disable this safer | |
# behavior. | |
# zstyle ':prezto:module:utility' safe-ops 'yes' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
curl -L "https://gist.githubusercontent.com/Alistair1231/aaedcf19be1102ae3d1472407f1f380e/raw/.prezto-setup.sh" | bash