diff options
| author | Peter Son Struschka <me@peter-struschka.com> | 2020-08-30 20:56:36 +0800 |
|---|---|---|
| committer | Peter Son Struschka <me@peter-struschka.com> | 2020-08-30 20:58:04 +0800 |
| commit | 37dd411698bd6eae8365260dde39b8ae9c7cbd36 (patch) | |
| tree | 978dd6ea3e72a86e4a3e0314b86d5137fc394785 /zsh | |
| parent | a1d6fc2f3e6ab041cc51cb085ac59a646a126d25 (diff) | |
| download | dotfiles-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')
| -rw-r--r-- | zsh/.config/zsh/.p10k.zsh | 4 | ||||
| -rw-r--r-- | zsh/.config/zsh/.zshrc | 117 | ||||
| -rw-r--r-- | zsh/.config/zsh/zsh_plugins.sh | 7 | ||||
| -rw-r--r-- | zsh/.config/zsh/zsh_plugins.txt | 34 | ||||
| -rwxr-xr-x | zsh/.local/bin/sort_timings.zsh | 27 | ||||
| l--------- | zsh/.local/share/dotfiles/edit-config.d/zprofile | 1 | ||||
| l--------- | zsh/.local/share/dotfiles/edit-config.d/zsh_plugins.txt | 1 | ||||
| l--------- | zsh/.local/share/dotfiles/edit-config.d/zshenv | 1 | ||||
| l--------- | zsh/.local/share/dotfiles/edit-config.d/zshrc | 1 | ||||
| -rw-r--r-- | zsh/.local/share/zsh/functions/_deno | 489 | ||||
| -rw-r--r-- | zsh/.local/share/zsh/functions/start_zsh_profile | 13 | ||||
| -rw-r--r-- | zsh/.local/share/zsh/functions/stop_zsh_profile | 6 | ||||
| -rw-r--r-- | zsh/.zshenv | 39 |
13 files changed, 681 insertions, 59 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 diff --git a/zsh/.local/bin/sort_timings.zsh b/zsh/.local/bin/sort_timings.zsh new file mode 100755 index 0000000..93b00e0 --- /dev/null +++ b/zsh/.local/bin/sort_timings.zsh @@ -0,0 +1,27 @@ +#!/usr/bin/env zsh + +typeset -a lines +typeset -i prev_time=0 +typeset prev_command + +while read line; do + if [[ $line =~ '^.*\+([0-9]{10})\.([0-9]{6})[0-9]* (.+)' ]]; then + integer this_time=$match[1]$match[2] + + if [[ $prev_time -gt 0 ]]; then + time_difference=$(( $this_time - $prev_time )) + lines+="$time_difference $prev_command" + fi + + prev_time=$this_time + + local this_command=$match[3] + if [[ ${#this_command} -le 80 ]]; then + prev_command=$this_command + else + prev_command="${this_command:0:180}..." + fi + fi +done < ${1:-/dev/stdin} + +print -l ${(@On)lines} diff --git a/zsh/.local/share/dotfiles/edit-config.d/zprofile b/zsh/.local/share/dotfiles/edit-config.d/zprofile new file mode 120000 index 0000000..96b0aae --- /dev/null +++ b/zsh/.local/share/dotfiles/edit-config.d/zprofile @@ -0,0 +1 @@ +../../../../.config/zsh/.zprofile
\ No newline at end of file diff --git a/zsh/.local/share/dotfiles/edit-config.d/zsh_plugins.txt b/zsh/.local/share/dotfiles/edit-config.d/zsh_plugins.txt new file mode 120000 index 0000000..ec2c45e --- /dev/null +++ b/zsh/.local/share/dotfiles/edit-config.d/zsh_plugins.txt @@ -0,0 +1 @@ +../../../../.config/zsh/zsh_plugins.txt
\ No newline at end of file diff --git a/zsh/.local/share/dotfiles/edit-config.d/zshenv b/zsh/.local/share/dotfiles/edit-config.d/zshenv new file mode 120000 index 0000000..3a3f968 --- /dev/null +++ b/zsh/.local/share/dotfiles/edit-config.d/zshenv @@ -0,0 +1 @@ +../../../../.zshenv
\ No newline at end of file diff --git a/zsh/.local/share/dotfiles/edit-config.d/zshrc b/zsh/.local/share/dotfiles/edit-config.d/zshrc new file mode 120000 index 0000000..3190f08 --- /dev/null +++ b/zsh/.local/share/dotfiles/edit-config.d/zshrc @@ -0,0 +1 @@ +../../../../.config/zsh/.zshrc
\ No newline at end of file diff --git a/zsh/.local/share/zsh/functions/_deno b/zsh/.local/share/zsh/functions/_deno new file mode 100644 index 0000000..7a6a7b4 --- /dev/null +++ b/zsh/.local/share/zsh/functions/_deno @@ -0,0 +1,489 @@ +#compdef deno + +autoload -U is-at-least + +_deno() { + typeset -A opt_args + typeset -a _arguments_options + local ret=1 + + if is-at-least 5.2; then + _arguments_options=(-s -S -C) + else + _arguments_options=(-s -C) + fi + + local context curcontext="$curcontext" state line + _arguments "${_arguments_options[@]}" \ +'-L+[Set log level]: :(debug info)' \ +'--log-level=[Set log level]: :(debug info)' \ +'-q[Suppress diagnostic output]' \ +'--quiet[Suppress diagnostic output]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +":: :_deno_commands" \ +"*::: :->deno" \ +&& ret=0 + case $state in + (deno) + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:deno-command-$line[1]:" + case $line[1] in + (bundle) +_arguments "${_arguments_options[@]}" \ +'--lock=[Check the specified lock file]' \ +'--cert=[Load certificate authority from PEM encoded file]' \ +'-r+[Reload source code cache (recompile TypeScript)]' \ +'--reload=[Reload source code cache (recompile TypeScript)]' \ +'--importmap=[UNSTABLE: Load import map file]' \ +'-c+[Load tsconfig.json configuration file]' \ +'--config=[Load tsconfig.json configuration file]' \ +'-L+[Set log level]: :(debug info)' \ +'--log-level=[Set log level]: :(debug info)' \ +'--lock-write[Write lock file. Use with --lock.]' \ +'--unstable[Enable unstable APIs]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'-q[Suppress diagnostic output]' \ +'--quiet[Suppress diagnostic output]' \ +':source_file:_files' \ +'::out_file:_files' \ +&& ret=0 +;; +(cache) +_arguments "${_arguments_options[@]}" \ +'-r+[Reload source code cache (recompile TypeScript)]' \ +'--reload=[Reload source code cache (recompile TypeScript)]' \ +'--lock=[Check the specified lock file]' \ +'--importmap=[UNSTABLE: Load import map file]' \ +'-c+[Load tsconfig.json configuration file]' \ +'--config=[Load tsconfig.json configuration file]' \ +'--cert=[Load certificate authority from PEM encoded file]' \ +'-L+[Set log level]: :(debug info)' \ +'--log-level=[Set log level]: :(debug info)' \ +'--lock-write[Write lock file. Use with --lock.]' \ +'--unstable[Enable unstable APIs]' \ +'--no-check[Skip type checking modules]' \ +'--no-remote[Do not resolve remote modules]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'-q[Suppress diagnostic output]' \ +'--quiet[Suppress diagnostic output]' \ +':file:_files' \ +&& ret=0 +;; +(completions) +_arguments "${_arguments_options[@]}" \ +'-L+[Set log level]: :(debug info)' \ +'--log-level=[Set log level]: :(debug info)' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'-q[Suppress diagnostic output]' \ +'--quiet[Suppress diagnostic output]' \ +':shell:(zsh bash fish powershell elvish)' \ +&& ret=0 +;; +(doc) +_arguments "${_arguments_options[@]}" \ +'-r+[Reload source code cache (recompile TypeScript)]' \ +'--reload=[Reload source code cache (recompile TypeScript)]' \ +'-L+[Set log level]: :(debug info)' \ +'--log-level=[Set log level]: :(debug info)' \ +'--unstable[Enable unstable APIs]' \ +'--json[Output documentation in JSON format.]' \ +'--private[Output private documentation]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'-q[Suppress diagnostic output]' \ +'--quiet[Suppress diagnostic output]' \ +'::source_file:_files' \ +'::filter -- Dot separated path to symbol.:_files' \ +&& ret=0 +;; +(eval) +_arguments "${_arguments_options[@]}" \ +'--inspect=[activate inspector on host:port (default: 127.0.0.1:9229)]' \ +'--inspect-brk=[activate inspector on host:port and break at start of user script]' \ +'--cert=[Load certificate authority from PEM encoded file]' \ +'--v8-flags=[Set V8 command line options. For help: --v8-flags=--help]' \ +'-L+[Set log level]: :(debug info)' \ +'--log-level=[Set log level]: :(debug info)' \ +'--unstable[Enable unstable APIs]' \ +'-T[Treat eval input as TypeScript]' \ +'--ts[Treat eval input as TypeScript]' \ +'-p[print result to stdout]' \ +'--print[print result to stdout]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'-q[Suppress diagnostic output]' \ +'--quiet[Suppress diagnostic output]' \ +':code:_files' \ +&& ret=0 +;; +(fmt) +_arguments "${_arguments_options[@]}" \ +'--ignore=[Ignore formatting particular source files. Use with --unstable]' \ +'-L+[Set log level]: :(debug info)' \ +'--log-level=[Set log level]: :(debug info)' \ +'--check[Check if the source files are formatted.]' \ +'--unstable[Enable unstable APIs]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'-q[Suppress diagnostic output]' \ +'--quiet[Suppress diagnostic output]' \ +'::files:_files' \ +&& ret=0 +;; +(info) +_arguments "${_arguments_options[@]}" \ +'-r+[Reload source code cache (recompile TypeScript)]' \ +'--reload=[Reload source code cache (recompile TypeScript)]' \ +'--cert=[Load certificate authority from PEM encoded file]' \ +'-L+[Set log level]: :(debug info)' \ +'--log-level=[Set log level]: :(debug info)' \ +'--no-check[Skip type checking modules]' \ +'--unstable[Enable unstable APIs]' \ +'--json[Outputs the information in JSON format]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'-q[Suppress diagnostic output]' \ +'--quiet[Suppress diagnostic output]' \ +'::file:_files' \ +&& ret=0 +;; +(install) +_arguments "${_arguments_options[@]}" \ +'--allow-read=[Allow file system read access]' \ +'--allow-write=[Allow file system write access]' \ +'--allow-net=[Allow network access]' \ +'-n+[Executable file name]' \ +'--name=[Executable file name]' \ +'--root=[Installation root]' \ +'--cert=[Load certificate authority from PEM encoded file]' \ +'-c+[Load tsconfig.json configuration file]' \ +'--config=[Load tsconfig.json configuration file]' \ +'-L+[Set log level]: :(debug info)' \ +'--log-level=[Set log level]: :(debug info)' \ +'--allow-env[Allow environment access]' \ +'--allow-run[Allow running subprocesses]' \ +'--allow-plugin[Allow loading plugins]' \ +'--allow-hrtime[Allow high resolution time measurement]' \ +'-A[Allow all permissions]' \ +'--allow-all[Allow all permissions]' \ +'-f[Forcefully overwrite existing installation]' \ +'--force[Forcefully overwrite existing installation]' \ +'--no-check[Skip type checking modules]' \ +'--unstable[Enable unstable APIs]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'-q[Suppress diagnostic output]' \ +'--quiet[Suppress diagnostic output]' \ +':cmd:_files' \ +&& ret=0 +;; +(lint) +_arguments "${_arguments_options[@]}" \ +'--ignore=[Ignore linting particular source files.]' \ +'-L+[Set log level]: :(debug info)' \ +'--log-level=[Set log level]: :(debug info)' \ +'--unstable[Enable unstable APIs]' \ +'--rules[List available rules]' \ +'--json[Output lint result in JSON format.]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'-q[Suppress diagnostic output]' \ +'--quiet[Suppress diagnostic output]' \ +'::files:_files' \ +&& ret=0 +;; +(repl) +_arguments "${_arguments_options[@]}" \ +'--inspect=[activate inspector on host:port (default: 127.0.0.1:9229)]' \ +'--inspect-brk=[activate inspector on host:port and break at start of user script]' \ +'--v8-flags=[Set V8 command line options. For help: --v8-flags=--help]' \ +'--cert=[Load certificate authority from PEM encoded file]' \ +'-L+[Set log level]: :(debug info)' \ +'--log-level=[Set log level]: :(debug info)' \ +'--unstable[Enable unstable APIs]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'-q[Suppress diagnostic output]' \ +'--quiet[Suppress diagnostic output]' \ +&& ret=0 +;; +(run) +_arguments "${_arguments_options[@]}" \ +'--inspect=[activate inspector on host:port (default: 127.0.0.1:9229)]' \ +'--inspect-brk=[activate inspector on host:port and break at start of user script]' \ +'--allow-read=[Allow file system read access]' \ +'--allow-write=[Allow file system write access]' \ +'--allow-net=[Allow network access]' \ +'--importmap=[UNSTABLE: Load import map file]' \ +'-r+[Reload source code cache (recompile TypeScript)]' \ +'--reload=[Reload source code cache (recompile TypeScript)]' \ +'-c+[Load tsconfig.json configuration file]' \ +'--config=[Load tsconfig.json configuration file]' \ +'--lock=[Check the specified lock file]' \ +'--v8-flags=[Set V8 command line options. For help: --v8-flags=--help]' \ +'--cert=[Load certificate authority from PEM encoded file]' \ +'--seed=[Seed Math.random()]' \ +'-L+[Set log level]: :(debug info)' \ +'--log-level=[Set log level]: :(debug info)' \ +'--allow-env[Allow environment access]' \ +'--allow-run[Allow running subprocesses]' \ +'--allow-plugin[Allow loading plugins]' \ +'--allow-hrtime[Allow high resolution time measurement]' \ +'-A[Allow all permissions]' \ +'--allow-all[Allow all permissions]' \ +'--unstable[Enable unstable APIs]' \ +'--lock-write[Write lock file. Use with --lock.]' \ +'--no-check[Skip type checking modules]' \ +'--no-remote[Do not resolve remote modules]' \ +'--cached-only[Require that remote dependencies are already cached]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'-q[Suppress diagnostic output]' \ +'--quiet[Suppress diagnostic output]' \ +':script_arg -- script args:_files' \ +&& ret=0 +;; +(test) +_arguments "${_arguments_options[@]}" \ +'--inspect=[activate inspector on host:port (default: 127.0.0.1:9229)]' \ +'--inspect-brk=[activate inspector on host:port and break at start of user script]' \ +'--allow-read=[Allow file system read access]' \ +'--allow-write=[Allow file system write access]' \ +'--allow-net=[Allow network access]' \ +'--importmap=[UNSTABLE: Load import map file]' \ +'-r+[Reload source code cache (recompile TypeScript)]' \ +'--reload=[Reload source code cache (recompile TypeScript)]' \ +'-c+[Load tsconfig.json configuration file]' \ +'--config=[Load tsconfig.json configuration file]' \ +'--lock=[Check the specified lock file]' \ +'--v8-flags=[Set V8 command line options. For help: --v8-flags=--help]' \ +'--cert=[Load certificate authority from PEM encoded file]' \ +'--seed=[Seed Math.random()]' \ +'--filter=[Run tests with this string or pattern in the test name]' \ +'-L+[Set log level]: :(debug info)' \ +'--log-level=[Set log level]: :(debug info)' \ +'--allow-env[Allow environment access]' \ +'--allow-run[Allow running subprocesses]' \ +'--allow-plugin[Allow loading plugins]' \ +'--allow-hrtime[Allow high resolution time measurement]' \ +'-A[Allow all permissions]' \ +'--allow-all[Allow all permissions]' \ +'--unstable[Enable unstable APIs]' \ +'--lock-write[Write lock file. Use with --lock.]' \ +'--no-check[Skip type checking modules]' \ +'--no-remote[Do not resolve remote modules]' \ +'--cached-only[Require that remote dependencies are already cached]' \ +'--failfast[Stop on first error]' \ +'--allow-none[Don'\''t return error code if no test files are found]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'-q[Suppress diagnostic output]' \ +'--quiet[Suppress diagnostic output]' \ +'::files -- List of file names to run:_files' \ +&& ret=0 +;; +(types) +_arguments "${_arguments_options[@]}" \ +'-L+[Set log level]: :(debug info)' \ +'--log-level=[Set log level]: :(debug info)' \ +'--unstable[Enable unstable APIs]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'-q[Suppress diagnostic output]' \ +'--quiet[Suppress diagnostic output]' \ +&& ret=0 +;; +(upgrade) +_arguments "${_arguments_options[@]}" \ +'--version=[The version to upgrade to]' \ +'--output=[The path to output the updated version to]' \ +'--cert=[Load certificate authority from PEM encoded file]' \ +'-L+[Set log level]: :(debug info)' \ +'--log-level=[Set log level]: :(debug info)' \ +'--dry-run[Perform all checks without replacing old exe]' \ +'-f[Replace current exe even if not out-of-date]' \ +'--force[Replace current exe even if not out-of-date]' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-q[Suppress diagnostic output]' \ +'--quiet[Suppress diagnostic output]' \ +&& ret=0 +;; +(help) +_arguments "${_arguments_options[@]}" \ +'-L+[Set log level]: :(debug info)' \ +'--log-level=[Set log level]: :(debug info)' \ +'-h[Prints help information]' \ +'--help[Prints help information]' \ +'-V[Prints version information]' \ +'--version[Prints version information]' \ +'-q[Suppress diagnostic output]' \ +'--quiet[Suppress diagnostic output]' \ +&& ret=0 +;; + esac + ;; +esac +} + +(( $+functions[_deno_commands] )) || +_deno_commands() { + local commands; commands=( + "bundle:Bundle module and dependencies into single file" \ +"cache:Cache the dependencies" \ +"completions:Generate shell completions" \ +"doc:Show documentation for a module" \ +"eval:Eval script" \ +"fmt:Format source files" \ +"info:Show info about cache or info related to source file" \ +"install:Install script as an executable" \ +"lint:Lint source files" \ +"repl:Read Eval Print Loop" \ +"run:Run a program given a filename or url to the module. Use '-' as a filename to read from stdin." \ +"test:Run tests" \ +"types:Print runtime TypeScript declarations" \ +"upgrade:Upgrade deno executable to given version" \ +"help:Prints this message or the help of the given subcommand(s)" \ + ) + _describe -t commands 'deno commands' commands "$@" +} +(( $+functions[_deno__bundle_commands] )) || +_deno__bundle_commands() { + local commands; commands=( + + ) + _describe -t commands 'deno bundle commands' commands "$@" +} +(( $+functions[_deno__cache_commands] )) || +_deno__cache_commands() { + local commands; commands=( + + ) + _describe -t commands 'deno cache commands' commands "$@" +} +(( $+functions[_deno__completions_commands] )) || +_deno__completions_commands() { + local commands; commands=( + + ) + _describe -t commands 'deno completions commands' commands "$@" +} +(( $+functions[_deno__doc_commands] )) || +_deno__doc_commands() { + local commands; commands=( + + ) + _describe -t commands 'deno doc commands' commands "$@" +} +(( $+functions[_deno__eval_commands] )) || +_deno__eval_commands() { + local commands; commands=( + + ) + _describe -t commands 'deno eval commands' commands "$@" +} +(( $+functions[_deno__fmt_commands] )) || +_deno__fmt_commands() { + local commands; commands=( + + ) + _describe -t commands 'deno fmt commands' commands "$@" +} +(( $+functions[_deno__help_commands] )) || +_deno__help_commands() { + local commands; commands=( + + ) + _describe -t commands 'deno help commands' commands "$@" +} +(( $+functions[_deno__info_commands] )) || +_deno__info_commands() { + local commands; commands=( + + ) + _describe -t commands 'deno info commands' commands "$@" +} +(( $+functions[_deno__install_commands] )) || +_deno__install_commands() { + local commands; commands=( + + ) + _describe -t commands 'deno install commands' commands "$@" +} +(( $+functions[_deno__lint_commands] )) || +_deno__lint_commands() { + local commands; commands=( + + ) + _describe -t commands 'deno lint commands' commands "$@" +} +(( $+functions[_deno__repl_commands] )) || +_deno__repl_commands() { + local commands; commands=( + + ) + _describe -t commands 'deno repl commands' commands "$@" +} +(( $+functions[_deno__run_commands] )) || +_deno__run_commands() { + local commands; commands=( + + ) + _describe -t commands 'deno run commands' commands "$@" +} +(( $+functions[_deno__test_commands] )) || +_deno__test_commands() { + local commands; commands=( + + ) + _describe -t commands 'deno test commands' commands "$@" +} +(( $+functions[_deno__types_commands] )) || +_deno__types_commands() { + local commands; commands=( + + ) + _describe -t commands 'deno types commands' commands "$@" +} +(( $+functions[_deno__upgrade_commands] )) || +_deno__upgrade_commands() { + local commands; commands=( + + ) + _describe -t commands 'deno upgrade commands' commands "$@" +} + +_deno "$@"
\ No newline at end of file diff --git a/zsh/.local/share/zsh/functions/start_zsh_profile b/zsh/.local/share/zsh/functions/start_zsh_profile new file mode 100644 index 0000000..5a81968 --- /dev/null +++ b/zsh/.local/share/zsh/functions/start_zsh_profile @@ -0,0 +1,13 @@ +# -*- mode: conf-space;-*- +# vim: syntax=zsh + +zmodload zsh/datetime +setopt PROMPT_SUBST +PS4='+$EPOCHREALTIME %N:%i> ' + +logfile=$(mktemp zsh_profile.XXXXXXXX) +echo "Logging to $logfile" +exec 3>&2 2>$logfile + +setopt XTRACE + diff --git a/zsh/.local/share/zsh/functions/stop_zsh_profile b/zsh/.local/share/zsh/functions/stop_zsh_profile new file mode 100644 index 0000000..8f91716 --- /dev/null +++ b/zsh/.local/share/zsh/functions/stop_zsh_profile @@ -0,0 +1,6 @@ +# -*- mode: conf-space;-*- +# vim: syntax=zsh + +unsetopt XTRACE +exec 2>&3 3>&- + diff --git a/zsh/.zshenv b/zsh/.zshenv index ca10a3f..8b585a9 100644 --- a/zsh/.zshenv +++ b/zsh/.zshenv @@ -1,7 +1,14 @@ -export EDITOR="nvim" +export PAGER="/usr/bin/less" +export EDITOR="/usr/bin/nvim" +export VISUAL="/usr/bin/nvim" +export TERMINAL="/usr/bin/alacritty" +export BROWSER="/usr/bin/firefox-developer-edition" export DEFAULT_USER=peter +export SSH_ASKPASS="$HOME/.local/bin/dmenu_pass" +export SUDO_ASKPASS="$HOME/.local/bin/dmenu_pass" + export XDG_CONFIG_HOME="$HOME/.config" export XDG_CACHE_HOME="$HOME/.cache" @@ -9,16 +16,17 @@ export XDG_DATA_HOME="$HOME/.local/share" export ZDOTDIR="$XDG_CONFIG_HOME/zsh" -extra_paths="" +typeset -U PATH path +path=("$path[@]") # RUST XDG_DIR export RUSTUP_HOME="$XDG_DATA_HOME/rustup" export CARGO_HOME="$XDG_DATA_HOME/cargo" -extra_paths="$CARGO_HOME/bin" +path=("$CARGO_HOME/bin" "$path[@]") # GOPATH export GOPATH="$XDG_DATA_HOME/go" -extra_paths="$extra_paths:$GOPATH/bin" +path=("$GOPATH/bin" "$path[@]") # Ruby export GEM_HOME="$XDG_DATA_HOME/gem" @@ -26,13 +34,13 @@ export GEM_SPEC_CACHE="$XDG_CACHE_HOME/gem" export BUNDLE_USER_CONFIG="$XDG_CONFIG_HOME/bundle" export BUNDLE_USER_CACHE="$XDG_CACHE_HOME/bundle" export BUNDLE_USER_PLUGIN="$XDG_DATA_HOME/bundle" -extra_paths="$extra_paths:$GEM_HOME/bin" +path=("$GEM_HOME/bin" "$path[@]") # Node & NPM export NODE_REPL_HISTORY="$XDG_DATA_HOME/node_repl_history" export npm_config_prefix="$XDG_DATA_HOME/node" export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc" -extra_paths="$extra_paths:$npm_config_prefix/bin" +path=("$npm_config_prefix/bin" "$path[@]") # Docker export DOCKER_CONFIG="$XDG_CONFIG_HOME/docker" @@ -54,11 +62,16 @@ export PYLINTHOME="$XDG_CACHE_HOME/pylint" export WINEPREFIX="$XDG_DATA_HOME/wineprefixes/default" export WGETRC="$XDG_CONFIG_HOME/wget/wgetrc" -[ -d "$HOME/bin" ] && \ - PATH="$HOME/bin:$PATH" -[ -d "$HOME/.bin" ] && \ - PATH="$HOME/.bin:$PATH" -[ -d "$HOME/.local/bin" ] && \ - PATH="$HOME/.local/bin:$PATH" -export PATH="$extra_paths:$PATH" +#[ -d "$HOME/bin" ] && \ +# path=("$HOME/bin" "$path[@]") +#[ -d "$HOME/.bin" ] && \ +# path=("$HOME/.bin" "$path[@]") +#[ -d "$HOME/.local/bin" ] && \ +# path=("$HOME/.local/bin" "$path[@]") +for dir in ~/bin ~/.bin ~/.local/bin; do + if [[ -d "${dir}" ]]; then + path=($dir $path) + fi +done +export PATH |
