split zsh in config modules
This commit is contained in:
parent
5fa4c6df2a
commit
d7b5423c80
45
config/shared/zsh/zsh_config/aliases
Normal file
45
config/shared/zsh/zsh_config/aliases
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# -----------------------------
|
||||||
|
# OS-specific aliases for ls
|
||||||
|
# -----------------------------
|
||||||
|
OS_TYPE=$(uname)
|
||||||
|
if [[ "$OS_TYPE" == "Linux" ]]; then
|
||||||
|
alias ls='ls --color=auto --group-directories-first'
|
||||||
|
elif [[ "$OS_TYPE" == "Darwin" ]]; then
|
||||||
|
alias ls='ls --color=auto'
|
||||||
|
fi
|
||||||
|
|
||||||
|
alias ll='ls -lF'
|
||||||
|
alias lla='ll -a'
|
||||||
|
alias ld='ls -ld */'
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Vim / Neovim
|
||||||
|
# -----------------------------
|
||||||
|
if command -v nvim >/dev/null 2>&1; then
|
||||||
|
alias vim='nvim'
|
||||||
|
else
|
||||||
|
alias vim='vim'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Git aliases
|
||||||
|
# -----------------------------
|
||||||
|
alias g='git'
|
||||||
|
alias ga='git add'
|
||||||
|
alias gaa='git add --all'
|
||||||
|
alias gb='git branch'
|
||||||
|
alias gcm='git commit -m'
|
||||||
|
alias gam='git commit -am'
|
||||||
|
alias gco='git checkout'
|
||||||
|
alias gd='git diff'
|
||||||
|
alias gf='git fetch'
|
||||||
|
alias gl='git pull'
|
||||||
|
alias gp='git push'
|
||||||
|
alias gst='git status'
|
||||||
|
alias glg='git log --graph --oneline --decorate --all'
|
||||||
|
alias gm='git merge'
|
||||||
|
alias grb='git rebase'
|
||||||
|
alias grs='git reset'
|
||||||
|
alias grv='git remote -v'
|
||||||
|
alias tree='tree -I node_modules'
|
||||||
|
|
||||||
16
config/shared/zsh/zsh_config/keybindings
Normal file
16
config/shared/zsh/zsh_config/keybindings
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# -----------------------------
|
||||||
|
# ZLE functions
|
||||||
|
# -----------------------------
|
||||||
|
autoload -U up-line-or-beginning-search
|
||||||
|
autoload -U down-line-or-beginning-search
|
||||||
|
zle -N up-line-or-beginning-search
|
||||||
|
zle -N down-line-or-beginning-search
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Bind keys for history search
|
||||||
|
# -----------------------------
|
||||||
|
bindkey '^[[A' up-line-or-beginning-search
|
||||||
|
bindkey '^[OA' up-line-or-beginning-search
|
||||||
|
bindkey '^[[B' down-line-or-beginning-search
|
||||||
|
bindkey '^[OB' down-line-or-beginning-search
|
||||||
|
|
||||||
15
config/shared/zsh/zsh_config/prompt
Normal file
15
config/shared/zsh/zsh_config/prompt
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# -----------------------------
|
||||||
|
# Git prompt function
|
||||||
|
# -----------------------------
|
||||||
|
git_prompt_info() {
|
||||||
|
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||||
|
local branch=$(git symbolic-ref --short HEAD 2>/dev/null || git rev-parse --short HEAD)
|
||||||
|
echo " %F{green}($branch)%f"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Set prompt
|
||||||
|
# -----------------------------
|
||||||
|
PROMPT='%n@%m%f %F{blue}%~%f$(git_prompt_info) $ '
|
||||||
|
|
||||||
48
config/shared/zsh/zsh_config/zshrc
Normal file
48
config/shared/zsh/zsh_config/zshrc
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
# -----------------------------
|
||||||
|
# PATH
|
||||||
|
# -----------------------------
|
||||||
|
export PATH="$PATH:$HOME/bin"
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Locales
|
||||||
|
# -----------------------------
|
||||||
|
export LANGUAGE="en_US:en"
|
||||||
|
export LANG=en_US.UTF-8
|
||||||
|
export LC_ALL=en_US.UTF-8
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Autocomplete
|
||||||
|
# -----------------------------
|
||||||
|
autoload -Uz compinit && compinit
|
||||||
|
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # Case insensitive
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Shell options
|
||||||
|
# -----------------------------
|
||||||
|
setopt autocd
|
||||||
|
setopt share_history
|
||||||
|
setopt interactivecomments
|
||||||
|
setopt PROMPT_SUBST # Enable dynamic prompt expansion
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Disable conflicting builtins
|
||||||
|
# -----------------------------
|
||||||
|
disable log
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# History
|
||||||
|
# -----------------------------
|
||||||
|
HISTFILE=${ZDOTDIR:-$HOME}/.zsh_history
|
||||||
|
HISTSIZE=2000
|
||||||
|
SAVEHIST=1000
|
||||||
|
setopt HIST_IGNORE_ALL_DUPS
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Source modular components
|
||||||
|
# -----------------------------
|
||||||
|
CONFIG_DIR="$HOME/.config/zsh"
|
||||||
|
|
||||||
|
[ -f "$CONFIG_DIR/aliases" ] && source "$CONFIG_DIR/aliases"
|
||||||
|
[ -f "$CONFIG_DIR/prompt" ] && source "$CONFIG_DIR/prompt"
|
||||||
|
[ -f "$CONFIG_DIR/keybindings" ] && source "$CONFIG_DIR/keybindings"
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user