diff options
author | jakob.stendahl <jakob.stendahl@infomedia.dk> | 2024-02-09 11:35:20 +0100 |
---|---|---|
committer | jakob.stendahl <jakob.stendahl@infomedia.dk> | 2024-02-09 11:35:20 +0100 |
commit | 76dce9a62c564070eb7a079a37a05ba5eb2355cf (patch) | |
tree | 2db91593938752a2e9961508247d52a7ce41ff08 /Common/zshrc | |
parent | 6b0bdfa63bdfb1464db36162390a35da9792cb14 (diff) | |
download | dotfiles-76dce9a62c564070eb7a079a37a05ba5eb2355cf.tar.gz dotfiles-76dce9a62c564070eb7a079a37a05ba5eb2355cf.zip |
some things
Diffstat (limited to 'Common/zshrc')
-rw-r--r-- | Common/zshrc | 160 |
1 files changed, 0 insertions, 160 deletions
diff --git a/Common/zshrc b/Common/zshrc deleted file mode 100644 index 87f7b7c..0000000 --- a/Common/zshrc +++ /dev/null @@ -1,160 +0,0 @@ -# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. -# Initialization code that may require console input (password prompts, [y/n] -# confirmations, etc.) must go above this block; everything else may go below. -if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then - source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" -fi - -# If you come from bash you might have to change your $PATH. -export PATH=$HOME/bin:/usr/local/bin:$HOME/.local/bin:$PATH:$HOME/go/bin -export KEYTIMEOUT=1 - -# Check if env setup file exists -if [ ! -f ~/.zsh_env_setup ]; then - echo "export ZSH=$HOME/.oh-my-zsh" > ~/.zsh_env_setup - echo "DEFAULT_USER=$USER" >> ~/.zsh_env_setup - echo "export GIT_EDITOR=\"nvim\"" >> ~/.zsh_env_setup - echo "export GIT_AUTHOR_NAME=\"jakobst1n\"" >> ~/.zsh_env_setup - echo "export GIT_AUTHOR_EMAIL=\"jakob.stendahl@outlook.com\"" >> ~/.zsh_env_setup -fi - -# Source env setup file -source ~/.zsh_env_setup - -# Source powerlevel10k theme -case "$OSTYPE" in - darwin*) - source /usr/local/opt/powerlevel10k/powerlevel10k.zsh-theme;; - linux*) - ZSH_THEME="powerlevel10k/powerlevel10k";; -esac - -COMPLETION_WAITING_DOTS="true" - -ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=7,bold" - -# Setup plugins -plugins=( - git - zsh-autosuggestions - zsh-syntax-highlighting - #zsh-vi-mode -) - -# zsh-vi-mode-setup -#ZVM_CURSOR_STYLE_ENABLED=false -# zvm_config() { -# ZVM_INSERT_MODE_CURSOR=$ZVM_CURSOR_BLOCK -# ZVM_NORMAL_MODE_CURSOR=$ZVM_CURSOR_UNDERLINE -# ZVM_VISUAL_MODE_CURSOR=$ZVM_CURSOR_UNDERLINE -# ZVM_VISUAL_LINE_MODE_CURSOR=$ZVM_CURSOR_UNDERLINE -# ZVM_OPPEND_MODE_CURSOR=$ZVM_CURSOR_BLINKING_BLOCK -# } - -# Setup oh-my-zsh -source $ZSH/oh-my-zsh.sh - -# Modify locale and path -export LC_ALL=en_US.UTF-8 -export LANG=en_US.UTF-8 - -# Set editor -export EDITOR="nvim" - -# Enable vim keybindings (This is enabled using zsh-vi-mode now. -# bindkey -v - -# Add aliases -alias lsp="ps -ax | grep" -alias lsa="ls -la" -alias lsg="ls | grep" -alias lsag="ls -la | grep" -alias ls="tput setaf 3 && echo \"'lsa' for 'ls -la', \n'lsg' for 'ls | grep',\n'lsag' for 'ls -la | grep',\n'lsp' for 'ps -ax |grep'\" && tput sgr0 && ls" - -alias _vi=$(which vi) -alias _vim=$(which vim) -alias vi=nvim -alias vim=nvim - -# man pages in colors -man() { - LESS_TERMCAP_md=$'\e[01;31m' \ - LESS_TERMCAP_me=$'\e[0m' \ - LESS_TERMCAP_se=$'\e[0m' \ - LESS_TERMCAP_so=$'\e[01;44;33m' \ - LESS_TERMCAP_ue=$'\e[0m' \ - LESS_TERMCAP_us=$'\e[01;32m' \ - command man "$@" -} - -# Make tmux window title show the ssh hostname -# Make short hostname only if its not an IP address -__tm_get_hostname(){ - local HOST="$(echo $* | rev | cut -d ' ' -f 1 | rev)" - if echo $HOST | grep -P "^([0-9]+\.){3}[0-9]+" -q; then - echo $HOST - else - echo $HOST| cut -d . -f 1 - fi -} - -__tm_get_current_window(){ - tmux list-windows| awk -F : '/\(active\)$/{print $1}' -} - -# Rename window according to __tm_get_hostname and then restore it after the command -__tm_command() { - if [ "$(ps -p $(ps -p $$ -o ppid=) -o comm=| cut -d : -f 1)" = "tmux" ]; then - __tm_window=$(__tm_get_current_window) - # Use current window to change back the setting. If not it will be applied to the active window - trap "tmux set-window-option -t $__tm_window automatic-rename on 1>/dev/null" EXIT HUP INT QUIT PIPE TERM - tmux rename-window "$(__tm_get_hostname $*)" - command "$@" - tmux set-window-option -t $__tm_window automatic-rename on 1>/dev/null - else - command "$@" - fi -} - -ssh() { - __tm_command ssh "$@" -} - -ec2ssh() { - __tm_command ec2ssh "$@" -} - -[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh - -case "$OSTYPE" in - darwin*) - path+=("$(readlink /Users/$DEFAULT_USER/bin)") - path+=("/Library/TeX/texbin") - path+=("/usr/local/share/dotnet") - path+=("/usr/local/sbin") - path+=("/Users/jakobstendahl/.deta/bin") - path+=("/Applications/Racket v8.2/bin") - path+=("/Users/jakobstendahl/Library/Python/3.9/bin/") - export PATH - - alias krak='/Applications/GitKraken.app/Contents/MacOS/GitKraken -p "$(PWD)" &>> /dev/null &' - - #THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!! - export SDKMAN_DIR="/Users/jakobstendahl/.sdkman" - [[ -s "/Users/jakobstendahl/.sdkman/bin/sdkman-init.sh" ]] && source "/Users/jakobstendahl/.sdkman/bin/sdkman-init.sh" - ;; - linux*) - alias pbcopy='xsel --clipboard --input' - alias pbpaste='xsel --clipboard --output' - ;; -esac - -# start only one ssh-agent and reuse the created one -# this is used for sway, although keys added do not persist on reboot -SSH_DIR="$HOME" -if ! pgrep -u "$USER" ssh-agent > /dev/null; then - ssh-agent > "$SSH_DIR/ssh-agent.env" -fi -source "$SSH_DIR/ssh-agent.env" > /dev/null - -[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh |