aboutsummaryrefslogtreecommitdiffstats
path: root/zsh/.config
diff options
context:
space:
mode:
authorPeter Son Struschka <me@peter-struschka.com>2020-08-30 20:56:36 +0800
committerPeter Son Struschka <me@peter-struschka.com>2020-08-30 20:58:04 +0800
commit37dd411698bd6eae8365260dde39b8ae9c7cbd36 (patch)
tree978dd6ea3e72a86e4a3e0314b86d5137fc394785 /zsh/.config
parenta1d6fc2f3e6ab041cc51cb085ac59a646a126d25 (diff)
downloaddotfiles-37dd411698bd6eae8365260dde39b8ae9c7cbd36.tar.gz
dotfiles-37dd411698bd6eae8365260dde39b8ae9c7cbd36.tar.bz2
dotfiles-37dd411698bd6eae8365260dde39b8ae9c7cbd36.tar.lz
dotfiles-37dd411698bd6eae8365260dde39b8ae9c7cbd36.tar.xz
dotfiles-37dd411698bd6eae8365260dde39b8ae9c7cbd36.tar.zst
dotfiles-37dd411698bd6eae8365260dde39b8ae9c7cbd36.zip
all: overhaul, move dotfile specifics to .local/share/dotfiles and more
Diffstat (limited to 'zsh/.config')
-rw-r--r--zsh/.config/zsh/.p10k.zsh4
-rw-r--r--zsh/.config/zsh/.zshrc117
-rw-r--r--zsh/.config/zsh/zsh_plugins.sh7
-rw-r--r--zsh/.config/zsh/zsh_plugins.txt34
4 files changed, 116 insertions, 46 deletions
diff --git a/zsh/.config/zsh/.p10k.zsh b/zsh/.config/zsh/.p10k.zsh
index 78fa142..32c113f 100644
--- a/zsh/.config/zsh/.p10k.zsh
+++ b/zsh/.config/zsh/.p10k.zsh
@@ -33,6 +33,7 @@
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
# =========================[ Line #1 ]=========================
os_icon # os identifier
+ context # user@hostname
dir # current directory
vcs # git status
# =========================[ Line #2 ]=========================
@@ -81,7 +82,6 @@
azure # azure account name (https://docs.microsoft.com/en-us/cli/azure)
gcloud # google cloud cli account and project (https://cloud.google.com/)
google_app_cred # google application credentials (https://cloud.google.com/docs/authentication/production)
- context # user@hostname
nordvpn # nordvpn connection status, linux only (https://nordvpn.com/)
ranger # ranger shell (https://github.com/ranger/ranger)
nnn # nnn shell (https://github.com/jarun/nnn)
@@ -1606,7 +1606,7 @@
# - always: Trim down prompt when accepting a command line.
# - same-dir: Trim down prompt when accepting a command line unless this is the first command
# typed after changing current working directory.
- typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=always
+ typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=off
# Instant prompt mode.
#
diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc
index e9ee24a..1bea1e6 100644
--- a/zsh/.config/zsh/.zshrc
+++ b/zsh/.config/zsh/.zshrc
@@ -1,3 +1,6 @@
+# start profile
+#zmodload zsh/zprof
+
autoload -U colors && colors # Load colors
setopt autocd # Automatically cd into typed directory.
stty stop undef # Disable ctrl-s to freeze terminal.
@@ -43,25 +46,11 @@ _comp_options+=(globdots)
autoload -U +X bashcompinit && bashcompinit
+source /usr/share/bash-completion/bash_completion 2> \dev\null
+
# Keys
bindkey -e
-
-# Dirstack
-autoload -Uz add-zsh-hook
-
-DIRSTACKFILE="$XDG_CACHE_HOME/zsh/dirs"
-if [[ -f "$DIRSTACKFILE" ]] && (( ${#dirstack} == 0 )); then
- dirstack=("${(@f)"$(< "$DIRSTACKFILE")"}")
- [[ -d "${dirstack[1]}" ]] && cd -- "${dirstack[1]}"
-fi
-chpwd_dirstack() {
- print -l -- "$PWD" "${(u)dirstack[@]}" > "$DIRSTACKFILE"
-}
-add-zsh-hook -Uz chpwd chpwd_dirstack
-
-DIRSTACKSIZE='20'
-
setopt AUTO_PUSHD PUSHD_SILENT PUSHD_TO_HOME
## Remove duplicate entries
@@ -102,10 +91,34 @@ autoload -U edit-command-line
zle -N edit-command-line
bindkey '\C-x\C-e' edit-command-line
-if type "kitty" > /dev/null; then
- # Completion for kitty
- kitty + complete setup zsh | source /dev/stdin
+#------------------------------
+# Window title
+#------------------------------
+autoload -Uz vcs_info
+zstyle ':vcs_info:*' enable git hg
+zstyle ':vcs_info:*' check-for-changes true
+case $TERM in
+ termite|*xterm*|rxvt|rxvt-unicode|rxvt-256color|rxvt-unicode-256color|(dt|k|E)term)
+ precmd () {
+ vcs_info
+ print -Pn "\e]0;[%n@%M][%~]%#\a"
+ }
+ preexec () { print -Pn "\e]0;[%n@%M][%~]%# ($1)\a" }
+ ;;
+ screen|screen-256color)
+ precmd () {
+ vcs_info
+ print -Pn "\e]83;title \"$1\"\a"
+ print -Pn "\e]0;$TERM - (%L) [%n@%M]%# [%~]\a"
+ }
+ preexec () {
+ print -Pn "\e]83;title \"$1\"\a"
+ print -Pn "\e]0;$TERM - (%L) [%n@%M]%# [%~] ($1)\a"
+ }
+ ;;
+esac
+if type "kitty" > /dev/null; then
alias kdiff="kitty +kitten diff"
alias kicat="kitty +kitten icat"
alias kunicode="kitty +kitten unicode_input"
@@ -114,17 +127,46 @@ if type "kitty" > /dev/null; then
alias kclip="kitty +kitten clipboard"
fi
-
if type "exa" > /dev/null; then
alias ls=exa
fi
+if type "deno" > /dev/null; then
+ deno completions zsh >| "$XDG_DATA_HOME/zsh/functions/_deno"
+ #deno_cache_dir="$XDG_CACHE_HOME/deno"
+ #deno_cache="$deno_cache_dir/deno_init-zsh"
+ #mkdir -p "$deno_cache_dir"
+ #if [ "$(command -v deno)" -nt "$deno_cache" -o ! -s "$deno_cache" ]; then
+ # deno completions zsh >| "$deno_cache"
+ #fi
+ #source "$deno_cache"
+ #unset deno_cache_dir
+ #unset deno_cache
+fi
+
+
if type "thefuck" > /dev/null; then
- eval $(thefuck --alias)
+ thefuck_cache_dir="$XDG_CACHE_HOME/thefuck"
+ thefuck_cache="$thefuck_cache_dir/thefuck_init-zsh"
+ mkdir -p "$thefuck_cache_dir"
+ if [ "$(command -v thefuck)" -nt "$thefuck_cache" -o ! -s "$thefuck_cache" ]; then
+ thefuck --alias >| "$thefuck_cache"
+ fi
+ source "$thefuck_cache"
+ unset thefuck_cache_dir
+ unset thefuck_cache
fi
if type "fasd" > /dev/null; then
- eval "$(fasd --init auto)"
+ fasd_cache_dir="$XDG_CACHE_HOME/fasd"
+ fasd_cache="$fasd_cache_dir/fasd_init-zsh"
+ mkdir -p "$fasd_cache_dir"
+ if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then
+ fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >| "$fasd_cache"
+ fi
+ source "$fasd_cache"
+ unset fasd_cache_dir
+ unset fasd_cache
fi
# fzf
@@ -140,11 +182,37 @@ export WORKON_HOME="$XDG_DATA_HOME/virtualenvs"
source /usr/share/doc/pkgfile/command-not-found.zsh
# Aliases
-alias ec="emacsclient -c"
+alias ec='emacsclient -c'
+alias grep='grep --color=auto'
+alias diff='diff --color=auto'
+alias ls='ls --color=auto'
+alias ip='ip -color=auto'
+
+export LESS=-R
+export LESS_TERMCAP_mb=$'\E[1;31m' # begin blink
+export LESS_TERMCAP_md=$'\E[1;36m' # begin bold
+export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink
+export LESS_TERMCAP_so=$'\E[01;44;33m' # begin reverse video
+export LESS_TERMCAP_se=$'\E[0m' # reset reverse video
+export LESS_TERMCAP_us=$'\E[1;32m' # begin underline
+export LESS_TERMCAP_ue=$'\E[0m' # reset underline
+[ -x /usr/bin/source-highlight-esc.sh ] &&
+ export LESSOPEN="| /usr/bin/source-highlight-esc.sh %s" &&
+ export LESS='-R '
+
# Source plugins
source "$XDG_CONFIG_HOME/zsh/zsh_plugins.sh"
+# plugin options
+ZSH_AUTOSUGGEST_STRATEGY=(history completion)
+ZSH_AUTOSUGGEST_USE_ASYNC=1
+
+bindkey '^[[A' history-substring-search-up
+bindkey '^[[B' history-substring-search-down
+bindkey -M emacs '^P' history-substring-search-up
+bindkey -M emacs '^N' history-substring-search-down
+
# Switch based on TERM
case "$TERM" in
"dumb")
@@ -157,3 +225,6 @@ case "$TERM" in
source <(antibody bundle romkatv/powerlevel10k)
[[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh
esac
+
+# finish and output profile
+#zprof
diff --git a/zsh/.config/zsh/zsh_plugins.sh b/zsh/.config/zsh/zsh_plugins.sh
index 4c7caa9..4b4b7b4 100644
--- a/zsh/.config/zsh/zsh_plugins.sh
+++ b/zsh/.config/zsh/zsh_plugins.sh
@@ -19,15 +19,14 @@ source /home/peter/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-ro
fpath+=( /home/peter/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/plugins/rsync )
source /home/peter/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/plugins/systemd/systemd.plugin.zsh
fpath+=( /home/peter/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/plugins/systemd )
-source /home/peter/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/plugins/thefuck/thefuck.plugin.zsh
-fpath+=( /home/peter/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/plugins/thefuck )
source /home/peter/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/plugins/tmux/tmux.plugin.zsh
fpath+=( /home/peter/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/plugins/tmux )
source /home/peter/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
fpath+=( /home/peter/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/plugins/virtualenvwrapper )
+source /home/peter/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-rupa-SLASH-z/z.sh
+fpath+=( /home/peter/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-rupa-SLASH-z )
source /home/peter/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
fpath+=( /home/peter/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-autosuggestions )
-source /home/peter/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-completions/zsh-completions.plugin.zsh
-fpath+=( /home/peter/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-completions )
+fpath+=( /home/peter/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-completions/src )
source /home/peter/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-history-substring-search/zsh-history-substring-search.plugin.zsh
fpath+=( /home/peter/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-zsh-users-SLASH-zsh-history-substring-search )
diff --git a/zsh/.config/zsh/zsh_plugins.txt b/zsh/.config/zsh/zsh_plugins.txt
index 696fda3..5c5440b 100644
--- a/zsh/.config/zsh/zsh_plugins.txt
+++ b/zsh/.config/zsh/zsh_plugins.txt
@@ -1,17 +1,17 @@
-zdharma/fast-syntax-highlighting
-robbyrussell/oh-my-zsh path:plugins/archlinux
-robbyrussell/oh-my-zsh path:plugins/colored-man-pages
-robbyrussell/oh-my-zsh path:plugins/command-not-found
-robbyrussell/oh-my-zsh path:plugins/docker
-robbyrussell/oh-my-zsh path:plugins/fzf
-robbyrussell/oh-my-zsh path:plugins/git
-robbyrussell/oh-my-zsh path:plugins/git-extras
-robbyrussell/oh-my-zsh path:plugins/pip
-robbyrussell/oh-my-zsh path:plugins/rsync
-robbyrussell/oh-my-zsh path:plugins/systemd
-robbyrussell/oh-my-zsh path:plugins/thefuck
-robbyrussell/oh-my-zsh path:plugins/tmux
-robbyrussell/oh-my-zsh path:plugins/virtualenvwrapper
-zsh-users/zsh-autosuggestions
-zsh-users/zsh-completions
-zsh-users/zsh-history-substring-search
+zdharma/fast-syntax-highlighting kind:zsh
+robbyrussell/oh-my-zsh path:plugins/archlinux kind:zsh
+robbyrussell/oh-my-zsh path:plugins/colored-man-pages kind:zsh
+robbyrussell/oh-my-zsh path:plugins/command-not-found kind:zsh
+robbyrussell/oh-my-zsh path:plugins/docker kind:zsh
+robbyrussell/oh-my-zsh path:plugins/fzf kind:zsh
+robbyrussell/oh-my-zsh path:plugins/git kind:zsh
+robbyrussell/oh-my-zsh path:plugins/git-extras kind:zsh
+robbyrussell/oh-my-zsh path:plugins/pip kind:zsh
+robbyrussell/oh-my-zsh path:plugins/rsync kind:zsh
+robbyrussell/oh-my-zsh path:plugins/systemd kind:zsh
+robbyrussell/oh-my-zsh path:plugins/tmux kind:zsh
+robbyrussell/oh-my-zsh path:plugins/virtualenvwrapper kind:zsh
+rupa/z kind:zsh
+zsh-users/zsh-autosuggestions kind:zsh
+zsh-users/zsh-completions path:src kind:fpath
+zsh-users/zsh-history-substring-search kind:zsh