aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Son Struschka <me@peter-struschka.com>2020-05-16 23:56:17 +0800
committerPeter Son Struschka <me@peter-struschka.com>2020-05-16 23:56:17 +0800
commitbc6e7acc104346beca4a4a39e4d1ba6cfdc8e88e (patch)
tree90a653557f2a88f518ca245ce28e9d26ff438388
parent9f7d41ac7c4716e73e3f848ccadb80be483d875b (diff)
downloaddotfiles-bc6e7acc104346beca4a4a39e4d1ba6cfdc8e88e.tar.gz
dotfiles-bc6e7acc104346beca4a4a39e4d1ba6cfdc8e88e.tar.bz2
dotfiles-bc6e7acc104346beca4a4a39e4d1ba6cfdc8e88e.tar.lz
dotfiles-bc6e7acc104346beca4a4a39e4d1ba6cfdc8e88e.tar.xz
dotfiles-bc6e7acc104346beca4a4a39e4d1ba6cfdc8e88e.tar.zst
dotfiles-bc6e7acc104346beca4a4a39e4d1ba6cfdc8e88e.zip
zsh: loading prompt after checking `$TERM`
-rwxr-xr-xzsh/.zprofile30
-rw-r--r--zsh/.zshrc58
2 files changed, 50 insertions, 38 deletions
diff --git a/zsh/.zprofile b/zsh/.zprofile
index 0980794..9850aae 100755
--- a/zsh/.zprofile
+++ b/zsh/.zprofile
@@ -20,43 +20,45 @@ export MTP_NO_PROBE="1"
export XDG_CONFIG_HOME="$HOME/.config"
-export PATH="$HOME/.local/bin:$PATH"
+[ -d "$HOME/.local/bin" ] && \
+ export PATH="$HOME/.local/bin:$PATH"
+[ -d "$HOME/.bin" ] && \
+ export PATH="$HOME/.bin:$PATH"
+[ -d "$HOME/bin" ] && \
+ export PATH="$HOME/bin:$PATH"
# Android SDK
if [ -d "$HOME/.local/share/android-sdk" ]; then
- export ANDROID_HOME="$HOME/.local/share/android-sdk"
- export PATH="$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools/bin:$PATH"
+ export ANDROID_HOME="$HOME/.local/share/android-sdk"
+ export PATH="$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools/bin:$PATH"
fi
-# bin
-export PATH="$HOME/.bin:$PATH"
-
# Go
if type "go" > /dev/null; then
- export PATH="$HOME/go/bin:$PATH"
- export GOPATH=$(go env GOPATH)
+ export PATH="$HOME/go/bin:$PATH"
+ export GOPATH=$(go env GOPATH)
fi
# Rust
if type "rustc" > /dev/null; then
- export PATH="$HOME/.cargo/bin:$PATH"
- export RUST_SRC_PATH="$(rustc --print sysroot)/lib/rustlib/src/rust/src"
+ export PATH="$HOME/.cargo/bin:$PATH"
+ export RUST_SRC_PATH="$(rustc --print sysroot)/lib/rustlib/src/rust/src"
fi
# Node
if type "npm" > /dev/null; then
- export PATH="$HOME/.node_modules/bin:$PATH"
- export npm_config_prefix=~/.node_modules
+ export PATH="$HOME/.node_modules/bin:$PATH"
+ export npm_config_prefix=~/.node_modules
fi
# Ruby
if type "ruby" > /dev/null; then
- export PATH="$PATH:$(ruby -e 'puts Gem.user_dir')/bin"
+ export PATH="$PATH:$(ruby -e 'puts Gem.user_dir')/bin"
fi
# fzf
if type "fzf" > /dev/null && type "rg" > /dev/null; then
- export FZF_DEFAULT_COMMAND="rg --hidden --follow --ignore-vcs --files --iglob '\!.git'"
+ export FZF_DEFAULT_COMMAND="rg --hidden --follow --ignore-vcs --files --iglob '\!.git'"
fi
# Aliases
diff --git a/zsh/.zshrc b/zsh/.zshrc
index 924de2a..4d53aad 100644
--- a/zsh/.zshrc
+++ b/zsh/.zshrc
@@ -17,6 +17,7 @@ zplug "plugins/thefuck", from:oh-my-zsh
zplug "plugins/tmux", from:oh-my-zsh
zplug "plugins/virtualenvwrapper", from:oh-my-zsh
zplug "plugins/zsh-navigation-tools", from:oh-my-zsh
+zplug "plugins/colored-man-pages", from:oh-my-zsh
zplug "zsh-users/zsh-syntax-highlighting"
zplug "zsh-users/zsh-autosuggestions"
@@ -37,14 +38,29 @@ POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status command_execution_time root_indicator
# zplug theme https://gist.github.com/pstruschka/c05686e6cf10e12471a3104e42e6366b.git agnoster_custom
-zplug romkatv/powerlevel10k, use:powerlevel10k.zsh-theme
+#[ "$TERM" = "linux" ] || zplug romkatv/powerlevel10k, use:powerlevel10k.zsh-theme
+case "$TERM" in
+ "linux") ;;
+ "dumb") export PS1="> ";;
+ *) zplug romkatv/powerlevel10k, use:powerlevel10k.zsh-theme
+esac
+
+if ! zplug check; then
+ printf "Install? [y/N]: "
+ if read -q; then
+ echo; zplug install
+ fi
+fi
+
+zplug load
fpath+=~/.zfunc
autoload -Uz compinit
compinit
-source $ZSH/oh-my-zsh.sh
+[ -z $ZSH ] || ( [ -e $ZSH/oh-my-zsh.sh ] && \
+ source $ZSH/oh-my-zsh.sh )
if [ "$TERM" = "linux" ]; then
_SEDCMD='s/.*\*color\([0-9]\{1,\}\).*#\([0-9a-fA-F]\{6\}\).*/\1 \2/p'
@@ -55,43 +71,37 @@ if [ "$TERM" = "linux" ]; then
fi
if type "kitty" > /dev/null; then
- # Completion for kitty
- kitty + complete setup zsh | source /dev/stdin
-
- alias kdiff="kitty +kitten diff"
- alias kicat="kitty +kitten icat"
- alias kunicode="kitty +kitten unicode_input"
- alias kpanel="kitty +kitten panel"
- alias khints="kitty +kitten hints"
- alias kclip="kitty +kitten clipboard"
+ # Completion for kitty
+ kitty + complete setup zsh | source /dev/stdin
+
+ alias kdiff="kitty +kitten diff"
+ alias kicat="kitty +kitten icat"
+ alias kunicode="kitty +kitten unicode_input"
+ alias kpanel="kitty +kitten panel"
+ alias khints="kitty +kitten hints"
+ alias kclip="kitty +kitten clipboard"
fi
if type "exa" > /dev/null; then
- alias ls=exa
+ alias ls=exa
fi
if type "thefuck" > /dev/null; then
- eval $(thefuck --alias)
+ eval $(thefuck --alias)
fi
if type "fasd" > /dev/null; then
- eval "$(fasd --init auto)"
+ eval "$(fasd --init auto)"
fi
# python virtualenvwrapper
export WORKON_HOME=~/.virtualenvs
-[[ -e /usr/bin/virtualenvwrapper_lazy.sh ]] && source /usr/bin/virtualenvwrapper_lazy.sh
+[[ -e /usr/bin/virtualenvwrapper_lazy.sh ]] && \
+ source /usr/bin/virtualenvwrapper_lazy.sh
alias ec="emacsclient -c"
-[[ -e /usr/share/doc/pkgfile/command-not-found.zsh ]] && source /usr/share/doc/pkgfile/command-not-found.zsh
+[[ -e /usr/share/doc/pkgfile/command-not-found.zsh ]] && \
+ source /usr/share/doc/pkgfile/command-not-found.zsh
-if ! zplug check; then
- printf "Install? [y/N]: "
- if read -q; then
- echo; zplug install
- fi
-fi
-
-zplug load