From 74ed2de10ee90a3cad1c3fca351668b34850828f Mon Sep 17 00:00:00 2001 From: omagdy Date: Sun, 24 Nov 2024 02:53:21 +0200 Subject: Moved to a more minimal zsh config and ditched oh-my-zsh --- zsh/.zshrc | 173 ++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 103 insertions(+), 70 deletions(-) (limited to 'zsh') diff --git a/zsh/.zshrc b/zsh/.zshrc index 449ee05..970c2eb 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -1,57 +1,74 @@ -export CPLUS_INCLUDE_PATH="$HOME/programming/cppDev/imgui/imgui/backends:$HOME/programming/cppDev/imgui-sfml:$HOME/programming/cppDev/imgui/imgui/:$HOME/programming/problem_solving/algo/" -# export C_INCLUDE_PATH="/usr/lib/gcc/arm-none-eabi/13.2.0/include/:$HOME/programming/thirdparties/tiva-c/:$HOME/programming/thirdparties/tiva-c/third_party/FreeRTOS/Source/include/:$HOME/programming/thirdparties/tiva-c/boards/ek-tm4c123gxl/freertos_demo/:" -# export C_INCLUDE_PATH="/usr/lib/gcc/arm-none-eabi/13.2.0/include/:$HOME/programming/thirdparties/tiva-c/" -export ZSH="/home/$USER/.oh-my-zsh" -export PATH="$PATH:/usr/bin/docker:/usr/local/arm-cross-compiler/install/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin" -export PATH="$PATH":"$HOME/.pub-cache/bin" -export PATH="$PATH:/opt/usr/bin/" -export PATH="$PATH:$HOME/.scripts/" +### Added by Zinit's installer +if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then + print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f" + command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit" + command git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" && \ + print -P "%F{33} %F{34}Installation successful.%f%b" || \ + print -P "%F{160} The clone has failed.%f%b" +fi + +source "$HOME/.local/share/zinit/zinit.git/zinit.zsh" +autoload -Uz _zinit +(( ${+_comps} )) && _comps[zinit]=_zinit + +# Load a few important annexes, without Turbo +# (this is currently required for annexes) +zinit light-mode for \ + zdharma-continuum/zinit-annex-as-monitor \ + zdharma-continuum/zinit-annex-bin-gem-node \ + zdharma-continuum/zinit-annex-patch-dl \ + zdharma-continuum/zinit-annex-rust + +### End of Zinit's installer chunk +ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git" + +# Download Zinit, if it's not there yet +if [ ! -d "$ZINIT_HOME" ]; then + mkdir -p "$(dirname $ZINIT_HOME)" + git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" +fi +# Source/Load zinit +source "${ZINIT_HOME}/zinit.zsh" # Starship prompt eval "$(starship init zsh)" - -# Uncomment the following line to use case-sensitive completion. -CASE_SENSITIVE="true" - -# Uncomment the following line if pasting URLs and other text is messed up. -DISABLE_MAGIC_FUNCTIONS=true - # Use bat as the default manpager export MANPAGER='nvim +Man!' # export MANPAGER="sh -c 'col -bx | bat -l man -p'" -# export MANPAGER="bat -l man" -# export MANPAGER="nvim -c 'set ft=man' -" -# export MANPAGER="most" - -# Uncomment the following line to disable auto-setting terminal title. -DISABLE_AUTO_TITLE="true" -# Uncomment the following line to display red dots whilst waiting for completion. -COMPLETION_WAITING_DOTS="true" - -plugins=(copyfile copypath web-search zsh-autosuggestions vi-mode git z colorize zsh-syntax-highlighting) - -# (cat ~/.cache/wal/sequences &) +# Pager +export PAGER='less' -source $ZSH/oh-my-zsh.sh +# start zoxide +eval "$(zoxide init zsh)" +#share commands between terminal instances or not -#### ARCOLINUX SETTINGS #### -export PAGER='less' +# Uncomment the following line to display red dots whilst waiting for completion. +COMPLETION_WAITING_DOTS="true" +# Add in zsh plugins +zinit light zsh-users/zsh-syntax-highlighting +zinit light zsh-users/zsh-completions +zinit light zsh-users/zsh-autosuggestions +zinit light Aloxaf/fzf-tab -setopt GLOB_DOTS -#share commands between terminal instances or not -setopt SHARE_HISTORY +# Add in snippets +zinit snippet OMZL::git.zsh +zinit snippet OMZP::git +zinit snippet OMZP::sudo +zinit snippet OMZP::archlinux +zinit snippet OMZP::aws +zinit snippet OMZP::kubectl +zinit snippet OMZP::kubectx +zinit snippet OMZP::command-not-found -# If not running interactively, don't do anything -[[ $- != *i* ]] && return +# Load completions +autoload -Uz compinit && compinit -export HISTCONTROL=ignoreboth:erasedups -export EDITOR='nvim' -export VISUAL='neovide' +zinit cdreplay -q if [ -d "$HOME/.bin" ] ; then PATH="$HOME/.bin:$PATH" @@ -61,23 +78,60 @@ if [ -d "$HOME/.local/bin" ] ; then PATH="$HOME/.local/bin:$PATH" fi -### ALIASES ### +# Aliases if [ -d "$HOME/.aliases" ] ; then source ~/.aliases/aliases fi +# Keybindings +bindkey -e +bindkey '^p' history-search-backward +bindkey '^n' history-search-forward +bindkey '^k' up-line-or-beginning-search +bindkey '^j' down-line-or-beginning-search +bindkey '^o' clear-screen + +# exports +export EDITOR='nvim' +export VISUAL='neovide' -# vsed = mix of vim and sed to interactively find and replaced in files -vsed() { - search=$1 - replace=$2 - shift - shift - vim -c "bufdo! set eventignore-=Syntax|%s/$search/$replace/gce" **/*.$3 -} +# History +HISTSIZE=5000 +HISTFILE=~/.zsh_history +SAVEHIST=$HISTSIZE +HISTDUP=erase +setopt glob_dots +setopt appendhistory +setopt sharehistory +setopt hist_ignore_space +setopt hist_ignore_all_dups +setopt hist_save_no_dups +setopt hist_ignore_dups +setopt hist_find_no_dups + +# Completion styling +zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' +zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" +zstyle ':completion:*' menu no +zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath' +zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'ls --color $realpath' + +# Shell integrations +eval "$(fzf --zsh)" + +# PATH +# export C_INCLUDE_PATH="/usr/lib/gcc/arm-none-eabi/13.2.0/include/:$HOME/programming/thirdparties/tiva-c/:$HOME/programming/thirdparties/tiva-c/third_party/FreeRTOS/Source/include/:$HOME/programming/thirdparties/tiva-c/boards/ek-tm4c123gxl/freertos_demo/:" +# export C_INCLUDE_PATH="/usr/lib/gcc/arm-none-eabi/13.2.0/include/:$HOME/programming/thirdparties/tiva-c/" +export CPLUS_INCLUDE_PATH="$HOME/programming/cppDev/imgui/imgui/backends:$HOME/programming/cppDev/imgui-sfml:$HOME/programming/cppDev/imgui/imgui/:$HOME/programming/problem_solving/algo/" +export PATH="$PATH:/usr/bin/docker:/usr/local/arm-cross-compiler/install/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin" +export PATH="$PATH":"$HOME/.pub-cache/bin" +export PATH="$PATH:/opt/usr/bin/" +export PATH="$PATH:$HOME/.scripts/" +export PATH="$PATH:/home/omar/.cache/lm-studio/bin" +# Useful functions -# # ex = EXtractor for all kinds of archives +# ex = EXtractor for all kinds of archives ex () { if [ -f $1 ] ; then @@ -104,11 +158,7 @@ ex () } -copyfile() { - cat "$@" | xclip -sel clipboard -} - -## interactivley cd ## +# Interactive cd fcd() { local dir dir=$(find ~ -type d | fzf) @@ -116,20 +166,3 @@ fcd() { cd "$dir" fi } - -fo() { - local dir - dir=$(find /run/media/omar/Storage/omar/College -type d | fzf) - if [[ -n $dir ]]; then - cd "$dir" - fi -} - -bindkey '^k' up-line-or-beginning-search -bindkey '^j' down-line-or-beginning-search -bindkey '^o' clear-screen - -# colorscript random - -# Added by LM Studio CLI (lms) -export PATH="$PATH:/home/omar/.cache/lm-studio/bin" -- cgit v1.2.3