initial trial of zinit

This commit is contained in:
Stefen Auris 2021-05-26 03:58:23 -04:00
parent dc8ca8781d
commit 3435255268
5 changed files with 325 additions and 34 deletions

11
init.sh
View file

@ -13,9 +13,12 @@ fi
#setup prezto
echo "Select which shell to configure and use: zsh/fish/bash"; read -r answer
if [[ $answer = "zsh" ]] || [[ $answer = "z" ]]; then
echo "Initializing Prezto"
zsh prezto.zsh
chsh -s /bin/zsh
echo "Initializing ZSH"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma/zinit/master/doc/install.sh)"
#This will install Zinit in ~/.zinit/bin. .zshrc will be updated with three lines of code that will be added to the bottom. The lines will be sourcing zinit.zsh and setting up completion for command zinit. After installing and reloading the shell compile Zinit with zinit self-update.
zinit self-update
zinit update
chsh -s /bin/zsh
elif [[ $answer = "fish" ]] || [[ $answer = "f" ]]; then
echo "Installing Oh-My-Fish"
bash fish.sh
@ -29,7 +32,7 @@ mkdir ~/.ssh
echo "Stowing Configs"
stow tmux
stow vim
stow prezto
stow zsh
stow config
chmod 0700 ~/.ssh
chmod -R 0600 ~/.ssh/*

View file

@ -1,21 +0,0 @@
#!/bin/zsh
#Initializes Prezto
git clone --recursive -j 4 https://github.com/steveokard/prezto.git "$HOME/stevset/prezto/.zprezto"
#Remove old stuff
echo "....Creating symlinks"
rm -rf ~/.zshrc ~/.zsh ~/.zprofile ~/.zlogin ~/.zlogout ~/.zpreztorc ~/.zshenv
#Make Environment Links, per github readme
setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/stevset/prezto/.zprezto/runcoms/^README.md(.N); do
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done
#setup theme
echo "remember to run p10k configure to configure the theme!"
ln -s $HOME/.zprezto/modules/prompt/external/powerlevel10k/prompt_powerlevel10k_setup $HOME/.zprezto/modules/prompt/functions/prompt_powerlevel10k_setup
#finally, fix permissions to avoid compaudit flag
chmod -R go-w ~/.zprezto

View file

@ -1,10 +1,4 @@
#!/bin/zsh
echo "Configuring Emoji Fonts"
git clone https://gitlab.com/es20490446e/emoji.conf.git
cd emoji.conf/
./install-uninstall.sh
#regenerate font cache
fc-cache -f -v
#cleanup
cd ..
rm -r emoji.conf
echo "Remove Emacs"
sudo apt autoremove emacs emacs-nox ripgrep markdown shellcheck fd-find
rm -r --interactive=never $HOME/.emacs.d $HOME/.doom.d

278
zsh/.zshrc Normal file
View file

@ -0,0 +1,278 @@
#Original Concept located from https://github.com/crivotz/dot_files/blob/master/linux/zplugin/zshrc
#####################
# FIRST PROMPT LINE #
#####################
rosso='\e[1;34m'
NC='\e[0m'
echo -e "${rosso}Ubuntu${NC}" `lsb_release -sr` "| ${rosso}ZSH${NC} ${ZSH_VERSION}"
#####################
# ZINIT #
#####################
### Added by Zinit's installer
if [[ ! -f $HOME/.zinit/bin/zinit.zsh ]]; then
print -P "%F{33}▓▒░ %F{220}Installing DHARMA Initiative Plugin Manager (zdharma/zinit)…%f"
command mkdir -p $HOME/.zinit
command git clone https://github.com/zdharma/zinit $HOME/.zinit/bin && \
print -P "%F{33}▓▒░ %F{34}Installation successful.%F" || \
print -P "%F{160}▓▒░ The clone has failed.%F"
fi
source "$HOME/.zinit/bin/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
### End of Zinit installer's chunk
#####################
# THEME #
#####################
zinit ice depth=1; zinit light romkatv/powerlevel10k
#####################
# PLUGINS #
#####################
# SSH-AGENT
zinit light bobsoppe/zsh-ssh-agent
# AUTOSUGGESTIONS, TRIGGER PRECMD HOOK UPON LOAD
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
zinit ice wait"0a" lucid atload"_zsh_autosuggest_start"
zinit light zsh-users/zsh-autosuggestions
# ENHANCD
zinit ice wait"0b" lucid
zinit light b4b4r07/enhancd
export ENHANCD_FILTER=fzf:fzy:peco
# HISTORY SUBSTRING SEARCHING
zinit ice wait"0b" lucid atload'bindkey "$terminfo[kcuu1]" history-substring-search-up; bindkey "$terminfo[kcud1]" history-substring-search-down'
zinit light zsh-users/zsh-history-substring-search
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
# TAB COMPLETIONS
zinit ice wait"0b" lucid blockf
zinit light zsh-users/zsh-completions
zstyle ':completion:*' completer _expand _complete _ignored _approximate
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
zstyle ':completion:*' menu select=2
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
zstyle ':completion:*:descriptions' format '-- %d --'
zstyle ':completion:*:processes' command 'ps -au$USER'
zstyle ':completion:complete:*:options' sort false
zstyle ':fzf-tab:complete:_zlua:*' query-string input
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm,cmd -w -w"
zstyle ':fzf-tab:complete:kill:argument-rest' extra-opts --preview=$extract'ps --pid=$in[(w)1] -o cmd --no-headers -w -w' --preview-window=down:3:wrap
zstyle ":completion:*:git-checkout:*" sort false
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
# FZF
zinit ice from"gh-r" as"command"
zinit light junegunn/fzf
# FZF BYNARY AND TMUX HELPER SCRIPT
zinit ice lucid wait'0c' as"command" id-as"junegunn/fzf-tmux" pick"bin/fzf-tmux"
zinit light junegunn/fzf
# BIND MULTIPLE WIDGETS USING FZF
zinit ice lucid wait'0c' multisrc"shell/{completion,key-bindings}.zsh" id-as"junegunn/fzf_completions" pick"/dev/null"
zinit light junegunn/fzf
# FZF-TAB
zinit ice wait"1" lucid
zinit light Aloxaf/fzf-tab
# SYNTAX HIGHLIGHTING
zinit ice wait"0c" lucid atinit"zpcompinit;zpcdreplay"
zinit light zdharma/fast-syntax-highlighting
# NVM
#export NVM_AUTO_USE=true
#zinit ice wait"1" lucid
#zinit light lukechilds/zsh-nvm
# EXA
zinit ice wait"2" lucid from"gh-r" as"program" mv"bin/exa* -> exa"
zinit light ogham/exa
zinit ice wait blockf atpull'zinit creinstall -q .'
# DELTA
zinit ice lucid wait"0" as"program" from"gh-r" pick"delta*/delta"
zinit light 'dandavison/delta'
# BAT
zinit ice from"gh-r" as"program" mv"bat* -> bat" pick"bat/bat" atload"alias cat=bat"
zinit light sharkdp/bat
# BAT-EXTRAS
zinit ice wait"1" as"program" pick"src/batgrep.sh" lucid
zinit ice wait"1" as"program" pick"src/batdiff.sh" lucid
zinit light eth-p/bat-extras
alias rg=batgrep.sh
alias bd=batdiff.sh
alias man=batman.sh
# RIPGREP
zinit ice from"gh-r" as"program" mv"ripgrep* -> ripgrep" pick"ripgrep/rg"
zinit light BurntSushi/ripgrep
# NEOVIM
#zinit ice from"gh-r" as"program" bpick"*appimage*" ver"nightly" mv"nvim* -> nvim" pick"nvim"
#zinit light neovim/neovim
# FORGIT
zinit ice wait lucid
zinit load 'wfxr/forgit'
# LAZYGIT
zinit ice lucid wait"0" as"program" from"gh-r" mv"lazygit* -> lazygit" atload"alias lg='lazygit'"
zinit light 'jesseduffield/lazygit'
# RANGER
zinit ice depth'1' as"program" pick"ranger.py"
zinit light ranger/ranger
# FD
zinit ice as"command" from"gh-r" mv"fd* -> fd" pick"fd/fd"
zinit light sharkdp/fd
# GH-CLI
zinit ice lucid wait"0" as"program" from"gh-r" pick"usr/bin/gh"
zinit light "cli/cli"
# TMUX
zinit ice from"gh-r" as"program" mv"tmux* -> tmux" pick"tmux" atload"alias tmux=tmux"
zinit light tmux/tmux
# TMUXINATOR
#zinit ice as"completion"; zinit snippet ~/.nubem_dot_files/extras/tmuxinator/tmuxinator.zsh
# ZSH MANYDOTS MAGIC
zinit autoload'#manydots-magic' for knu/zsh-manydots-magic
# TREE-SITTER
zinit ice as"program" from"gh-r" mv"tree* -> tree-sitter" pick"tree-sitter"
zinit light tree-sitter/tree-sitter
# XURLS
#zinit ice as"program" from"gh-r" mv"xurls* -> xurls" pick"xurls"
#zinit light mvdan/xurls
# PRETTYPING
zinit ice lucid wait'' as"program" pick"prettyping" atload'alias ping=prettyping'
zinit load "denilsonsa/prettyping"
# GLOW
#zinit ice lucid wait"0" as"program" from"gh-r" bpick='*linux_amd64.deb' pick"usr/bin/glow"
#zinit light charmbracelet/glow
# CODE-MINIMAP
#zinit ice lucid wait"0" as"program" from"gh-r" bpick='*amd64.deb' pick"usr/bin/code-minimap"
#zinit light wfxr/code-minimap
# ZSH DIFF SO FANCY
# zinit ice wait"2" lucid as"program" pick"bin/git-dsf"
# zinit light zdharma/zsh-diff-so-fancy
# GIT-FLOW
# zinit light petervanderdoes/git-flow-completion
# RCLONE
# zinit ice lucid wait"0" as"program" from"gh-r" bpick='*-linux-amd64.deb' pick"usr/bin/rclone"
# zinit light 'rclone/rclone'
# WHATSAPP CLI
# zinit ice lucid wait"0" as"program" from"gh-r" pick"whatscli"
# zinit light "normen/whatscli"
#####################
# HISTORY #
#####################
[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
HISTSIZE=290000
SAVEHIST=$HISTSIZE
#####################
# SETOPT #
#####################
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_all_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
setopt always_to_end # cursor moved to the end in full completion
setopt hash_list_all # hash everything before completion
# setopt completealiases # complete alisases
setopt always_to_end # when completing from the middle of a word, move the cursor to the end of the word
setopt complete_in_word # allow completion from within a word/phrase
setopt nocorrect # spelling correction for commands
setopt list_ambiguous # complete as much of a completion until it gets ambiguous.
setopt nolisttypes
setopt listpacked
setopt automenu
unsetopt BEEP
setopt vi
#chpwd() exa --git --icons --classify --group-directories-first --time-style=long-iso --group --color-scale
#####################
# ENV VARIABLE #
#####################
#export EDITOR='nvim'
export EDITOR='vim'
export VISUAL=$EDITOR
export PAGER='less'
export SHELL='/bin/zsh'
#if [[ ! $(tmux ls) ]] 2> /dev/null; then
# tmux new -s λ
#fi
#####################
# COLORING #
#####################
autoload colors && colors
#####################
# ALIASES #
#####################
source $HOME/.zsh_aliases
#####################
# FANCY-CTRL-Z #
#####################
function fg-fzf() {
job="$(jobs | fzf -0 -1 | sed -E 's/\[(.+)\].*/\1/')" && echo '' && fg %$job
}
function fancy-ctrl-z () {
if [[ $#BUFFER -eq 0 ]]; then
BUFFER=" fg-fzf"
zle accept-line -w
else
zle push-input -w
zle clear-screen -w
fi
}
zle -N fancy-ctrl-z
bindkey '^Z' fancy-ctrl-z
#####################
# FZF SETTINGS #
#####################
export FZF_DEFAULT_OPTS="
--ansi
--layout=default
--info=inline
--height=50%
--multi
--preview-window=right:50%
--preview-window=sharp
--preview-window=cycle
--preview '([[ -f {} ]] && (bat --style=numbers --color=always --theme=gruvbox-dark --line-range :500 {} || cat {})) || ([[ -d {} ]] && (tree -C {} | less)) || echo {} 2> /dev/null | head -200'
--prompt='λ -> '
--pointer='|>'
--marker='✓'
--bind 'ctrl-e:execute(vim {} < /dev/tty > /dev/tty 2>&1)' > selected
--bind 'ctrl-v:execute(code {+})'"
export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow -g "!{.git,node_modules}/*" 2> /dev/null'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
#####################
# FZF-GC-PROJECT #
#####################
# Thanks to sei40kr/zsh-fzf-gcloud
#function fzf-gcloud-config-set-project() {
# local project="$(gcloud projects list |
# fzf --header-lines=1 --reverse |
# awk '{ print $1 }')"
# if [[ -n "$project" ]]; then
# gcloud config set project "$project"
# fi
#}
#zle -N fzf-gcloud-config-set-project
#bindkey '^G' fzf-gcloud-config-set-project
#####################
# PATH #
#####################
export PATH=$PATH:~/.local/bin:~/bin
#####################
# P10K SETTINGS #
#####################
[[ -f ~/.p10k.zsh ]] && source ~/.p10k.zsh
#####################
# RVM VARIABLE #
#####################
#export PATH="$PATH:$HOME/.rvm/bin"
#[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

37
zsh/aliases.zsh Normal file
View file

@ -0,0 +1,37 @@
#Readability aliases
alias lss='ls -alh --color=auto'
alias mount='mount |column -t'
alias df='df -H -x squashfs -x tmpfs -x devtmpfs'
#Shell Function aliases
alias dirs="dirs -v"
alias h='history'
alias j='jobs -l'
#shortcuts aliases
alias please="sudo !!"
alias ping='ping -c 5'
alias ax="chmod a+x"
alias wmip="curl icanhazip.com"
#git aliases
alias gitS='git status'
alias gitL='git log'
alias gitD='git diff'
alias gitC='git commit -a'
#Apt aliases
alias aptup="sudo apt update && sudo apt upgrade"
alias aptrm="sudo apt autoremove && sudo apt autoclean"
#Combo aliases
mcd() { mkdir -p "$1"; cd "$1";} #make a directory and cd into it
cls() { cd "$1"; ls;} #cd into directory and list contents
md5check() { md5sum "$1" | grep "$2";} #md5sum file, compare to md5sum as second parameter
#ssh aliases
alias sagent="eval `ssh-agent`"
#Command Replacement aliases
alias less='less -imJMW'