diff --git a/.zshrc b/.zshrc index 0cd9916..4b09531 100644 --- a/.zshrc +++ b/.zshrc @@ -160,10 +160,10 @@ https() { # make httpie use https # 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 python execute+external+program +# eample: cheat python3 execute external program cheat() { if [ "$2" ]; then - curl "https://cheat.sh/$1/$2" + curl "https://cheat.sh/$1/$2+$3+$4+$5+$6+$7+$8+$9+$10" else curl "https://cheat.sh/$1" fi diff --git a/README.md b/README.md index 0d16f9e..988a622 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ 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 * powerlevel10k theme (https://github.com/romkatv/powerlevel10k) -* Powerline fonts(https://github.com/powerline/fonts) * Nerd-Fonts (even better!) (https://github.com/ryanoasis/nerd-fonts) * zsh-completions (https://github.com/zsh-users/zsh-completions) * zsh-autosuggestions (https://github.com/zsh-users/zsh-autosuggestions) @@ -14,15 +13,15 @@ Quickly install and setup zsh and oh-my-zsh (https://github.com/robbyrussell/oh- * todotxt (https://github.com/todotxt/todo.txt-cli) Sets following useful aliases: -* l="ls -lah" - just type "l" instead of "ls -lah" -* alias k="k -h" - show human readable filesizes, in kb, mb etc +* l="ls -lah" - just type "l" instead of "ls -lah" +* alias k="k -h" - show human readable filesizes, in kb, mb etc * x="exit" -* https - make httpie use https -* wip - (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! +* https - make httpie use https +* wip - (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! * speedtest - (curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python3 -) run speedtest on the fly -* dadjoke - (curl https://icanhazdadjoke.com) terminally sick jokes -* dict - (curl "dict://dict.org/d:$1 $2 $3") dictionary definitions +* dadjoke - (curl https://icanhazdadjoke.com) - terminally sick jokes +* dict - (curl "dict://dict.org/d:$1 $2 $3") - dictionary definitions ## Demo @@ -39,25 +38,21 @@ Watch this to get an idea of what your Shell (well, life!) could be like!! ## Installation Requirements: * `git` to clone it. -* `python3` or `python` is required to run option '--cp-hist' +* `python3` or `python` is required to run option '-c' which copies history from .bash_history ``` bash git clone https://github.com/jotyGill/quickz-sh.git cd quickz-sh -./quickz.sh -``` -First time run it with '--cp-hist' instead, to copy command history from .bash_history to .zsh_history. -``` bash -./quickz.sh --cp-hist # running multiple times will duplicate history entries +./quickz.sh -c # only run with '-c' the first time, running multiple times will duplicate history entries ``` -Change your terminals fonts to either "RobotoMono Nerd Font" or "Hack Nerd Font" or at least on of the "Powerline Fonts". -You can also manually install Nerd Font of your choice. +Change your terminals 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. ## Notes -* If you are already using zsh, your zsh config will be backed up to .zshrc-backup +* If you are already using zsh, your zsh config will be backed up to .zshrc-backup-date -* If the text/icons look broken, make sure your terminal is using one of the Nerd fonts or at least powerline fonts. [discussion](https://github.com/powerline/fonts/issues/185). I recommend "RobotoMono Nerd Font" +* If the text/icons look broken, make sure your terminal is using one of the Nerd fonts. [discussion](https://github.com/powerline/fonts/issues/185). I recommend "RobotoMono Nerd Font" * marker's shortcut "Ctr+t" clashed with fzf so I rebound it to "Ctr +b" diff --git a/quickz.sh b/quickz.sh index 27dfb05..9bcdbd6 100755 --- a/quickz.sh +++ b/quickz.sh @@ -17,8 +17,10 @@ fi echo -e "Installing oh-my-zsh\n" -if git clone --depth=1 git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh; then - echo -e "Installed OH-MY-ZSH\n" +if [ -d ~/.oh-my-zsh ]; then + echo -e "oh-my-zsh is already installed" +else + git clone --depth=1 git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh fi cp -f .zshrc ~/ @@ -26,66 +28,65 @@ cp -f .zshrc ~/ mkdir ~/.quickzsh # external plugins, things, will be instlled in here - -if git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/plugins/zsh-autosuggestions; then : -else +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 git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting; then : -else +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 git clone --depth=1 https://github.com/zsh-users/zsh-completions ~/.oh-my-zsh/custom/plugins/zsh-completions; then : -else +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 git clone --depth=1 https://github.com/zsh-users/zsh-history-substring-search ~/.oh-my-zsh/custom/plugins/zsh-history-substring-search; then : -else +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 -if git clone --depth=1 https://github.com/powerline/fonts.git --depth=1 ~/.quickzsh/powerline_fonts; then : -else - cd ~/.quickzsh/powerline_fonts && git pull -fi - -if ~/.quickzsh/powerline_fonts/install.sh && rm -rf ~/.quickzsh/powerline_fonts; then - echo -e "\npowerline_fonts Installed\n" -else - echo -e "\npowerline_fonts Installation Failed\n" -fi - +echo -e "Installing Nerd Fonts version of Hack, Roboto Mono, DejaVu Sans Mono\n" wget -N https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/Hack/Regular/complete/Hack%20Regular%20Nerd%20Font%20Complete.ttf -P ~/.fonts/ wget -N https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/RobotoMono/Regular/complete/Roboto%20Mono%20Nerd%20Font%20Complete.ttf -P ~/.fonts/ +wget -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 git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/custom/themes/powerlevel10k; then : -else +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 git clone --depth 1 https://github.com/junegunn/fzf.git ~/.quickzsh/fzf; then : -else +if [ -d ~/.quickzsh/fzf ]; then cd ~/.quickzsh/fzf && git pull -fi -~/.quickzsh/fzf/install --all --key-bindings --completion --no-update-rc --64 - -if git clone --depth 1 https://github.com/supercrabtree/k $HOME/.oh-my-zsh/custom/plugins/k; then : + ~/.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; then : fi -if git clone --depth 1 https://github.com/pindexis/marker ~/.quickzsh/marker; then : -else +if [ -d ~/.quickzsh/marker ]; then cd ~/.quickzsh/marker && git pull +else + git clone --depth 1 https://github.com/pindexis/marker ~/.quickzsh/marker; then : fi if ~/.quickzsh/marker/install.py; then @@ -112,7 +113,7 @@ else echo -e "todo.sh is already instlled in ~/.quickzsh/todo/bin/\n" fi -if [[ $1 == "--cp-hist" ]]; then +if [[ $1 == "--cp-hist" ]] || [ $1 == "-c" ]; then echo -e "\nCopying bash_history to zsh_history\n" if command -v python &>/dev/null; then wget https://gist.githubusercontent.com/muendelezaji/c14722ab66b505a49861b8a74e52b274/raw/49f0fb7f661bdf794742257f58950d209dd6cb62/bash-to-zsh-hist.py @@ -126,7 +127,7 @@ if [[ $1 == "--cp-hist" ]]; then fi fi else - echo -e "\nNot copying bash_history to zsh_history, as --cp-hist is not supplied\n" + echo -e "\nNot copying bash_history to zsh_history, as --cp-hist or -c is not supplied\n" fi