zshrc+zprofile updates
* optimise zplug, completions and ohmyzsh plugin loading resulting in faster load time * introduce shell caching (surely another speed-up) * clean-up zshrc and move stuff (wayland exports, sway call) to profile * set cleaner git status indicators via SPACESHIP vars * delete stuff (yeah, I know...) as per #2
This commit is contained in:
parent
e958c65101
commit
447e85b88f
60
.zprofile
60
.zprofile
@ -1,28 +1,38 @@
|
||||
export PATH="$HOME/.local/bin:$HOME/utils/bin:$HOME/.cargo/bin:$GOPATH/bin:$PATH"
|
||||
export GOPATH=$HOME/utils/go
|
||||
export CGO_ENABLED="1"
|
||||
|
||||
add_to_path() {
|
||||
local p=$1
|
||||
if [[ ! "$PATH" == *"$p"* ]]; then
|
||||
export PATH="$p:$PATH"
|
||||
fi
|
||||
}
|
||||
|
||||
add_to_path "$HOME/.local/bin"
|
||||
add_to_path "$HOME/utils/bin"
|
||||
add_to_path "$HOME/.cargo/bin"
|
||||
add_to_path "$GOPATH/bin"
|
||||
|
||||
export EDITOR='vim'
|
||||
export TERM='xterm-256color'
|
||||
export kee="surtur"
|
||||
export SSH_KEY_PATH="$HOME/.ssh/$kee"
|
||||
if [ ! -S ~/.ssh/ssh_auth_sock ]; then
|
||||
eval `ssh-agent` > /dev/null
|
||||
ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock
|
||||
|
||||
|
||||
if [ ! -S $HOME/.ssh/ssh_auth_sock ]; then
|
||||
eval `ssh-agent` > /dev/null
|
||||
ln -sf "$SSH_AUTH_SOCK" $HOME/.ssh/ssh_auth_sock
|
||||
fi
|
||||
export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock
|
||||
export SSH_AUTH_SOCK=$HOME/.ssh/ssh_auth_sock
|
||||
|
||||
if [ -n "$DESKTOP_SESSION" ];then
|
||||
eval $(gnome-keyring-daemon --start)
|
||||
export SSH_AUTH_SOCK
|
||||
fi
|
||||
|
||||
if [[ -z "$WAYLAND_DISPLAY" ]]; then
|
||||
export QT_QPA_PLATFORMTHEME=wayland
|
||||
export QT_AUTO_SCREEN_SCALE_FACTOR=0
|
||||
export MOZ_DBUS_REMOTE=1
|
||||
export MOZ_USE_XINPUT2=1
|
||||
export _JAVA_AWT_WM_NONREPARENTING=1
|
||||
export KITTY_ENABLE_WAYLAND=1
|
||||
export BEMENU_BACKEND=wayland
|
||||
else
|
||||
export QT_QPA_PLATFORMTHEME="qt5ct"
|
||||
fi
|
||||
|
||||
export DOTNET_CLI_TELEMETRY_OPTOUT=1 # why do I always have to take care of this myself...
|
||||
|
||||
export ANDROID_HOME=$HOME/utils/Android/Sdk
|
||||
@ -34,3 +44,25 @@ export ANDROID_NDK_PATH=$ANDROID_HOME/ndk-bundle
|
||||
|
||||
export AndroidSdkPath=$ANDROID_HOME
|
||||
export AndroidNdkPath=$ANDROID_NDK_PATH
|
||||
|
||||
|
||||
if [[ -z $DISPLAY ]]; then
|
||||
export QT_QPA_PLATFORMTHEME=wayland
|
||||
export QT_QPA_PLATFORM=wayland
|
||||
export QT_AUTO_SCREEN_SCALE_FACTOR=0
|
||||
export MOZ_DBUS_REMOTE=1
|
||||
export MOZ_USE_XINPUT2=1
|
||||
export _JAVA_AWT_WM_NONREPARENTING=1
|
||||
export KITTY_ENABLE_WAYLAND=1
|
||||
export BEMENU_BACKEND=wayland
|
||||
export SDL_VIDEODRIVER=wayland
|
||||
export NO_AT_BRIDGE=1
|
||||
export TDESKTOP_USE_PORTAL=1
|
||||
|
||||
if [[ $(tty) == /dev/tty1 ]]; then
|
||||
export XDG_CURRENT_DESKTOP=sway
|
||||
exec sway
|
||||
elif [[ "$(tty)" == "/dev/tty2" ]] && ! ps -e | grep -qw sway
|
||||
MOZ_ENABLE_WAYLAND=1 QT_QPA_PLATFORM=wayland XDG_SESSION_TYPE=wayland exec dbus-run-session gnome-session
|
||||
fi
|
||||
fi
|
||||
|
82
zshrc
82
zshrc
@ -5,15 +5,14 @@
|
||||
source ~/.zplug/init.zsh
|
||||
zplug "denysdovhan/spaceship-prompt", use:spaceship.zsh, from:github, as:theme
|
||||
zplug "zsh-users/zsh-autosuggestions", defer:2
|
||||
#zplug "zsh-users/zsh-syntax-highlighting"
|
||||
zplug "zdharma/fast-syntax-highlighting", defer:2
|
||||
zplug "zsh-users/zsh-history-substring-search", defer:2
|
||||
zplug "plugins/git", from:oh-my-zsh, defer:2
|
||||
zplug "plugins/gitignore", from:oh-my-zsh, defer:2
|
||||
zplug "plugins/systemd", from:oh-my-zsh, defer:2
|
||||
zplug "plugins/dnf", from:oh-my-zsh, defer:2
|
||||
zplug "gradle/gradle-completion", from:github, defer:2
|
||||
# zplug "arzzen/calc.plugin.zsh", defer:2
|
||||
zplug "djui/alias-tips", defer:2
|
||||
zplug "zdharma/fast-syntax-highlighting", defer:2
|
||||
zplug 'zplug/zplug', hook-build:'zplug --self-manage'
|
||||
|
||||
# Install plugins if there are plugins that have not been installed
|
||||
@ -23,24 +22,16 @@
|
||||
echo; zplug install
|
||||
fi
|
||||
fi
|
||||
# zplug load
|
||||
source ~/.zplug/repos/zsh-users/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
#source ~/.zplug/repos/zsh-users/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||
source ~/.zplug/repos/zdharma/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
|
||||
source ~/.zplug/repos/zsh-users/zsh-history-substring-search/zsh-history-substring-search.zsh
|
||||
source ~/.zplug/repos/robbyrussell/oh-my-zsh/plugins/git/git.plugin.zsh
|
||||
source ~/.zplug/repos/robbyrussell/oh-my-zsh/plugins/gitignore/gitignore.plugin.zsh
|
||||
source ~/.zplug/repos/robbyrussell/oh-my-zsh/plugins/systemd/systemd.plugin.zsh
|
||||
source ~/.zplug/repos/robbyrussell/oh-my-zsh/plugins/dnf/dnf.plugin.zsh
|
||||
source ~/.zplug/repos/gradle/gradle-completion/gradle-completion.plugin.zsh
|
||||
#source ~/.zplug/repos/arzzen/calc.plugin.zsh/calc.plugin.zsh
|
||||
zplug load
|
||||
|
||||
ZSH_THEME="spaceship"
|
||||
SPACESHIP_PROMPT_ORDER=(time user dir host git package node ruby golang php rust haskell docker venv pyenv dotnet exec_time line_sep battery jobs exit_code char)
|
||||
SPACESHIP_PROMPT_ORDER=(time user dir host git hg package node ruby golang rust docker pyenv dotnet exec_time line_sep battery jobs exit_code char)
|
||||
SPACESHIP_PROMPT_ADD_NEWLINE=false
|
||||
SPACESHIP_PROMPT_SEPARATE_LINE=true
|
||||
|
||||
SPACESHIP_DIR_PREFIX=
|
||||
SPACESHIP_TIME_SHOW=true
|
||||
SPACESHIP_TIME_COLOR=white
|
||||
SPACESHIP_DIR_PREFIX="%F{green}▲ "
|
||||
SPACESHIP_DIR_COLOR=blue
|
||||
#SPACESHIP_DIR_TRUNC=3
|
||||
SPACESHIP_DIR_TRUNC_REPO=false
|
||||
@ -48,17 +39,19 @@
|
||||
SPACESHIP_HOST_PREFIX="@"
|
||||
SPACESHIP_HOST_COLOR=green
|
||||
SPACESHIP_GIT_BRANCH_COLOR=red
|
||||
SPACESHIP_GIT_STATUS_COLOR=yellow
|
||||
SPACESHIP_GIT_STATUS_COLOR=red
|
||||
SPACESHIP_GIT_STATUS_PREFIX=" "
|
||||
SPACESHIP_GIT_STATUS_SUFFIX=""
|
||||
SPACESHIP_GIT_STATUS_ADDED="%F{green}•%F{red}" # +
|
||||
SPACESHIP_GIT_STATUS_UNTRACKED="%F{blue}•%F{red}" # ?
|
||||
SPACESHIP_GIT_STATUS_DELETED="%F{red}•%F{red}" # x
|
||||
SPACESHIP_GIT_STATUS_MODIFIED="%F{yellow}•%F{green}" # !
|
||||
SPACESHIP_BATTERY_SHOW=true
|
||||
SPACESHIP_BATTERY_THRESHOLD=35
|
||||
#SPACESHIP_CHAR_SYMBOL=\>
|
||||
SPACESHIP_CHAR_COLOR_SUCCESS=green
|
||||
#SPACESHIP_CHAR_SUFFIX=""
|
||||
|
||||
# Path to your oh-my-zsh installation.
|
||||
export ZSH=$HOME/.oh-my-zsh
|
||||
#ZSH_THEME="myowntheme_with_time"
|
||||
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
|
||||
|
||||
# Uncomment the following line to use case-sensitive completion.
|
||||
# CASE_SENSITIVE="true"
|
||||
@ -109,11 +102,7 @@
|
||||
# Would you like to use another custom folder than $ZSH/custom?
|
||||
# ZSH_CUSTOM=/path/to/new-custom-folder
|
||||
|
||||
plugins=(safe-paste docker fzf)
|
||||
|
||||
source ~/.asdf/asdf.sh
|
||||
# append completions to fpath
|
||||
fpath=(${ASDF_DIR}/completions $fpath)
|
||||
plugins=(asdf safe-paste docker dotnet firewalld fzf golang terraform torrent vagrant )
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor)
|
||||
@ -121,6 +110,8 @@
|
||||
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
|
||||
ZSH_AUTOSUGGEST_USE_ASYNC=
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_CACHE=" "
|
||||
|
||||
# map Del escape sequence to actual Del key in all (n,i) modes to resemble vim instead of vi
|
||||
bindkey -a '^[[3~' delete-char
|
||||
# map arrow up/down to control fish-like history substring search and highlighting
|
||||
@ -132,35 +123,28 @@
|
||||
export FZF_COMPLETION_TRIGGER='~~'
|
||||
# Options to fzf command
|
||||
export FZF_COMPLETION_OPTS='+c -x'
|
||||
export FZF_DEFAULT_OPTS='--color fg:241,bg:235,hl:65,fg+:15,bg+:239,hl+:108 --color info:108,prompt:109,spinner:108,pointer:168,marker:168'
|
||||
export FZF_DEFAULT_COMMAND="fzf --preview 'head -100 {}'"
|
||||
|
||||
# User configuration
|
||||
_dotnet_zsh_complete(){
|
||||
local completions=("$(dotnet complete "$words")")
|
||||
reply=( "${(ps:\n:)completions}" )
|
||||
}
|
||||
compctl -K _dotnet_zsh_complete dotnet
|
||||
|
||||
source ~/.zprofile
|
||||
source ~/.dotenv
|
||||
export PATH="$HOME/.local/bin:$HOME/utils/bin:$HOME/.cargo/bin:$GOPATH/bin:$PATH"
|
||||
|
||||
# You may need to manually set your language environment
|
||||
export LANG=en_GB.UTF-8
|
||||
export http_proxy="http://localhost:8118"
|
||||
|
||||
if [ ! -S ~/.ssh/ssh_auth_sock ]; then
|
||||
if [ ! -S $HOME/.ssh/ssh_auth_sock ]; then
|
||||
eval `ssh-agent` > /dev/null
|
||||
ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock
|
||||
ln -sf "$SSH_AUTH_SOCK" $HOME/.ssh/ssh_auth_sock
|
||||
fi
|
||||
export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock
|
||||
export SSH_AUTH_SOCK=$HOME/.ssh/ssh_auth_sock
|
||||
|
||||
|
||||
export EDITOR='vim'
|
||||
export TERM='xterm-256color'
|
||||
# export ARCHFLAGS="-arch x86_64"
|
||||
export kee="surtur"
|
||||
export SSH_KEY_PATH="~/.ssh/$kee"
|
||||
export SSH_KEY_PATH="$HOME/.ssh/$kee"
|
||||
|
||||
eval $(TERM=xterm-256color dircolors)
|
||||
alias ls='exa -al --group-directories-first'
|
||||
@ -196,25 +180,6 @@
|
||||
alias urlencode='python2 -c "import urllib, sys; print urllib.quote_plus( sys.argv[1] if len(sys.argv) > 1 else sys.stdin.read()[0:-1], \"\")"'
|
||||
alias urldecode='python2 -c "import urllib, sys; print urllib.unquote_plus(sys.argv[1] if len(sys.argv) > 1 else sys.stdin.read()[0:-1])"'
|
||||
|
||||
export ANDROID_HOME=$HOME/utils/Android/Sdk
|
||||
export PATH=$PATH:$ANDROID_HOME/tools
|
||||
export PATH=$PATH:$ANDROID_HOME/platform-tools
|
||||
export ANDROID_SDK_ROOT=$ANDROID_HOME
|
||||
export ANDROID_SDK_PATH=$ANDROID_HOME
|
||||
export ANDROID_NDK_PATH=$ANDROID_HOME/ndk-bundle
|
||||
|
||||
export AndroidSdkPath=$ANDROID_HOME
|
||||
export AndroidNdkPath=$ANDROID_NDK_PATH
|
||||
|
||||
export WORKON_HOME=~/utils/venv
|
||||
#source utils/venv/bin/activate
|
||||
export PIP_VIRTUALENV_BASE=~/utils/venv
|
||||
|
||||
export DOTNET_CLI_TELEMETRY_OPTOUT=1 # why do I always have to take care of this myself...
|
||||
export MOZ_USE_XINPUT2=1
|
||||
export _JAVA_AWT_WM_NONREPARENTING=1
|
||||
|
||||
#bindkey -v # enabled ohmyzsh vi-mode - more customizable than the original
|
||||
|
||||
transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi;tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; }
|
||||
info() { printf "\n%s %s\n\n" "$( date )" "$*" >&2; }
|
||||
@ -239,6 +204,3 @@
|
||||
echo $FILE_URL
|
||||
}
|
||||
|
||||
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
|
||||
exec sway
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user