From cff057083b5b08ac2bdab3682dbea1f5e9a0c0d9 Mon Sep 17 00:00:00 2001 From: tomit4 Date: Sun, 24 Apr 2022 12:29:55 -0700 Subject: [PATCH] finished out zsh configuration --- bashrc.txt | 12 ++++--- updates.txt | 14 +++----- zsh/zsh-autocomplete | 1 + zsh/zsh-autosuggestions | 1 + zsh/zsh-syntax-highlighting | 1 + zshrc.txt | 66 +++++++++++++++++++++++++++++++++++-- 6 files changed, 78 insertions(+), 17 deletions(-) create mode 160000 zsh/zsh-autocomplete create mode 160000 zsh/zsh-autosuggestions create mode 160000 zsh/zsh-syntax-highlighting diff --git a/bashrc.txt b/bashrc.txt index 19a9870d..408b6912 100644 --- a/bashrc.txt +++ b/bashrc.txt @@ -1,12 +1,9 @@ +# Changing over to ZSH for now, bashrc is kept here as emergency shell/posterity +# to change default shell, use chsh -s $(which bash) # ~/.bashrc # history -c && history -w && hash -r -if [ $TERM == "xterm-256color" ] ; then - http_proxy=http://127.0.0.1:8118/ - HTTP_PROXY=$http_proxy - export http_proxy HTTP_PROXY -fi # create custom env variables: export cproj="/home/brian/Documents/Code/forks/" # custom BROWSER env for ddgr: @@ -323,6 +320,11 @@ alias npm_list="npm list -g --depth=0" alias pip_upgrade="python -m pip install --upgrade pip" # pip list and pip freeze command list pip packages +# get top process eating memory +alias psmem="ps auxf | sort -nr -k 4 | head -5" +# get top process eating cpu +alias pscpu="ps auxf | sort -nr -k 3 | head -5" + # game shortcuts alias {cbpunk,cyberpunk}="steam steam://rungameid/1091500 &" alias {twd,thewalkingdead}="steam steam://rungameid/1449690 &" diff --git a/updates.txt b/updates.txt index 39f404f9..84255194 100644 --- a/updates.txt +++ b/updates.txt @@ -13,16 +13,12 @@ find $dir -maxdepth 1 -type f Install zsh-completions-git -in the aur_packages directory: +in your home directory: -git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git +git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git ~/.zsh/zsh-autocomplete -source ~/aur_packages/zsh-autocomplete/zsh-autocomplete.plugin.zsh-completions-git +Inside your .zsh file, you should already have called this plugin: -Make sure to comment out any references to compinit (but keep it around in case this fails) +source ~/.zsh/zsh-autocomplete/zsh-autocomplete.plugin.zsh-completions-git -Then in your .zshrc file, place: - - -at 9:06 -https://www.youtube.com/watch?v=bTLYiNvRIVI +The rest can be sourced from your files here in zsh directory, just cp it into your ~/.zsh directory diff --git a/zsh/zsh-autocomplete b/zsh/zsh-autocomplete new file mode 160000 index 00000000..d6a0ff57 --- /dev/null +++ b/zsh/zsh-autocomplete @@ -0,0 +1 @@ +Subproject commit d6a0ff574679280af52258ee6d2dcd3857283270 diff --git a/zsh/zsh-autosuggestions b/zsh/zsh-autosuggestions new file mode 160000 index 00000000..a411ef3e --- /dev/null +++ b/zsh/zsh-autosuggestions @@ -0,0 +1 @@ +Subproject commit a411ef3e0992d4839f0732ebeb9823024afaaaa8 diff --git a/zsh/zsh-syntax-highlighting b/zsh/zsh-syntax-highlighting new file mode 160000 index 00000000..c5ce0014 --- /dev/null +++ b/zsh/zsh-syntax-highlighting @@ -0,0 +1 @@ +Subproject commit c5ce0014677a0f69a10b676b6038ad127f40c6b1 diff --git a/zshrc.txt b/zshrc.txt index 90115eb8..01cf3b3e 100644 --- a/zshrc.txt +++ b/zshrc.txt @@ -1,8 +1,29 @@ +# ~/.zshrc +# +# to change default shell, use chsh -s $(which zsh) +# +# create custom env variables: +export cproj="/home/brian/Documents/Code/forks/" +# custom BROWSER env for ddgr: +export BROWSER=links +export TUIR_BROWSER=librewolf +export EDITOR=nvim + +# Enable fuzzy file finder [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh -# PROMPT='%B%F{blue}[%n@%M %B%F{white}'%1~'%B%F{blue}]$ %B%F{white}%B%F{blue} -# └─▶%B%F{white} ' +# Don't show completion until at least 1 character has been typed +zstyle ':autocomplete:*' min-input 1 + +# autoload -U compinit; compinit # +# Plugins +source ~/.zsh/zsh-autocomplete/zsh-autocomplete.plugin.zsh +source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh + +# Colors +autoload -Uz colors && colors + # Load version control information autoload -Uz vcs_info precmd() { vcs_info } @@ -13,10 +34,25 @@ zstyle ':vcs_info:git:*' formats '%b' # Set up the prompt (with git branch name) setopt PROMPT_SUBST +# some useful options (man zshoptions) +setopt autocd extendedglob nomatch menucomplete +setopt interactive_comments +stty stop undef # Disable ctrl-s to freeze terminal +zle_highlight=('paste:none') # pasting text using ctrl+shift+v doesn't highlight + +# beeping is annoying +unsetopt BEEP + # PROMPT='[%n@%m %1~]%F{green}(${vcs_info_msg_0_})%F{white}$ ' PROMPT='%B%F{blue}[%n@%M %B%F{white}'%1~'%B%F{blue}]$ %B%F{white}${vcs_info_msg_0_}%B%F{blue} └─▶%B%F{white} ' +function erase_history { local HISTSIZE=0; } +erase_history && hash -r + +# Set up vim mode +bindkey -v + #Custom Aliases alias ls='ls --color=auto' alias grep='grep --colour=auto' @@ -28,7 +64,7 @@ alias free='free -m' alias dmesg="doas dmesg -H" alias kernel="uname -r" alias .="cd" -alias home="xclear && cd /home/brian && clear && history -c && history -w && hash -r" +alias home="xclear && cd /home/brian && clear && erase_history && hash -r" alias docs="cd ~/Documents" alias down="cd ~/Downloads" alias pics="cd ~/Pictures" @@ -179,6 +215,11 @@ alias npm_list="npm list -g --depth=0" alias pip_upgrade="python -m pip install --upgrade pip" # pip list and pip freeze command list pip packages +# get top process eating memory +alias psmem="ps auxf | sort -nr -k 4 | head -5" +# get top process eating cpu +alias pscpu="ps auxf | sort -nr -k 3 | head -5" + # game shortcuts alias {cbpunk,cyberpunk}="steam steam://rungameid/1091500 &" alias {twd,thewalkingdead}="steam steam://rungameid/1449690 &" @@ -227,3 +268,22 @@ alias yt='ddgr --gb \!yt "${1}"' alias {grub_update,update_grub}="doas grub-mkconfig -o /boot/grub/grub.cfg" alias regen_initramfs="doas mkinitcpio -P" +# DEPRECATED aliases (noted here for posterity): + +# pjson is now easily replaced by package jq +# alias pjson="json_pp | pygmentize -l json" # pipe expected json output through pjson to prettify it +# alias {bmux,mymux,memux,mmux}="tmux new-session \; send-keys 'nvim' C-m\; split-window -v -p 3\; split-window -h -p 50\; select-pane -t 0\;" +# alias tls="tmux ls" +# alias ta="tmux a -t" +# alias tkill="tmux kill-ses -t" + +# Kitty Shell Integration +# if test -n "$KITTY_INSTALLATION_DIR"; then + # export KITTY_SHELL_INTEGRATION="enabled" + # autoload -Uz -- "$KITTY_INSTALLATION_DIR"/shell-integration/zsh/kitty-integration + # kitty-integration + # unfunction kitty-integration +# fi + +# Plugins (that need to be at the end of the zshrc script) +source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh