diff --git a/.zshrc b/.zshrc index fc09568..a230cf4 100644 --- a/.zshrc +++ b/.zshrc @@ -119,5 +119,7 @@ export MARKER_KEY_NEXT_PLACEHOLDER="\C-b" #change maker key binding from Ctr+t [[ -s "$HOME/.local/share/marker/marker.sh" ]] && source "$HOME/.local/share/marker/marker.sh" +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 wip="wget -qO- https://wtfismyip.com/text" # quickly show external ip address alias l="ls -lah" diff --git a/README.md b/README.md index a245853..f9528b4 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,13 @@ Quickly install and setup oh-my-zsh with powerlevel9k theme, Powerline fonts, zsh-completions, zsh-autosuggestions, zsh-syntax-highlighting, history-substring-search, fzf etc. ## Installation +Requirements: +`wget git zsh` will be Automatically installed if not present. `python` is required to run '--cp-hist' + ``` bash git clone https://github.com/jotyGill/quickz-sh.git cd quickz-sh ./quickz.sh ``` +Optionally run it with '--cp-hist' to copy command history from .bash_history to .zsh_history. +`./quickz.sh --cp-hist # don't run multiple times` diff --git a/quickz.sh b/quickz.sh index dfb69e2..23712c7 100755 --- a/quickz.sh +++ b/quickz.sh @@ -1,9 +1,9 @@ #!/bin/bash -if command -v zsh &> /dev/null && command -v git &> /dev/null ; then +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 || sudo dnf install -y zsh git || sudo yum install -y zsh git || sudo brew install git zsh ; then + if sudo apt install -y zsh git wget || sudo dnf install -y zsh git wget || sudo yum install -y zsh git wget || sudo brew install git zsh wget ; then echo -e "ZSH and Git Installed\n" else echo -e "Can't install ZSH or Git\n" && exit @@ -78,10 +78,25 @@ else fi if ~/marker/install.py; then - echo -e "Installed Marker" + echo -e "Installed Marker\n" else - echo -e "Marker Installation Had Issues" + echo -e "Marker Installation Had Issues\n" fi + + +if [[ $1 == "--cp-hist" ]]; then + echo -e "Copying 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 + cat ~/.bash_history | python3 bash-to-zsh-hist.py + else + echo "Python is not installed, can't copy bash_history to zsh_history\n" + fi +else + echo -e "Not copying history\n" +fi + + # source ~/.zshrc echo -e "\nSudo access is needed to change default shell\n"