commit bee9d34167a2c09db2168fa23f79cc3ff5c22b1b Author: Gbanyan Date: Thu Feb 2 00:38:02 2023 +0800 First upload diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9735178 --- /dev/null +++ b/.gitignore @@ -0,0 +1,36 @@ +# Created by https://www.toptal.com/developers/gitignore/api/macos +# Edit at https://www.toptal.com/developers/gitignore?templates=macos + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### macOS Patch ### +# iCloud generated files +*.icloud + +# End of https://www.toptal.com/developers/gitignore/api/macos diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..945ff62 --- /dev/null +++ b/readme.md @@ -0,0 +1,36 @@ +# Gbanyan's zsh confirguration + +This is my zsh conf file in Linux machine. Besides the standard zsh auto suggestion, syntax-highlighting, the module configured in zimrc also offer the fast path switch and other convenient function. + +The theme is powerlevel10k, after configuration the zsh will prompt to ask some configuration like font and specical symbols. + +## Environment + +1. zsh +2. [zim](https://github.com/zimfw/zimfw) +3. Linux + +macOS version will be upload later + +## Installation + +1. Install zsh and switch to zsh in Linux + + ```bash + chsh -s $(which zsh) + ``` + +2. Download and install zim (follow the zimfw official guide). Do not put any pre-configured zshrc or zimrc file in home folder + + ```bash + curl -fsSL https://raw.githubusercontent.com/zimfw/install/master/install.zsh | zsh + ``` + +3. Delete original zimrc and zimfw file, copy or link file in this repo + +4. After replacing original file, run `zimfw updatesour` + +## Others + +My often used toolkit includes anaconda. However, `conda` command won't be loaded in zshrc automatically. You need to add by yourself. + diff --git a/zimrc b/zimrc new file mode 100644 index 0000000..11a8fdb --- /dev/null +++ b/zimrc @@ -0,0 +1,53 @@ +# Start configuration added by Zim install {{{ +# ------- +# Modules +# ------- + +# Sets sane Zsh built-in environment options. +zmodule environment +# Provides handy git aliases and functions. +zmodule git +# Applies correct bindkeys for input events. +zmodule input +# Sets a custom terminal title. +zmodule termtitle +# Utility aliases and functions. Adds colour to ls, grep and less. +zmodule utility + +# +# Prompt +# +# Exposes to prompts how long the last command took to execute, used by asciiship. +zmodule duration-info +# Exposes git repository status information to prompts, used by asciiship. +zmodule git-info +# A heavily reduced, ASCII-only version of the Spaceship and Starship prompts. +zmodule asciiship + +# Additional completion definitions for Zsh. +zmodule zsh-users/zsh-completions +# Enables and configures smart and extensive tab completion. +# completion must be sourced after zsh-users/zsh-completions +zmodule completion +# Fish-like autosuggestions for Zsh. +zmodule zsh-users/zsh-autosuggestions +# Fish-like syntax highlighting for Zsh. +# zsh-users/zsh-syntax-highlighting must be sourced after completion +zmodule zsh-users/zsh-syntax-highlighting +# Fish-like history search (up arrow) for Zsh. +# zsh-users/zsh-history-substring-search must be sourced after zsh-users/zsh-syntax-highlighting +zmodule zsh-users/zsh-history-substring-search + +# Gbanyan Customized settings +zmodule archive +zmodule exa +zmodule fzf +zmodule pvenv +zmodule ssh +zmodule prompt-pwd +zmodule homebrew +zmodule romkatv/powerlevel10k --use degit +zmodule rupa/z +zmodule greymd/docker-zsh-completion +zmodule djui/alias-tips +# }}} End configuration added by Zim install diff --git a/zshrc b/zshrc new file mode 100644 index 0000000..8a6ad08 --- /dev/null +++ b/zshrc @@ -0,0 +1,146 @@ +# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. +# Initialization code that may require console input (password prompts, [y/n] +# confirmations, etc.) must go above this block; everything else may go below. +if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then + source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" +fi + +# Start configuration added by Zim install {{{ +# +# User configuration sourced by interactive shells +# + +# ----------------- +# Zsh configuration +# ----------------- + +# +# History +# + +# Remove older command from the history if a duplicate is to be added. +setopt HIST_IGNORE_ALL_DUPS + +# +# Input/output +# + +# Set editor default keymap to emacs (`-e`) or vi (`-v`) +bindkey -e + +# Prompt for spelling correction of commands. +#setopt CORRECT + +# Customize spelling correction prompt. +#SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' + +# Remove path separator from WORDCHARS. +WORDCHARS=${WORDCHARS//[\/]} + +# ----------------- +# Zim configuration +# ----------------- + +# Use degit instead of git as the default tool to install and update modules. +#zstyle ':zim:zmodule' use 'degit' + +# -------------------- +# Module configuration +# -------------------- + +# +# git +# + +# Set a custom prefix for the generated aliases. The default prefix is 'G'. +#zstyle ':zim:git' aliases-prefix 'g' + +# +# input +# + +# Append `../` to your input for each `.` you type after an initial `..` +#zstyle ':zim:input' double-dot-expand yes + +# +# termtitle +# + +# Set a custom terminal title format using prompt expansion escape sequences. +# See http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Simple-Prompt-Escapes +# If none is provided, the default '%n@%m: %~' is used. +#zstyle ':zim:termtitle' format '%1~' + +# +# zsh-autosuggestions +# + +# Disable automatic widget re-binding on each precmd. This can be set when +# zsh-users/zsh-autosuggestions is the last module in your ~/.zimrc. +ZSH_AUTOSUGGEST_MANUAL_REBIND=1 + +# Customize the style that the suggestions are shown with. +# See https://github.com/zsh-users/zsh-autosuggestions/blob/master/README.md#suggestion-highlight-style +#ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=242' + +# +# zsh-syntax-highlighting +# + +# Set what highlighters will be used. +# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md +ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets) + +# Customize the main highlighter styles. +# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/main.md#how-to-tweak-it +#typeset -A ZSH_HIGHLIGHT_STYLES +#ZSH_HIGHLIGHT_STYLES[comment]='fg=242' + +# ------------------ +# Initialize modules +# ------------------ + +ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim +# Download zimfw plugin manager if missing. +if [[ ! -e ${ZIM_HOME}/zimfw.zsh ]]; then + if (( ${+commands[curl]} )); then + curl -fsSL --create-dirs -o ${ZIM_HOME}/zimfw.zsh \ + https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh + else + mkdir -p ${ZIM_HOME} && wget -nv -O ${ZIM_HOME}/zimfw.zsh \ + https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh + fi +fi +# Install missing modules, and update ${ZIM_HOME}/init.zsh if missing or outdated. +if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZDOTDIR:-${HOME}}/.zimrc ]]; then + source ${ZIM_HOME}/zimfw.zsh init -q +fi +# Initialize modules. +source ${ZIM_HOME}/init.zsh + +# ------------------------------ +# Post-init module configuration +# ------------------------------ + +# +# zsh-history-substring-search +# + +zmodload -F zsh/terminfo +p:terminfo +# Bind ^[[A/^[[B manually so up/down works both before and after zle-line-init +for key ('^[[A' '^P' ${terminfo[kcuu1]}) bindkey ${key} history-substring-search-up +for key ('^[[B' '^N' ${terminfo[kcud1]}) bindkey ${key} history-substring-search-down +for key ('k') bindkey -M vicmd ${key} history-substring-search-up +for key ('j') bindkey -M vicmd ${key} history-substring-search-down +unset key +# }}} End configuration added by Zim install + +# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. +[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh + +## User configuration +DEFAULT_USER="gbanyan" + +## Export settings + +## Alias settings