Created
October 14, 2024 15:25
-
-
Save makampf/334150fd2b678e53e43e99758183e12a to your computer and use it in GitHub Desktop.
.zshrc
This file contains hidden or 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
| # zinit | |
| # set the directory we want to store zinit and plugins | |
| ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git" | |
| # if it does not exist, create and clone it | |
| [ ! -d $ZINIT_HOME ] && mkdir -p "$(dirname $ZINIT_HOME)" | |
| [ ! -d $ZINIT_HOME/.git ] && git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" | |
| # load zinit (check with `zinit zstatus`) | |
| source "${ZINIT_HOME}/zinit.zsh" | |
| # zinit plugins | |
| zinit light zsh-users/zsh-syntax-highlighting # green for correct command | |
| zinit light zsh-users/zsh-completions # for extended completions | |
| zinit light zsh-users/zsh-autosuggestions # suggest from history | |
| zinit light Aloxaf/fzf-tab # interactive fzf menu for tab completion | |
| # zinit snippets | |
| zinit snippet OMZP::history # good history options | |
| zinit snippet OMZP::command-not-found # recommends installs when cmd fails | |
| zinit snippet OMZP::git # aliases for git | |
| # after plugins are loaded, run this according to doc | |
| autoload -Uz compinit | |
| compinit | |
| zinit cdreplay -q | |
| # key bindings | |
| bindkey '^ ' autosuggest-accept # accept autosuggestion with ctrl+space | |
| bindkey '^p' history-search-backward # search backward history with matching beginning | |
| bindkey '^n' history-search-forward # same for forward search | |
| # completion styling | |
| zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' # autocomplete case-insensitive | |
| zstyle ':completion:*' menu no # disable zsh menu for tab completion for fzf-tab menu | |
| zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath' | |
| zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'eza -1 --color=always $realpath' | |
| # shortcuts | |
| alias zshconf="nvim ~/.zshrc" | |
| alias vim="nvim" | |
| export EDITOR='nvim' | |
| alias cdgit="cd ~/git/" | |
| alias cdicloud="cd ~/Library/Mobile\ Documents/com\~apple\~CloudDocs/" | |
| # eza (better ls) | |
| alias l="eza --icons=auto" | |
| alias ls="eza --icons=auto" | |
| alias ll="eza -l --git" | |
| alias la="eza -al --git" | |
| # bat (better cat) | |
| alias cat='bat' | |
| # zoxide (better cd) | |
| eval "$(zoxide init --cmd cd zsh)" | |
| # fuzzy search | |
| eval "$(fzf --zsh)" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment