From 5d5a2ff0530bd5fc00016ce6e430b8d077a0ed25 Mon Sep 17 00:00:00 2001 From: kinglew Date: Fri, 21 Jul 2023 15:29:37 -0400 Subject: [PATCH 1/7] update macosx setup --- .aliases | 21 +++++++++++++++++++++ dev_macosx_setup.sh | 27 +++++++++++++++++++++++++++ macoskeyboardbindings.dict | 6 ++++++ 3 files changed, 54 insertions(+) create mode 100755 dev_macosx_setup.sh create mode 100644 macoskeyboardbindings.dict diff --git a/.aliases b/.aliases index 612aa6d..6b0831c 100644 --- a/.aliases +++ b/.aliases @@ -1,3 +1,8 @@ +##### ============================ +##### GENERATED - DO NOT MODIFY +##### This file will be overriden +##### ============================ + #ready zsh configs alias zshrc='cat ~/.zshrc' alias zshalias='cat ~/.oh-my-zsh/zsh.aliases' @@ -35,3 +40,19 @@ alias gprune='git_prune' #git rename alias grename='git branch -m $1' + +case "$OSTYPE" in + darwin*) + alias cat=bat + alias df=duf + alias ls=exa + alias ps=procs + alias sed=sd + alias grep=ripgrep + alias tree=tre + ;; + linux*) + # ... + ;; +esac + diff --git a/dev_macosx_setup.sh b/dev_macosx_setup.sh new file mode 100755 index 0000000..3c45bda --- /dev/null +++ b/dev_macosx_setup.sh @@ -0,0 +1,27 @@ + +# handle keyboard HOME/END keys +# map to start of line/end of line +KEYBINDINGS_DIR="~/Library/KeyBindings" +if [ ! -d "$KEYBINDINGS_DIR" ]; then + echo 'creating default macosx keybindings' + mkdir -p ~/Library/KeyBindings + cp ./macoskeyboardbindings.dict ~/Library/KeyBindings/DefaultKeyBinding.dict +fi + +# install cli tools +brew install bat #cat +brew install duf #df +brew install exa #ls +brew install scc +brew install tldr #man +brew install entr +brew install fzf +brew install jq +brew install procs #ps +brew install sd #sed +brew install ripgrep #grep +brew install tre #tree +brew install xsel #clipboard + +# always override base aliases/scripts +cat .aliases >> $ZSH_CUSTOM/kinglew.zsh diff --git a/macoskeyboardbindings.dict b/macoskeyboardbindings.dict new file mode 100644 index 0000000..9eee350 --- /dev/null +++ b/macoskeyboardbindings.dict @@ -0,0 +1,6 @@ +{ + "\UF729" = "moveToBeginningOfLine:"; + "\UF72B" = "moveToEndOfLine:"; + "$\UF729" = "moveToBeginningOfLineAndModifySelection:"; + "$\UF72B" = "moveToEndOfLineAndModifySelection:"; +} From 8b2db53da9091dbb7279c76158f692c7fe742791 Mon Sep 17 00:00:00 2001 From: kinglew Date: Sun, 16 Feb 2025 15:54:55 -0500 Subject: [PATCH 2/7] update tools --- .aliases | 4 ++++ dev_macosx_setup.sh | 1 + 2 files changed, 5 insertions(+) diff --git a/.aliases b/.aliases index 6b0831c..f81e90e 100644 --- a/.aliases +++ b/.aliases @@ -56,3 +56,7 @@ case "$OSTYPE" in ;; esac +#http +alias whichport='lsof -i -P | grep LISTEN | grep $1' +alias wport=whichport +alias port=whichport \ No newline at end of file diff --git a/dev_macosx_setup.sh b/dev_macosx_setup.sh index 3c45bda..85b1ebb 100755 --- a/dev_macosx_setup.sh +++ b/dev_macosx_setup.sh @@ -22,6 +22,7 @@ brew install sd #sed brew install ripgrep #grep brew install tre #tree brew install xsel #clipboard +brew install hstr #history # always override base aliases/scripts cat .aliases >> $ZSH_CUSTOM/kinglew.zsh From 2f0ce545536f9e502f94585fbef8ea0682b5c359 Mon Sep 17 00:00:00 2001 From: kinglew Date: Sun, 16 Feb 2025 15:55:01 -0500 Subject: [PATCH 3/7] add ubuntu --- dev_ubuntu_setup.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 dev_ubuntu_setup.sh diff --git a/dev_ubuntu_setup.sh b/dev_ubuntu_setup.sh new file mode 100644 index 0000000..31d4e34 --- /dev/null +++ b/dev_ubuntu_setup.sh @@ -0,0 +1,25 @@ +# can be used for ubuntu linux and also for windows WSL2 + +apt install bat -y #cat +apt install duf -y #df +apt install exa -y #ls +snap install scc # count LOC +apt install tldr -y #man +apt install entr -y +apt install fzf -y +apt install jq -y +snap install procs #ps +# apt install rust-sd -y #sed +apt install ripgrep -y +apt install tre-command -y #tree +apt install xsel -y +apt install ncdu -y #disk usage +apt install hstr -y #history + +apt install autojump +git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions + +# always override base aliases/scripts +cat .aliases >> $ZSH_CUSTOM/kinglew.zsh + +echo export PATH="$PATH:/snap/bin" >> $ZSH_CUSTOM/snap.zsh \ No newline at end of file From 155a770ba3e9e5a16804eb43b2d969b669c92aa5 Mon Sep 17 00:00:00 2001 From: kinglew Date: Sun, 16 Feb 2025 15:55:07 -0500 Subject: [PATCH 4/7] add windows zsh --- dev_windows_zsh_setup.sh | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 dev_windows_zsh_setup.sh diff --git a/dev_windows_zsh_setup.sh b/dev_windows_zsh_setup.sh new file mode 100644 index 0000000..05260ee --- /dev/null +++ b/dev_windows_zsh_setup.sh @@ -0,0 +1,50 @@ + +# install scoop +# Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser +# Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression + +###################################################### +# Install/Upgrade apps using Chocolatey +###################################################### + +echo "Installing/Upgrading applications using Scoop" + +scoop bucket add main +scoop bucket add extras +scoop bucket add nerd-fonts + +## dev tools +scoop install main/bat #cat +scoop install main/duf #df +scoop install main/eza #ls +scoop install main/scc +scoop install main/tldr #man + +scoop install main/fzf +scoop install main/jq +scoop install main/procs #ps +scoop install main/sd #sed +scoop install main/ripgrep #grep +scoop install main/tre-command #tree +scoop install extras/autojump + +scoop install extras/bruno +scoop install main/peco +scoop install extras/zeal +scoop install extras/touchcursor + +## dev IDEs +scoop install extras/vscode +scoop install nerd-fonts/JetBrainsMono-NF +scoop install nerd-fonts/JetBrainsMono-NF-Propo +scoop install nerd-fonts/JetBrainsMono-NF-Mono + +# always override base aliases/scripts +cat .aliases >> $ZSH_CUSTOM/kinglew.zsh + +# tocuhcursor +echo "setup touchcursor" +cp ./touchcursor/settings.cfg $APPDATA/TouchCursor/settings.cfg + + + From 6c22759be4001f03b716d311ff4db8660d62be75 Mon Sep 17 00:00:00 2001 From: kinglew Date: Sun, 16 Feb 2025 16:24:01 -0500 Subject: [PATCH 5/7] update --- .aliases | 19 ++++++++++++++++- dev_windows_zsh_setup.sh | 44 ++++++++++++++++++++-------------------- 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/.aliases b/.aliases index f81e90e..a9ce547 100644 --- a/.aliases +++ b/.aliases @@ -50,9 +50,26 @@ case "$OSTYPE" in alias sed=sd alias grep=ripgrep alias tree=tre + alias history=hstr ;; linux*) - # ... + alias cat=bat + alias df=duf + alias ls=exa + alias ps=procs + alias sed=sd + alias grep=ripgrep + alias tree=tre + alias history=hstr + ;; + mysys*) + alias cat=bat + alias df=duf + alias ls=exa + alias ps=procs + alias sed=sd + alias grep=ripgrep + alias tree=tre ;; esac diff --git a/dev_windows_zsh_setup.sh b/dev_windows_zsh_setup.sh index 05260ee..50e85c9 100644 --- a/dev_windows_zsh_setup.sh +++ b/dev_windows_zsh_setup.sh @@ -14,30 +14,30 @@ scoop bucket add extras scoop bucket add nerd-fonts ## dev tools -scoop install main/bat #cat -scoop install main/duf #df -scoop install main/eza #ls -scoop install main/scc -scoop install main/tldr #man - -scoop install main/fzf -scoop install main/jq -scoop install main/procs #ps -scoop install main/sd #sed -scoop install main/ripgrep #grep -scoop install main/tre-command #tree -scoop install extras/autojump - -scoop install extras/bruno -scoop install main/peco -scoop install extras/zeal -scoop install extras/touchcursor +scoop update main/bat #cat +scoop update main/duf #df +scoop update main/eza #ls +scoop update main/scc +scoop update main/tldr #man + +scoop update main/fzf +scoop update main/jq +scoop update main/procs #ps +scoop update main/sd #sed +scoop update main/ripgrep #grep +scoop update main/tre-command #tree +scoop update extras/autojump + +scoop update extras/bruno +scoop update main/peco +scoop update extras/zeal +scoop update extras/touchcursor ## dev IDEs -scoop install extras/vscode -scoop install nerd-fonts/JetBrainsMono-NF -scoop install nerd-fonts/JetBrainsMono-NF-Propo -scoop install nerd-fonts/JetBrainsMono-NF-Mono +scoop update extras/vscode +scoop update nerd-fonts/JetBrainsMono-NF +scoop update nerd-fonts/JetBrainsMono-NF-Propo +scoop update nerd-fonts/JetBrainsMono-NF-Mono # always override base aliases/scripts cat .aliases >> $ZSH_CUSTOM/kinglew.zsh From c715570123bb301f34803e97a0ec7a3904fe4e07 Mon Sep 17 00:00:00 2001 From: kinglew Date: Sun, 16 Feb 2025 19:35:25 -0500 Subject: [PATCH 6/7] update --- .aliases | 9 ++++++++- dev_windows_zsh_setup.sh | 21 +++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/.aliases b/.aliases index a9ce547..434e947 100644 --- a/.aliases +++ b/.aliases @@ -3,6 +3,12 @@ ##### This file will be overriden ##### ============================ +alias work="cd ~/Documents/workspace/" +alias reload="source ~/.zshrc" +loadenv () { + export $(grep -v '^#' ${1} | xargs) +} + #ready zsh configs alias zshrc='cat ~/.zshrc' alias zshalias='cat ~/.oh-my-zsh/zsh.aliases' @@ -76,4 +82,5 @@ esac #http alias whichport='lsof -i -P | grep LISTEN | grep $1' alias wport=whichport -alias port=whichport \ No newline at end of file +alias port=whichport + diff --git a/dev_windows_zsh_setup.sh b/dev_windows_zsh_setup.sh index 50e85c9..e4afb57 100644 --- a/dev_windows_zsh_setup.sh +++ b/dev_windows_zsh_setup.sh @@ -40,11 +40,28 @@ scoop update nerd-fonts/JetBrainsMono-NF-Propo scoop update nerd-fonts/JetBrainsMono-NF-Mono # always override base aliases/scripts -cat .aliases >> $ZSH_CUSTOM/kinglew.zsh +cat .aliases >> $ZSH/custom/kinglew.zsh # tocuhcursor echo "setup touchcursor" cp ./touchcursor/settings.cfg $APPDATA/TouchCursor/settings.cfg +# configure .zshrc +sed -i 's/^ZSH_THEME=.*/ZSH_THEME="gnzh"/' ~/.zshrc +sed -i 's/^plugins=.*/plugins=(git autojump z dotenv zsh-autosuggestions)/' ~/.zshrc - +if ! (( $(grep -c "^export.HISTSIZE" ~/.zshrc ) )) ; then + echo "export HISTSIZE=100000" >> ~/.zshrc +fi +if ! (( $(grep -c "^export.SAVEHIST" ~/.zshrc ) )) ; then + echo "export SAVEHIST=100000" >> ~/.zshrc +fi +if ! (( $(grep -c "^export.HISTCONTROL" ~/.zshrc ) )) ; then + echo "export HISTCONTROL=ignorespace" >> ~/.zshrc +fi +if ! (( $(grep -c "^setopt.hist_ignore_all_dups" ~/.zshrc ) )) ; then + echo "setopt hist_ignore_all_dups" >> ~/.zshrc +fi +if ! (( $(grep -c "^setopt.hist_ignore_space" ~/.zshrc ) )) ; then + echo "setopt hist_ignore_space" >> ~/.zshrc +fi From 993491da26a184579a0ec85eb5d41b3d2be2df98 Mon Sep 17 00:00:00 2001 From: kinglew Date: Sun, 16 Feb 2025 20:02:05 -0500 Subject: [PATCH 7/7] update --- dev_windows_zsh_setup.sh | 69 ++++++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 31 deletions(-) diff --git a/dev_windows_zsh_setup.sh b/dev_windows_zsh_setup.sh index e4afb57..8577f25 100644 --- a/dev_windows_zsh_setup.sh +++ b/dev_windows_zsh_setup.sh @@ -1,52 +1,54 @@ +# Setup zsh on Windows, see +# https://dev.to/pavlosisaris/windows-command-line-revolution-unleash-zsh-and-oh-my-zsh-a-simple-guide-for-developers-271o # install scoop # Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser # Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression -###################################################### -# Install/Upgrade apps using Chocolatey -###################################################### +if ! [[ "$1" = "--skip-install" ]]; then + echo "Installing/Upgrading applications using Scoop" -echo "Installing/Upgrading applications using Scoop" + scoop bucket add main + scoop bucket add extras + scoop bucket add nerd-fonts -scoop bucket add main -scoop bucket add extras -scoop bucket add nerd-fonts + ## dev tools + scoop update main/bat #cat + scoop update main/duf #df + scoop update main/eza #ls + scoop update main/scc + scoop update main/tldr #man -## dev tools -scoop update main/bat #cat -scoop update main/duf #df -scoop update main/eza #ls -scoop update main/scc -scoop update main/tldr #man + scoop update main/fzf + scoop update main/jq + scoop update main/procs #ps + scoop update main/sd #sed + scoop update main/ripgrep #grep + scoop update main/tre-command #tree + scoop update extras/autojump -scoop update main/fzf -scoop update main/jq -scoop update main/procs #ps -scoop update main/sd #sed -scoop update main/ripgrep #grep -scoop update main/tre-command #tree -scoop update extras/autojump + scoop update extras/bruno + scoop update main/peco + scoop update extras/zeal + scoop update extras/touchcursor -scoop update extras/bruno -scoop update main/peco -scoop update extras/zeal -scoop update extras/touchcursor - -## dev IDEs -scoop update extras/vscode -scoop update nerd-fonts/JetBrainsMono-NF -scoop update nerd-fonts/JetBrainsMono-NF-Propo -scoop update nerd-fonts/JetBrainsMono-NF-Mono + ## dev IDEs + scoop update extras/vscode + scoop update nerd-fonts/JetBrainsMono-NF + scoop update nerd-fonts/JetBrainsMono-NF-Propo + scoop update nerd-fonts/JetBrainsMono-NF-Mono +fi # always override base aliases/scripts -cat .aliases >> $ZSH/custom/kinglew.zsh +echo "copy custom aliases" +cp .aliases ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/kinglew.zsh # tocuhcursor echo "setup touchcursor" cp ./touchcursor/settings.cfg $APPDATA/TouchCursor/settings.cfg # configure .zshrc +echo "configure .zshrc" sed -i 's/^ZSH_THEME=.*/ZSH_THEME="gnzh"/' ~/.zshrc sed -i 's/^plugins=.*/plugins=(git autojump z dotenv zsh-autosuggestions)/' ~/.zshrc @@ -65,3 +67,8 @@ fi if ! (( $(grep -c "^setopt.hist_ignore_space" ~/.zshrc ) )) ; then echo "setopt hist_ignore_space" >> ~/.zshrc fi + +autosuggestion_plugin_dir=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions +if [ ! -d autosuggestion_plugin_dir ] ; then + git clone https://github.com/zsh-users/zsh-autosuggestions $autosuggestion_plugin_dir +fi