diff --git a/.aliases b/.aliases index 612aa6d..434e947 100644 --- a/.aliases +++ b/.aliases @@ -1,3 +1,14 @@ +##### ============================ +##### GENERATED - DO NOT MODIFY +##### 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' @@ -35,3 +46,41 @@ 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 + 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 + +#http +alias whichport='lsof -i -P | grep LISTEN | grep $1' +alias wport=whichport +alias port=whichport + diff --git a/dev_macosx_setup.sh b/dev_macosx_setup.sh new file mode 100755 index 0000000..85b1ebb --- /dev/null +++ b/dev_macosx_setup.sh @@ -0,0 +1,28 @@ + +# 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 +brew install hstr #history + +# always override base aliases/scripts +cat .aliases >> $ZSH_CUSTOM/kinglew.zsh 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 diff --git a/dev_windows_zsh_setup.sh b/dev_windows_zsh_setup.sh new file mode 100644 index 0000000..8577f25 --- /dev/null +++ b/dev_windows_zsh_setup.sh @@ -0,0 +1,74 @@ +# 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 + +if ! [[ "$1" = "--skip-install" ]]; then + echo "Installing/Upgrading applications using Scoop" + + 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 + + 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 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 +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 + +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 + +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 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:"; +}