diff --git a/.zimrc b/.zimrc new file mode 100644 index 0000000..5d59cbf --- /dev/null +++ b/.zimrc @@ -0,0 +1,59 @@ +# Start configuration added by Zim install {{{ +# +# This is not sourced during shell startup, and it's only used to configure the +# zimfw plugin manager. +# + +# +# 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 + +# +# Completion +# + +# Additional completion definitions for Zsh. +zmodule zsh-users/zsh-completions --fpath src +# Enables and configures smart and extensive tab completion. +# completion must be sourced after all modules that add completion definitions. +zmodule completion + +# +# Modules that must be initialized last +# + +# 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 +# Fish-like autosuggestions for Zsh. +zmodule zsh-users/zsh-autosuggestions +# }}} End configuration added by Zim install + +zmodule agkozak/zsh-z +zmodule MichaelAquilina/zsh-you-should-use +zmodule hlissner/zsh-autopair diff --git a/.zshrc b/.zshrc index f5b8c07..571521a 100644 --- a/.zshrc +++ b/.zshrc @@ -1,81 +1,137 @@ -# Path to oh-my-zsh installation. -export ZSH=$HOME/.oh-my-zsh -export PATH=/usr/local/bin:$PATH +skip_global_compinit=1 +# Start configuration added by Zim install {{{ +# +# User configuration sourced by interactive shells +# -#ZSH_THEME="robbyrussell" +# ----------------- +# Zsh configuration +# ----------------- -# red dots to be displayed while waiting for completion -COMPLETION_WAITING_DOTS="true" +# +# History +# -plugins=( - git - node - npm - macos - extract - z - zsh-autosuggestions - zsh-syntax-highlighting -) +# Remove older command from the history if a duplicate is to be added. +setopt HIST_IGNORE_ALL_DUPS -if type brew &>/dev/null; then - FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH -fi +# +# Input/output +# -source $ZSH/oh-my-zsh.sh +# Set editor default keymap to emacs (`-e`) or vi (`-v`) +bindkey -e -# Useful aliases -alias rm=trash -alias zshconfig="vim ~/.zshrc" -alias ohmyzsh="vim ~/.oh-my-zsh" -alias vimconfig="vim ~/.vimrc" -alias update="source ~/.zshrc" -alias code="codium" +# Prompt for spelling correction of commands. +#setopt CORRECT -# Git -alias branch="git branch" -alias gco="git checkout" -alias status="git status" +# Customize spelling correction prompt. +#SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? ' -# Docker -alias dcp='docker-compose -f /opt/docker-compose.yml ' -alias dcpull='docker-compose -f /opt/docker-compose.yml pull --parallel' -alias dclogs='docker-compose -f /opt/docker-compose.yml logs -tf --tail="50" ' -alias dtail='docker logs -tf --tail="50" "$@"' +# Remove path separator from WORDCHARS. +WORDCHARS=${WORDCHARS//[\/]} -# SDK Man -# OSX SDK Man -# export SDKMAN_DIR=$HOME/.sdkman -# [[ -s "/Users/{USER_NAME}/.sdkman/bin/sdkman-init.sh"]] && source "/Users/{USER_NAME}/.sdkman/bin/sdkman-init.sh" -# export PATH="/usr/local/sbin:$PATH" -# export PATH="/usr/local/bin:$PATH" +# ----------------- +# Zim configuration +# ----------------- -export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" -[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +# Use degit instead of git as the default tool to install and update modules. +#zstyle ':zim:zmodule' use 'degit' -# place this after nvm initialization! -autoload -U add-zsh-hook -load-nvmrc() { - local node_version="$(nvm version)" - local nvmrc_path="$(nvm_find_nvmrc)" +# -------------------- +# Module configuration +# -------------------- - if [ -n "$nvmrc_path" ]; then - local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")") +# +# git +# - if [ "$nvmrc_node_version" = "N/A" ]; then - nvm install - elif [ "$nvmrc_node_version" != "$node_version" ]; then - nvm use - fi - elif [ "$node_version" != "$(nvm version default)" ]; then - echo "Reverting to nvm default version" - nvm use default +# 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 -} -add-zsh-hook chpwd load-nvmrc -load-nvmrc -# pnpm -export PNPM_HOME="/home/bshellnu/.local/share/pnpm" -export PATH="$PNPM_HOME:$PATH" -# pnpm end -eval "$(starship init zsh)" +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 + + +#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!! +export SDKMAN_DIR="$HOME/.sdkman" +[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh" + +eval "$(starship init zsh)" \ No newline at end of file diff --git a/starship.toml b/starship.toml new file mode 100644 index 0000000..e69de29