Merge pull request #16 from jotyGill/develop

ezsh release
This commit is contained in:
jotyGill
2021-10-07 09:21:28 +00:00
committed by GitHub
6 changed files with 427 additions and 360 deletions

224
.zshrc
View File

@@ -1,214 +1,28 @@
export TERM="xterm-256color" ################# DO NOT MODIFY THIS FILE #######################
# If you come from bash you might have to change your $PATH. ####### PLACE YOUR CONFIGS IN ~/.config/ezsh/zshrc FOLDER #######
# export PATH=$HOME/bin:/usr/local/bin:$PATH #################################################################
# Path to your oh-my-zsh installation. # This file is created by ezsh setup.
export ZSH=$HOME/.oh-my-zsh # Place all your .zshrc configurations / overrides in a single or multiple files under ~/.config/ezsh/zshrc/ folder
# Your original .zshrc is backed up at ~/.zshrc-backup-%y-%m-%d
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
POWERLEVEL9K_MODE='nerdfont-complete' # Load ezsh configurations
source "$HOME/.config/ezsh/ezshrc.zsh"
ZSH_THEME="powerlevel10k/powerlevel10k" # Any zshrc configurations under the folder ~/.config/ezsh/zshrc/ will override the default ezsh configs.
# Place all of your personal configurations over there
ZSH_CONFIGS_DIR="$HOME/.config/ezsh/zshrc"
POWERLEVEL9K_OS_ICON_BACKGROUND="white" if [ "$(ls -A $ZSH_CONFIGS_DIR)" ]; then
POWERLEVEL9K_OS_ICON_FOREGROUND="blue" for file in "$ZSH_CONFIGS_DIR"/*; do
POWERLEVEL9K_DIR_HOME_FOREGROUND="white" source "$file"
POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND="white" done
POWERLEVEL9K_DIR_DEFAULT_FOREGROUND="white" fi
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(virtualenv status command_execution_time background_jobs todo ram load rvm time)
# more prompt elements that are suggested
# (public_ip docker_machine pyenv nvm) https://github.com/bhilburn/powerlevel9k#prompt-customization
# Note: using public_ip is cool but when connection is down prompt waits for 10-20 seconds
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh os_icon context dir rbenv vcs)
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
git
zsh-completions
zsh-autosuggestions
history-substring-search
python
httpie
docker
lol
pip
pyenv
redis-cli
screen
systemd
web-search
k
# zsh-wakatime # enable if you use wakatime with 'https://github.com/wbingli/zsh-wakatime'
zsh-syntax-highlighting
)
#plugins+=(zsh-nvm)
# Now source oh-my-zsh.sh so that any plugins added in ~/.config/ezsh/zshrc/* files also get loaded
source $ZSH/oh-my-zsh.sh source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH" # Configs that can only work after "source $ZSH/oh-my-zsh.sh", such as Aliases that depend oh-my-zsh plugins
alias k="k -h" # show human readable file sizes, in kb, mb etc
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# Add to PATH to Install and run programs with "pip install --user"
export PATH=$PATH:~/.local/bin
NPM_PACKAGES="${HOME}/.npm"
PATH="$NPM_PACKAGES/bin:$PATH"
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export FZF_DEFAULT_OPS="--extended"
export MARKER_KEY_NEXT_PLACEHOLDER="\C-b" #change maker key binding from Ctr+t to Ctr+b
[[ -s "$HOME/.local/share/marker/marker.sh" ]] && source "$HOME/.local/share/marker/marker.sh"
export PATH=$PATH:~/.quickzsh/todo/bin #usig alias doesn't properly work
autoload -U compinit && compinit # zsh-completions
# autoload bashcompinit # bash completions
# bashcompinit
# CUSTOM ALIASES
SAVEHIST=50000 #save upto 50,000 lines in history. oh-my-zsh default is 10,000
#setopt hist_ignore_all_dups # dont record duplicated entries in history during a single session
alias myip="wget -qO- https://wtfismyip.com/text" # quickly show external ip address
alias l="ls -lah"
alias x="exit"
alias k="k -h" # show human readable filesizes, in kb, mb etc
# CUSTOM FUNCTIONS
# cheat sheets (github.com/chubin/cheat.sh), find out how to use commands
# example 'cheat tar'
# for language specific question supply 2 args first for language, second as the question
# eample: cheat python3 execute external program
cheat() {
if [ "$2" ]; then
curl "https://cheat.sh/$1/$2+$3+$4+$5+$6+$7+$8+$9+$10"
else
curl "https://cheat.sh/$1"
fi
}
# Matrix screen saver! will run if you have installed "cmatrix"
# TMOUT=900
# TRAPALRM() { if command -v cmatrix &> /dev/null; then cmatrix -sb; fi }
speedtest() {
curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python3 -
}
dadjoke() {
curl https://icanhazdadjoke.com
}
# Find dictionary definition
dict() {
if [ "$3" ]; then
curl "dict://dict.org/d:$1 $2 $3"
elif [ "$2" ]; then
curl "dict://dict.org/d:$1 $2"
else
curl "dict://dict.org/d:$1"
fi
}
# Find geo info from IP
ipgeo() {
# Specify ip or your ip will be used
if [ "$1" ]; then
curl "http://api.db-ip.com/v2/free/$1"
else
curl "http://api.db-ip.com/v2/free/$(myip)"
fi
}
# Show covid-19 spread stats
corona() {
# Specify country otherwise shows stats for all
if [ "$1" ]; then
curl "https://corona-stats.online/$1"
else
curl "https://corona-stats.online"
fi
}

View File

@@ -1,4 +1,4 @@
# quickz-sh # ezsh
A simple script to setup an awesome shell environment. A simple script to setup an awesome shell environment.
Quickly install and setup zsh and oh-my-zsh (https://github.com/robbyrussell/oh-my-zsh) with Quickly install and setup zsh and oh-my-zsh (https://github.com/robbyrussell/oh-my-zsh) with
* powerlevel10k theme (https://github.com/romkatv/powerlevel10k) * powerlevel10k theme (https://github.com/romkatv/powerlevel10k)
@@ -12,10 +12,15 @@ Quickly install and setup zsh and oh-my-zsh (https://github.com/robbyrussell/oh-
* marker (https://github.com/pindexis/marker) * marker (https://github.com/pindexis/marker)
* todotxt (https://github.com/todotxt/todo.txt-cli) * todotxt (https://github.com/todotxt/todo.txt-cli)
Sets following useful aliases: Sets following useful aliases and ohmyzsh plugins. **You can add more or overwrite these in your personal zsh config files under `~/.config/ezsh/zshrc/`**
* l="ls -lah" - just type "l" instead of "ls -lah" * l="ls -lah" - just type "l" instead of "ls -lah"
* alias k="k -h" - show human readable filesizes, in kb, mb etc * alias k="k -h" - show human readable filesizes, in kb, mb etc
* x="exit" * e="exit"
* [x="extract"](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/extract) - extract any compressed files
* [z](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/z) - quickly jump to most visited directories
* [web-search](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/web-search) - search on the web from cli
* [sudo](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/sudo) - easily prefix your commands with sudo by pressing `esc` twice
* [systemd](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/systemd) - many useful aliases for systemd
* https - make httpie use https * https - make httpie use https
* myip - (wget -qO- https://wtfismyip.com/text) - what's my ip: quickly find out external IP * myip - (wget -qO- https://wtfismyip.com/text) - what's my ip: quickly find out external IP
* cheat - (https://github.com/chubin/cheat.sh) - cheatsheets in the terminal! * cheat - (https://github.com/chubin/cheat.sh) - cheatsheets in the terminal!
@@ -27,9 +32,9 @@ Sets following useful aliases:
## Demo ## Demo
Currently the command prompt looks like this (easily customize it in zshrc) Command prompt looks like this (easily customize it by placing your configs in ~/.config/ezsh/zshrc/)
![prompt](https://user-images.githubusercontent.com/8462091/43674765-8bb13a76-9817-11e8-8b7b-16b8b1998408.png) ![prompt](https://user-images.githubusercontent.com/8462091/43674765-8bb13a76-9817-11e8-8b7b-16b8b1998408.png)
user : directory : git stats : last command exit code : ip : todo tasks : free memory: load : time user : directory : git stats : last command exit code free memory: load : time
Watch this to get an idea of what your Shell (well, life!) could be like!! Watch this to get an idea of what your Shell (well, life!) could be like!!
@@ -42,12 +47,12 @@ Requirements:
* `python3` or `python` is required to run option '-c' which copies history from .bash_history * `python3` or `python` is required to run option '-c' which copies history from .bash_history
``` bash ``` bash
git clone https://github.com/jotyGill/quickz-sh.git git clone https://github.com/jotyGill/ezsh
cd quickz-sh cd ezsh
./quickz.sh -c # only run with '-c' the first time, running multiple times will duplicate history entries ./install.sh -c # only run with '-c' the first time, running multiple times will duplicate history entries
``` ```
This will install the setup under `~/.config/ezsh/`
Change your terminals fonts to either "RobotoMono Nerd Font" or "Hack Nerd Font" or "DejaVu Sans Mono Nerd Fonts". Change your terminal's fonts to either "RobotoMono Nerd Font" or "Hack Nerd Font" or "DejaVu Sans Mono Nerd Fonts".
You can also manually install Nerd Fonts of your choice. You can also manually install Nerd Fonts of your choice.
## Notes ## Notes
@@ -57,9 +62,9 @@ You can also manually install Nerd Fonts of your choice.
* marker's shortcut "Ctr+t" clashed with fzf so I rebound it to "Ctr +b" * marker's shortcut "Ctr+t" clashed with fzf so I rebound it to "Ctr +b"
* All oh-my-zsh plugins are installed under ~/.oh-my-zsh, Other tools (fzf,marker,todo) are installed in ~/.quickzsh * All oh-my-zsh plugins are installed under ~/.config/ezsh/oh-my-zsh/plugin, Other tools (fzf,marker,todo) are installed in ~/.config/ezsh/
* The look of the shell can be very easily customised[https://github.com/bhilburn/powerlevel9k#prompt-customization] by editing POWERLEVEL9K settings in .zshrc (from line ~15)
* The look of the shell can be very easily customised[https://github.com/bhilburn/powerlevel9k#prompt-customization] by overwriting POWERLEVEL10K settings
in your personal config file under ~/.config/ezsh/zshrc/ . See my setup under example/personal_rc.zsh
Suggestions about more cool tools are always welcome :) Suggestions about more cool tools are always welcome :)

View File

@@ -0,0 +1,10 @@
# This my personal zshrc configs. Feel free to use it and modify according to your needs
# Place all your .zshrc configurations (including this one) in a single or multiple files under ~/.config/ezsh/zshrc/ folder
# Additional OH-MY-ZSH plugins to enable
plugins+=(lol httpie docker docker-compose pyenv pip)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(virtualenv status command_execution_time background_jobs todo ram load rvm time)
# Custom Aliases, add your personal aliases here

216
ezshrc.zsh Normal file
View File

@@ -0,0 +1,216 @@
export TERM="xterm-256color"
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.config/ezsh/oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
POWERLEVEL9K_MODE='nerdfont-complete'
ZSH_THEME="powerlevel10k/powerlevel10k"
POWERLEVEL9K_OS_ICON_BACKGROUND="white"
POWERLEVEL9K_OS_ICON_FOREGROUND="blue"
POWERLEVEL9K_DIR_HOME_FOREGROUND="white"
POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND="white"
POWERLEVEL9K_DIR_DEFAULT_FOREGROUND="white"
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status command_execution_time background_jobs ram load rvm time)
# more prompt elements that are suggested
# (public_ip docker_machine pyenv nvm) https://github.com/bhilburn/powerlevel9k#prompt-customization
# Note: using public_ip is cool but when connection is down prompt waits for 10-20 seconds
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh os_icon context dir vcs)
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
zsh-completions
zsh-autosuggestions
zsh-syntax-highlighting
history-substring-search
screen
systemd
web-search
k
extract
z
sudo
# httpie
# git
# python
# docker
# lol
# pip
# pyenv
# redis-cli
# zsh-wakatime # enable if you use wakatime with 'https://github.com/wbingli/zsh-wakatime'
)
#plugins+=(zsh-nvm)
# source $ZSH/oh-my-zsh.sh # This is now run in .zshrc after importing user configs from ~/.config/ezsh/zshrc/* files
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# Add to PATH to Install and run programs with "pip install --user"
export PATH=$PATH:~/.local/bin
export PATH=$PATH:~/.config/ezsh/bin
NPM_PACKAGES="${HOME}/.npm"
PATH="$NPM_PACKAGES/bin:$PATH"
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export FZF_DEFAULT_OPS="--extended"
export MARKER_KEY_NEXT_PLACEHOLDER="\C-b" #change maker key binding from Ctr+t to Ctr+b
[[ -s "$HOME/.config/ezsh/marker/marker.sh" ]] && source "$HOME/.config/ezsh/marker/marker.sh"
autoload -U compinit && compinit -C -d ~/.cache/zsh/.zcompdump # zsh-completions
# autoload bashcompinit # bash completions
# bashcompinit
# QuickZsh
SAVEHIST=50000 #save upto 50,000 lines in history. oh-my-zsh default is 10,000
#setopt hist_ignore_all_dups # dont record duplicated entries in history during a single session
alias myip="wget -qO- https://wtfismyip.com/text" # quickly show external ip address
alias l="ls -lah"
alias e="exit"
# CUSTOM FUNCTIONS
# cheat sheets (github.com/chubin/cheat.sh), find out how to use commands
# example 'cheat tar'
# for language specific question supply 2 args first for language, second as the question
# eample: cheat python3 execute external program
cheat() {
if [ "$2" ]; then
curl "https://cheat.sh/$1/$2+$3+$4+$5+$6+$7+$8+$9+$10"
else
curl "https://cheat.sh/$1"
fi
}
# Matrix screen saver! will run if you have installed "cmatrix"
# TMOUT=900
# TRAPALRM() { if command -v cmatrix &> /dev/null; then cmatrix -sb; fi }
speedtest() {
curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python3 -
}
dadjoke() {
curl https://icanhazdadjoke.com
}
# Find dictionary definition
dict() {
if [ "$3" ]; then
curl "dict://dict.org/d:$1 $2 $3"
elif [ "$2" ]; then
curl "dict://dict.org/d:$1 $2"
else
curl "dict://dict.org/d:$1"
fi
}
# Find geo info from IP
ipgeo() {
# Specify ip or your ip will be used
if [ "$1" ]; then
curl "http://api.db-ip.com/v2/free/$1"
else
curl "http://api.db-ip.com/v2/free/$(myip)"
fi
}
# Show covid-19 spread stats
corona() {
# Specify country otherwise shows stats for all
if [ "$1" ]; then
curl "https://corona-stats.online/$1"
else
curl "https://corona-stats.online"
fi
}

164
install.sh Executable file
View File

@@ -0,0 +1,164 @@
#!/bin/bash
if command -v zsh &> /dev/null && command -v git &> /dev/null && command -v wget &> /dev/null; then
echo -e "ZSH and Git are already installed\n"
else
if sudo apt install -y zsh git wget || sudo pacman -S zsh git wget || sudo dnf install -y zsh git wget || sudo yum install -y zsh git wget || sudo brew install git zsh wget || pkg install git zsh wget ; then
echo -e "zsh wget and git Installed\n"
else
echo -e "Please install the following packages first, then try again: zsh git wget \n" && exit
fi
fi
if mv -n ~/.zshrc ~/.zshrc-backup-$(date +"%Y-%m-%d"); then # backup .zshrc
echo -e "Backed up the current .zshrc to .zshrc-backup-date\n"
fi
echo -e "Installing oh-my-zsh\n"
if [ -d ~/.config/ezsh/oh-my-zsh ]; then
echo -e "oh-my-zsh is already installed\n"
elif [ -d ~/.oh-my-zsh ]; then
echo -e "oh-my-zsh in already installed at '~/.oh-my-zsh'. Moving it to '~/.config/ezsh/oh-my-zsh'"
export ZSH="$HOME/.config/ezsh/oh-my-zsh"
mv ~/.oh-my-zsh ~/.config/ezsh/oh-my-zsh
else
git clone --depth=1 git://github.com/robbyrussell/oh-my-zsh.git ~/.config/ezsh/oh-my-zsh
fi
if [ -d ~/.quickzsh ]; then
echo -e "The setup was installed at '~/.quickzsh'. Moving it to '~/.config/ezsh' \n"
mv ~/.quickzsh ~/.config/ezsh
else
mkdir -p ~/.config/ezsh # external plugins, things, will be instlled in here
fi
cp -f .zshrc ~/
cp -f ezshrc.zsh ~/.config/ezsh/
mkdir -p ~/.config/ezsh/zshrc # PLACE YOUR ZSHRC CONFIGURATIONS OVER THERE
mkdir -p ~/.cache/zsh/ # this will be used to store .zcompdump zsh completion cache files which normally clutter $HOME
if [ -f ~/.zcompdump ]; then
mv ~/.zcompdump* ~/.cache/zsh/
fi
if [ -d ~/.config/ezsh/oh-my-zsh/plugins/zsh-autosuggestions ]; then
cd ~/.config/ezsh/oh-my-zsh/plugins/zsh-autosuggestions && git pull
else
git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions ~/.config/ezsh/oh-my-zsh/plugins/zsh-autosuggestions
fi
if [ -d ~/.config/ezsh/oh-my-zsh/custom/plugins/zsh-syntax-highlighting ]; then
cd ~/.config/ezsh/oh-my-zsh/custom/plugins/zsh-syntax-highlighting && git pull
else
git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.config/ezsh/oh-my-zsh/custom/plugins/zsh-syntax-highlighting
fi
if [ -d ~/.config/ezsh/oh-my-zsh/custom/plugins/zsh-completions ]; then
cd ~/.config/ezsh/oh-my-zsh/custom/plugins/zsh-completions && git pull
else
git clone --depth=1 https://github.com/zsh-users/zsh-completions ~/.config/ezsh/oh-my-zsh/custom/plugins/zsh-completions
fi
if [ -d ~/.config/ezsh/oh-my-zsh/custom/plugins/zsh-history-substring-search ]; then
cd ~/.config/ezsh/oh-my-zsh/custom/plugins/zsh-history-substring-search && git pull
else
git clone --depth=1 https://github.com/zsh-users/zsh-history-substring-search ~/.config/ezsh/oh-my-zsh/custom/plugins/zsh-history-substring-search
fi
# INSTALL FONTS
echo -e "Installing Nerd Fonts version of Hack, Roboto Mono, DejaVu Sans Mono\n"
wget -q --show-progress -N https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/Hack/Regular/complete/Hack%20Regular%20Nerd%20Font%20Complete.ttf -P ~/.fonts/
wget -q --show-progress -N https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/RobotoMono/Regular/complete/Roboto%20Mono%20Nerd%20Font%20Complete.ttf -P ~/.fonts/
wget -q --show-progress -N https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/DejaVuSansMono/Regular/complete/DejaVu%20Sans%20Mono%20Nerd%20Font%20Complete.ttf -P ~/.fonts/
fc-cache -fv ~/.fonts
if [ -d ~/.config/ezsh/oh-my-zsh/custom/themes/powerlevel10k ]; then
cd ~/.config/ezsh/oh-my-zsh/custom/themes/powerlevel10k && git pull
else
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/.config/ezsh/oh-my-zsh/custom/themes/powerlevel10k
fi
if [ -d ~/.~/.config/ezsh/fzf ]; then
cd ~/.config/ezsh/fzf && git pull
~/.config/ezsh/fzf/install --all --key-bindings --completion --no-update-rc
else
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.config/ezsh/fzf
~/.config/ezsh/fzf/install --all --key-bindings --completion --no-update-rc
fi
if [ -d ~/.config/ezsh/oh-my-zsh/custom/plugins/k ]; then
cd ~/.config/ezsh/oh-my-zsh/custom/plugins/k && git pull
else
git clone --depth 1 https://github.com/supercrabtree/k ~/.config/ezsh/oh-my-zsh/custom/plugins/k
fi
if [ -d ~/.config/ezsh/marker ]; then
cd ~/.config/ezsh/marker && git pull
else
git clone --depth 1 https://github.com/jotyGill/marker ~/.config/ezsh/marker
fi
if ~/.config/ezsh/marker/install.py; then
echo -e "Installed Marker\n"
else
echo -e "Marker Installation Had Issues\n"
fi
# if git clone --depth 1 https://github.com/todotxt/todo.txt-cli.git ~/.config/ezsh/todo; then :
# else
# cd ~/.config/ezsh/todo && git fetch --all && git reset --hard origin/master
# fi
# mkdir ~/.config/ezsh/todo/bin ; cp -f ~/.config/ezsh/todo/todo.sh ~/.config/ezsh/todo/bin/todo.sh # cp todo.sh to ./bin so only it is included in $PATH
# #touch ~/.todo/config # needs it, otherwise spits error , yeah a bug in todo
# ln -s ~/.config/ezsh/todo ~/.todo
if [ ! -L ~/.config/ezsh/todo/bin/todo.sh ]; then
echo -e "Installing todo.sh in ~/.config/ezsh/todo\n"
mkdir -p ~/.config/ezsh/bin
mkdir -p ~/.config/ezsh/todo
wget -q --show-progress "https://github.com/todotxt/todo.txt-cli/releases/download/v2.12.0/todo.txt_cli-2.12.0.tar.gz" -P ~/.config/ezsh/
tar xvf ~/.config/ezsh/todo.txt_cli-2.12.0.tar.gz -C ~/.config/ezsh/todo --strip 1 && rm ~/.config/ezsh/todo.txt_cli-2.12.0.tar.gz
ln -s -f ~/.config/ezsh/todo/todo.sh ~/.config/ezsh/bin/todo.sh # so only .../bin is included in $PATH
ln -s -f ~/.config/ezsh/todo/todo.cfg ~/.todo.cfg # it expects it there or ~/todo.cfg or ~/.todo/config
else
echo -e "todo.sh is already instlled in ~/.config/ezsh/todo/bin/\n"
fi
if [[ $1 == "--cp-hist" ]] || [[ $1 == "-c" ]]; then
echo -e "\nCopying bash_history to zsh_history\n"
if command -v python &>/dev/null; then
wget -q --show-progress https://gist.githubusercontent.com/muendelezaji/c14722ab66b505a49861b8a74e52b274/raw/49f0fb7f661bdf794742257f58950d209dd6cb62/bash-to-zsh-hist.py
cat ~/.bash_history | python bash-to-zsh-hist.py >> ~/.zsh_history
else
if command -v python3 &>/dev/null; then
wget -q --show-progress https://gist.githubusercontent.com/muendelezaji/c14722ab66b505a49861b8a74e52b274/raw/49f0fb7f661bdf794742257f58950d209dd6cb62/bash-to-zsh-hist.py
cat ~/.bash_history | python3 bash-to-zsh-hist.py >> ~/.zsh_history
else
echo "Python is not installed, can't copy bash_history to zsh_history\n"
fi
fi
else
echo -e "\nNot copying bash_history to zsh_history, as --cp-hist or -c is not supplied\n"
fi
ZDOTDIR="~/.config/ezsh/zshrc"
if [ ! -d $ZDOTDIR ]; then
mkdir -p $ZDOTDIR
fi
# source ~/.zshrc
echo -e "\nSudo access is needed to change default shell\n"
if chsh -s $(which zsh) && /bin/zsh -i -c 'omz update'; then
echo -e "Installation Successful, exit terminal and enter a new session"
else
echo -e "Something is wrong"
fi
exit

142
quickz.sh
View File

@@ -1,142 +0,0 @@
#!/bin/bash
if command -v zsh &> /dev/null && command -v git &> /dev/null && command -v wget &> /dev/null; then
echo -e "ZSH and Git are already installed\n"
else
if sudo apt install -y zsh git wget || sudo pacman -S zsh git wget || sudo dnf install -y zsh git wget || sudo yum install -y zsh git wget || sudo brew install git zsh wget || pkg install git zsh wget ; then
echo -e "zsh wget and git Installed\n"
else
echo -e "Please install the following packages first, then try again: zsh git wget \n" && exit
fi
fi
if mv -n ~/.zshrc ~/.zshrc-backup-$(date +"%Y-%m-%d"); then # backup .zshrc
echo -e "Backed up the current .zshrc to .zshrc-backup-date\n"
fi
echo -e "Installing oh-my-zsh\n"
if [ -d ~/.oh-my-zsh ]; then
echo -e "oh-my-zsh is already installed\n"
else
git clone --depth=1 git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
fi
cp -f .zshrc ~/
mkdir -p ~/.quickzsh # external plugins, things, will be instlled in here
if [ -d ~/.oh-my-zsh/plugins/zsh-autosuggestions ]; then
cd ~/.oh-my-zsh/plugins/zsh-autosuggestions && git pull
else
git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/plugins/zsh-autosuggestions
fi
if [ -d ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting ]; then
cd ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting && git pull
else
git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
fi
if [ -d ~/.oh-my-zsh/custom/plugins/zsh-completions ]; then
cd ~/.oh-my-zsh/custom/plugins/zsh-completions && git pull
else
git clone --depth=1 https://github.com/zsh-users/zsh-completions ~/.oh-my-zsh/custom/plugins/zsh-completions
fi
if [ -d ~/.oh-my-zsh/custom/plugins/zsh-history-substring-search ]; then
cd ~/.oh-my-zsh/custom/plugins/zsh-history-substring-search && git pull
else
git clone --depth=1 https://github.com/zsh-users/zsh-history-substring-search ~/.oh-my-zsh/custom/plugins/zsh-history-substring-search
fi
# INSTALL FONTS
echo -e "Installing Nerd Fonts version of Hack, Roboto Mono, DejaVu Sans Mono\n"
wget -q --show-progress -N https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/Hack/Regular/complete/Hack%20Regular%20Nerd%20Font%20Complete.ttf -P ~/.fonts/
wget -q --show-progress -N https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/RobotoMono/Regular/complete/Roboto%20Mono%20Nerd%20Font%20Complete.ttf -P ~/.fonts/
wget -q --show-progress -N https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/DejaVuSansMono/Regular/complete/DejaVu%20Sans%20Mono%20Nerd%20Font%20Complete.ttf -P ~/.fonts/
fc-cache -fv ~/.fonts
if [ -d ~/.oh-my-zsh/custom/themes/powerlevel10k ]; then
cd ~/.oh-my-zsh/custom/themes/powerlevel10k && git pull
else
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/custom/themes/powerlevel10k
fi
if [ -d ~/.quickzsh/fzf ]; then
cd ~/.quickzsh/fzf && git pull
~/.quickzsh/fzf/install --all --key-bindings --completion --no-update-rc --64
else
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.quickzsh/fzf
~/.quickzsh/fzf/install --all --key-bindings --completion --no-update-rc --64
fi
if [ -d ~/.oh-my-zsh/custom/plugins/k ]; then
cd ~/.oh-my-zsh/custom/plugins/k && git pull
else
git clone --depth 1 https://github.com/supercrabtree/k ~/.oh-my-zsh/custom/plugins/k
fi
if [ -d ~/.quickzsh/marker ]; then
cd ~/.quickzsh/marker && git pull
else
git clone --depth 1 https://github.com/pindexis/marker ~/.quickzsh/marker
fi
if ~/.quickzsh/marker/install.py; then
echo -e "Installed Marker\n"
else
echo -e "Marker Installation Had Issues\n"
fi
# if git clone --depth 1 https://github.com/todotxt/todo.txt-cli.git ~/.quickzsh/todo; then :
# else
# cd ~/.quickzsh/todo && git fetch --all && git reset --hard origin/master
# fi
# mkdir ~/.quickzsh/todo/bin ; cp -f ~/.quickzsh/todo/todo.sh ~/.quickzsh/todo/bin/todo.sh # cp todo.sh to ./bin so only it is included in $PATH
# #touch ~/.todo/config # needs it, otherwise spits error , yeah a bug in todo
# ln -s ~/.quickzsh/todo ~/.todo
if [ ! -L ~/.quickzsh/todo/bin/todo.sh ]; then
echo -e "Installing todo.sh in ~/.quickzsh/todo\n"
mkdir -p ~/.quickzsh/todo/bin
wget -q --show-progress "https://github.com/todotxt/todo.txt-cli/releases/download/v2.11.0/todo.txt_cli-2.11.0.tar.gz" -P ~/.quickzsh/
tar xvf ~/.quickzsh/todo.txt_cli-2.11.0.tar.gz -C ~/.quickzsh/todo --strip 1 && rm ~/.quickzsh/todo.txt_cli-2.11.0.tar.gz
ln -s ~/.quickzsh/todo/todo.sh ~/.quickzsh/todo/bin/todo.sh # so only .../bin is included in $PATH
ln -s ~/.quickzsh/todo/todo.cfg ~/.todo.cfg # it expects it there or ~/todo.cfg or ~/.todo/config
else
echo -e "todo.sh is already instlled in ~/.quickzsh/todo/bin/\n"
fi
if [[ $1 == "--cp-hist" ]] || [[ $1 == "-c" ]]; then
echo -e "\nCopying bash_history to zsh_history\n"
if command -v python &>/dev/null; then
wget -q --show-progress https://gist.githubusercontent.com/muendelezaji/c14722ab66b505a49861b8a74e52b274/raw/49f0fb7f661bdf794742257f58950d209dd6cb62/bash-to-zsh-hist.py
cat ~/.bash_history | python bash-to-zsh-hist.py >> ~/.zsh_history
else
if command -v python3 &>/dev/null; then
wget -q --show-progress https://gist.githubusercontent.com/muendelezaji/c14722ab66b505a49861b8a74e52b274/raw/49f0fb7f661bdf794742257f58950d209dd6cb62/bash-to-zsh-hist.py
cat ~/.bash_history | python3 bash-to-zsh-hist.py >> ~/.zsh_history
else
echo "Python is not installed, can't copy bash_history to zsh_history\n"
fi
fi
else
echo -e "\nNot copying bash_history to zsh_history, as --cp-hist or -c is not supplied\n"
fi
# source ~/.zshrc
echo -e "\nSudo access is needed to change default shell\n"
if chsh -s $(which zsh) && /bin/zsh -i -c upgrade_oh_my_zsh; then
echo -e "Installation Successful, exit terminal and enter a new session"
else
echo -e "Something is wrong"
fi
exit