Skip to content

Instantly share code, notes, and snippets.

@HelloWorld017
Last active December 27, 2021 04:37
Show Gist options
  • Save HelloWorld017/8f5011b7127d73096e680ab75c41908d to your computer and use it in GitHub Desktop.
Save HelloWorld017/8f5011b7127d73096e680ab75c41908d to your computer and use it in GitHub Desktop.
nenw's zsh setting
# Select the lightweight editor for your OS
# Mac: alias npp='/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl'
# Linux: alias npp='gapplication launch org.gnome.gedit'
# Windows: alias npp='C:\Windows\Program Files (x86)\Notepad++\Notepad++.exe'
# Select the file manager for your OS
# Mac: alias e.='open .'
# Linux: alias e.='xdg-open .'
# Windows: alias e.='explorer .'
alias aliasedit='npp ~/.zsh_aliases'
alias gl='if git config --get alias.l > /dev/null; then git l; else git log --oneline --all --graph --decorate; fi'
alias glc='git log --oneline'
alias ls='ls -F'
alias ll='exa -alFh'
alias cls='clear'
alias cat='bat'
alias fzf='fzf --bind "enter:execute(bat --paging=always {})" --preview "bat --style=numbers --color=always {}"'
alias dpsa='docker ps -a'
alias dcup='docker-compose up'
alias dcupd='docker-compose up -d'
alias dclf='docker-compose logs -f'
alias dclft='docker-compose logs -f --tail=100'
alias dcdown='docker-compose down'
alias fxxk='fuck'
# macOS Specific Commands
# =====
# alias unsafe-chrome='open -n -a /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --args --user-data-dir="/tmp/chrome_dev_test" --disable-web-security'
# Set history
[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
HISTSIZE=1000000
SAVEHIST=$HISTSIZE
COMPLETION_WAITING_DOTS="true"
setopt extended_history # record timestamp of command in HISTFILE
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space
# setopt hist_verify # show command with history expansion to user before running it
setopt inc_append_history # add commands to HISTFILE in order of execution
setopt share_history # share command history data
# Fix home key
bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line
bindkey "^[[3~" delete-char
# Add aliases
source "$HOME/.zsh_aliases"
# Start zinit
if [[ ! -f $HOME/.zinit/bin/zinit.zsh ]]; then
print -P "%F{33}▓▒░ %F{220}Installing %F{33}DHARMA%F{220} Initiative Plugin Manager (%F{33}zdharma/zinit%F{220})…%f"
command mkdir -p "$HOME/.zinit" && command chmod g-rwX "$HOME/.zinit"
command git clone https://github.com/zdharma/zinit "$HOME/.zinit/bin" && \
print -P "%F{33}▓▒░ %F{34}Installation successful.%f%b" || \
print -P "%F{160}▓▒░ The clone has failed.%f%b"
fi
source "$HOME/.zinit/bin/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
# Prompts
zinit light HelloWorld017/agkozak-nenwflavoured
zinit light agkozak/agkozak-zsh-prompt
# Plugins
# > Autocompletion, Suggestions, Syntax Highlight
zinit wait lucid light-mode for \
atinit"ZINIT[COMPINIT_OPTS]=-C; zicompinit; zicdreplay" \
zdharma/fast-syntax-highlighting \
blockf \
zsh-users/zsh-completions \
atload"!_zsh_autosuggest_start" \
zsh-users/zsh-autosuggestions
# > History Search
zinit wait lucid light-mode for \
zdharma/history-search-multi-word
# > Docker Compose (for Mac)
zinit lucid light-mode for \
as"completion" is-snippet id-as"docker-completions/docker" \
"https://github.com/docker/cli/blob/master/contrib/completion/zsh/_docker" \
as"completion" is-snippet id-as"docker-completions/docker-compose" \
"https://github.com/docker/compose/blob/master/contrib/completion/zsh/_docker-compose"
# Editor
export EDITOR="vim"
# Fuzzy Finder
export FZF_DEFAULT_COMMAND='fd --type f'
# The Fuck
eval $(thefuck --alias)
;= @echo off
;= rem An aliases files for Windows Environment (with Cmder)
;= %SystemRoot%\system32\doskey /listsize=1000 /macrofile=%0%
;= goto:eof
gl=git log --oneline --all --graph --decorate $*
ls=ls --show-control-chars -F --color $*
ll=ls -a -l --color $*
pwd=cd $*
clear=cls
history=less +G "%CMDER_ROOT%\config\.history"
historygrep=cat "%CMDER_ROOT%\config\.history" | grep $*
su=cmd /k "%ConEmuDir%\..\init.bat" -new_console:a:.
sudo=sudo cmd /c $*
unalias=alias /d $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment