aboutsummaryrefslogtreecommitdiffstats
path: root/zsh
diff options
context:
space:
mode:
authorPeter Son Struschka <me@peter-struschka.com>2021-06-12 23:35:05 +0800
committerPeter Son Struschka <me@peter-struschka.com>2021-06-12 23:35:05 +0800
commit4d63577b487a8bf877401312f22142094e2d4584 (patch)
treea35596a5ccda6537b05da0a04a775a85bdc25b06 /zsh
parenta99b14adcece0b4f42849b5ba229a49d1b17c50d (diff)
downloaddotfiles-4d63577b487a8bf877401312f22142094e2d4584.tar.gz
dotfiles-4d63577b487a8bf877401312f22142094e2d4584.tar.bz2
dotfiles-4d63577b487a8bf877401312f22142094e2d4584.tar.lz
dotfiles-4d63577b487a8bf877401312f22142094e2d4584.tar.xz
dotfiles-4d63577b487a8bf877401312f22142094e2d4584.tar.zst
dotfiles-4d63577b487a8bf877401312f22142094e2d4584.zip
all: zsh prompt update, general script updates
Diffstat (limited to 'zsh')
-rw-r--r--zsh/.config/starship.toml18
-rw-r--r--zsh/.config/zsh/.zshrc46
-rw-r--r--zsh/.local/share/zsh/functions/_deno111
-rw-r--r--zsh/.zshenv3
4 files changed, 118 insertions, 60 deletions
diff --git a/zsh/.config/starship.toml b/zsh/.config/starship.toml
new file mode 100644
index 0000000..2e9eb81
--- /dev/null
+++ b/zsh/.config/starship.toml
@@ -0,0 +1,18 @@
+add_newline = true
+
+[cmd_duration]
+show_milliseconds = true
+
+[directory]
+truncate_to_repo = true
+
+[git_status]
+all_status = '$conflicted$stashed$deleted$renamed$staged$modified$untracked'
+staged = '[+$count](green)'
+modified = '[!$count](yellow)'
+untracked = '[?$count](red)'
+format = '([\[$conflicted$stashed$deleted$renamed$staged$modified$untracked$ahead_behind\]]($style) )'
+
+[status]
+format = '[$symbol$maybe_int]($style)'
+disabled = false
diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc
index d2806f0..7e8c92a 100644
--- a/zsh/.config/zsh/.zshrc
+++ b/zsh/.config/zsh/.zshrc
@@ -97,26 +97,26 @@ bindkey '\C-x\C-e' edit-command-line
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
+autoload -Uz add-zsh-hook
+
+function xterm_title_precmd() {
+ vcs_info
+ print -Pn "\e]0;[%n@%M][%~]%#\a"
+ [[ "$TERM" == 'screen'* ]] &&
+ print -Pn "\e]83;title " && print -n -- "\"${(q)1}\"\a" &&
+ print -Pn "\e]0;$TERM - (%L) [%n@%M]%#[%~]\a"
+}
+
+function xterm_title_preexec() {
+ print -Pn -- '\e]2;[%n@%M][%~]%# ' && print -n -- "(${(q)1})\a"
+ [[ "$TERM" == 'screen'* ]] &&
+ print -Pn "\e]83;title " && print -n -- "\"${(q)1}\"\a" &&
+ print -Pn "\e]0;$TERM - (%L) [%n@%M]%#[%~] " && print -n -- "(${(q)1})\a"
+}
+if [[ "$TERM" == (alacritty*|gnome*|konsole*|putty*|rxvt*|screen*|tmux*|xterm*|(dt|k|E)term*) ]]; then
+ add-zsh-hook -Uz precmd xterm_title_precmd
+ add-zsh-hook -Uz preexec xterm_title_preexec
+fi
if type "kitty" > /dev/null; then
alias kdiff="kitty +kitten diff"
@@ -176,6 +176,7 @@ source /usr/share/fzf/key-bindings.zsh
export WORKON_HOME="$XDG_DATA_HOME/virtualenvs"
[[ -e /usr/bin/virtualenvwrapper_lazy.sh ]] && \
source /usr/bin/virtualenvwrapper_lazy.sh
+export PYENV_ROOT="$XDG_DATA_HOME/pyenv"
[[ -e /usr/share/doc/pkgfile/command-not-found.zsh ]] && \
source /usr/share/doc/pkgfile/command-not-found.zsh
@@ -221,8 +222,9 @@ case "$TERM" in
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
return;;
*)
- source <(antibody bundle romkatv/powerlevel10k)
- [[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh
+ #source <(antibody bundle romkatv/powerlevel10k)
+ #[[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh
+ eval "$(starship init zsh)"
esac
# finish and output profile
diff --git a/zsh/.local/share/zsh/functions/_deno b/zsh/.local/share/zsh/functions/_deno
index 3bef4ba..11c023c 100644
--- a/zsh/.local/share/zsh/functions/_deno
+++ b/zsh/.local/share/zsh/functions/_deno
@@ -35,7 +35,7 @@ _deno() {
case $line[1] in
(bundle)
_arguments "${_arguments_options[@]}" \
-'--import-map=[UNSTABLE: Load import map file]' \
+'--import-map=[Load import map file]' \
'-c+[Load tsconfig.json configuration file]' \
'--config=[Load tsconfig.json configuration file]' \
'-r+[Reload source code cache (recompile TypeScript)]' \
@@ -47,7 +47,7 @@ _arguments "${_arguments_options[@]}" \
'--no-remote[Do not resolve remote modules]' \
'--no-check[Skip type checking modules]' \
'--lock-write[Write lock file (use with --lock)]' \
-'--watch[Watch for file changes and restart process automatically]' \
+'--watch[UNSTABLE: Watch for file changes and restart process automatically]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
@@ -61,7 +61,7 @@ _arguments "${_arguments_options[@]}" \
;;
(cache)
_arguments "${_arguments_options[@]}" \
-'--import-map=[UNSTABLE: Load import map file]' \
+'--import-map=[Load import map file]' \
'-c+[Load tsconfig.json configuration file]' \
'--config=[Load tsconfig.json configuration file]' \
'-r+[Reload source code cache (recompile TypeScript)]' \
@@ -85,7 +85,7 @@ _arguments "${_arguments_options[@]}" \
;;
(compile)
_arguments "${_arguments_options[@]}" \
-'--import-map=[UNSTABLE: Load import map file]' \
+'--import-map=[Load import map file]' \
'-c+[Load tsconfig.json configuration file]' \
'--config=[Load tsconfig.json configuration file]' \
'-r+[Reload source code cache (recompile TypeScript)]' \
@@ -95,6 +95,8 @@ _arguments "${_arguments_options[@]}" \
'--allow-read=[Allow file system read access]' \
'--allow-write=[Allow file system write access]' \
'--allow-net=[Allow network access]' \
+'--allow-env=[Allow environment access]' \
+'--allow-run=[Allow running subprocesses]' \
'--location=[Value of '\''globalThis.location'\'' used by some web APIs]' \
'--v8-flags=[Set V8 command line options (for help: --v8-flags=--help)]' \
'--seed=[Seed Math.random()]' \
@@ -106,14 +108,12 @@ _arguments "${_arguments_options[@]}" \
'--no-remote[Do not resolve remote modules]' \
'--no-check[Skip type checking modules]' \
'--lock-write[Write lock file (use with --lock)]' \
-'--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]' \
+'--prompt[Fallback to prompt if required permission wasn'\''t passed]' \
'--cached-only[Require that remote dependencies are already cached]' \
-'--lite[Use lite runtime]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
@@ -138,9 +138,27 @@ _arguments "${_arguments_options[@]}" \
':shell:(zsh bash fish powershell elvish)' \
&& ret=0
;;
+(coverage)
+_arguments "${_arguments_options[@]}" \
+'--ignore=[Ignore coverage files]' \
+'*--include=[Include source files in the report]' \
+'*--exclude=[Exclude source files from the report]' \
+'-L+[Set log level]: :(debug info)' \
+'--log-level=[Set log level]: :(debug info)' \
+'--lcov[Output coverage report in lcov format]' \
+'-h[Prints help information]' \
+'--help[Prints help information]' \
+'-V[Prints version information]' \
+'--version[Prints version information]' \
+'--unstable[Enable unstable features and APIs]' \
+'-q[Suppress diagnostic output]' \
+'--quiet[Suppress diagnostic output]' \
+':files:_files' \
+&& ret=0
+;;
(doc)
_arguments "${_arguments_options[@]}" \
-'--import-map=[UNSTABLE: Load import map file]' \
+'--import-map=[Load import map file]' \
'-r+[Reload source code cache (recompile TypeScript)]' \
'--reload=[Reload source code cache (recompile TypeScript)]' \
'-L+[Set log level]: :(debug info)' \
@@ -160,18 +178,19 @@ _arguments "${_arguments_options[@]}" \
;;
(eval)
_arguments "${_arguments_options[@]}" \
-'--import-map=[UNSTABLE: Load import map file]' \
+'--import-map=[Load import map file]' \
'-c+[Load tsconfig.json configuration file]' \
'--config=[Load tsconfig.json configuration file]' \
'-r+[Reload source code cache (recompile TypeScript)]' \
'--reload=[Reload source code cache (recompile TypeScript)]' \
'--lock=[Check the specified lock file]' \
'--cert=[Load certificate authority from PEM encoded file]' \
-'--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]' \
+'--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]' \
'--location=[Value of '\''globalThis.location'\'' used by some web APIs]' \
'--v8-flags=[Set V8 command line options (for help: --v8-flags=--help)]' \
'--seed=[Seed Math.random()]' \
+'--ext=[Set standard input (stdin) content type]: :(ts tsx js jsx)' \
'-L+[Set log level]: :(debug info)' \
'--log-level=[Set log level]: :(debug info)' \
'--no-remote[Do not resolve remote modules]' \
@@ -194,12 +213,12 @@ _arguments "${_arguments_options[@]}" \
;;
(fmt)
_arguments "${_arguments_options[@]}" \
-'--ext=[Set standard input (stdin) content type]: :(ts tsx js jsx md)' \
-'--ignore=[Ignore formatting particular source files. Use with --unstable]' \
+'--ext=[Set standard input (stdin) content type]: :(ts tsx js jsx md json jsonc)' \
+'--ignore=[Ignore formatting particular source files]' \
'-L+[Set log level]: :(debug info)' \
'--log-level=[Set log level]: :(debug info)' \
'--check[Check if the source files are formatted]' \
-'--watch[Watch for file changes and restart process automatically]' \
+'--watch[UNSTABLE: Watch for file changes and restart process automatically]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
@@ -215,11 +234,12 @@ _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]' \
-'--import-map=[UNSTABLE: Load import map file]' \
+'--location=[Show files used for origin bound APIs like the Web Storage API when running a script with '\''--location=<HREF>'\'']' \
+'--import-map=[Load import map file]' \
'-L+[Set log level]: :(debug info)' \
'--log-level=[Set log level]: :(debug info)' \
'--no-check[Skip type checking modules]' \
-'--json[Outputs the information in JSON format]' \
+'--json[UNSTABLE: Outputs the information in JSON format]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
@@ -232,7 +252,7 @@ _arguments "${_arguments_options[@]}" \
;;
(install)
_arguments "${_arguments_options[@]}" \
-'--import-map=[UNSTABLE: Load import map file]' \
+'--import-map=[Load import map file]' \
'-c+[Load tsconfig.json configuration file]' \
'--config=[Load tsconfig.json configuration file]' \
'-r+[Reload source code cache (recompile TypeScript)]' \
@@ -242,8 +262,10 @@ _arguments "${_arguments_options[@]}" \
'--allow-read=[Allow file system read access]' \
'--allow-write=[Allow file system write access]' \
'--allow-net=[Allow network access]' \
-'--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-env=[Allow environment access]' \
+'--allow-run=[Allow running subprocesses]' \
+'--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]' \
'--location=[Value of '\''globalThis.location'\'' used by some web APIs]' \
'--v8-flags=[Set V8 command line options (for help: --v8-flags=--help)]' \
'--seed=[Seed Math.random()]' \
@@ -255,12 +277,11 @@ _arguments "${_arguments_options[@]}" \
'--no-remote[Do not resolve remote modules]' \
'--no-check[Skip type checking modules]' \
'--lock-write[Write lock file (use with --lock)]' \
-'--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]' \
+'--prompt[Fallback to prompt if required permission wasn'\''t passed]' \
'--cached-only[Require that remote dependencies are already cached]' \
'-f[Forcefully overwrite existing installation]' \
'--force[Forcefully overwrite existing installation]' \
@@ -306,15 +327,15 @@ _arguments "${_arguments_options[@]}" \
;;
(repl)
_arguments "${_arguments_options[@]}" \
-'--import-map=[UNSTABLE: Load import map file]' \
+'--import-map=[Load import map file]' \
'-c+[Load tsconfig.json configuration file]' \
'--config=[Load tsconfig.json configuration file]' \
'-r+[Reload source code cache (recompile TypeScript)]' \
'--reload=[Reload source code cache (recompile TypeScript)]' \
'--lock=[Check the specified lock file]' \
'--cert=[Load certificate authority from PEM encoded file]' \
-'--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]' \
+'--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]' \
'--location=[Value of '\''globalThis.location'\'' used by some web APIs]' \
'--v8-flags=[Set V8 command line options (for help: --v8-flags=--help)]' \
'--seed=[Seed Math.random()]' \
@@ -335,7 +356,7 @@ _arguments "${_arguments_options[@]}" \
;;
(run)
_arguments "${_arguments_options[@]}" \
-'--import-map=[UNSTABLE: Load import map file]' \
+'--import-map=[Load import map file]' \
'-c+[Load tsconfig.json configuration file]' \
'--config=[Load tsconfig.json configuration file]' \
'-r+[Reload source code cache (recompile TypeScript)]' \
@@ -345,8 +366,10 @@ _arguments "${_arguments_options[@]}" \
'--allow-read=[Allow file system read access]' \
'--allow-write=[Allow file system write access]' \
'--allow-net=[Allow network access]' \
-'--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-env=[Allow environment access]' \
+'--allow-run=[Allow running subprocesses]' \
+'--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]' \
'--location=[Value of '\''globalThis.location'\'' used by some web APIs]' \
'--v8-flags=[Set V8 command line options (for help: --v8-flags=--help)]' \
'--seed=[Seed Math.random()]' \
@@ -355,14 +378,13 @@ _arguments "${_arguments_options[@]}" \
'--no-remote[Do not resolve remote modules]' \
'--no-check[Skip type checking modules]' \
'--lock-write[Write lock file (use with --lock)]' \
-'--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]' \
+'--prompt[Fallback to prompt if required permission wasn'\''t passed]' \
'--cached-only[Require that remote dependencies are already cached]' \
-'(--inspect --inspect-brk)--watch[Watch for file changes and restart process automatically]' \
+'(--inspect --inspect-brk)--watch[UNSTABLE: Watch for file changes and restart process automatically]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
@@ -375,7 +397,7 @@ _arguments "${_arguments_options[@]}" \
;;
(test)
_arguments "${_arguments_options[@]}" \
-'--import-map=[UNSTABLE: Load import map file]' \
+'--import-map=[Load import map file]' \
'-c+[Load tsconfig.json configuration file]' \
'--config=[Load tsconfig.json configuration file]' \
'-r+[Reload source code cache (recompile TypeScript)]' \
@@ -385,28 +407,33 @@ _arguments "${_arguments_options[@]}" \
'--allow-read=[Allow file system read access]' \
'--allow-write=[Allow file system write access]' \
'--allow-net=[Allow network access]' \
-'--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-env=[Allow environment access]' \
+'--allow-run=[Allow running subprocesses]' \
+'--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]' \
'--location=[Value of '\''globalThis.location'\'' used by some web APIs]' \
'--v8-flags=[Set V8 command line options (for help: --v8-flags=--help)]' \
'--seed=[Seed Math.random()]' \
'--filter=[Run tests with this string or pattern in the test name]' \
-'(--inspect --inspect-brk)--coverage=[Collect coverage information]' \
+'(--inspect --inspect-brk)--coverage=[UNSTABLE: Collect coverage profile data]' \
+'-j+[]' \
+'--jobs=[]' \
'-L+[Set log level]: :(debug info)' \
'--log-level=[Set log level]: :(debug info)' \
'--no-remote[Do not resolve remote modules]' \
'--no-check[Skip type checking modules]' \
'--lock-write[Write lock file (use with --lock)]' \
-'--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]' \
+'--prompt[Fallback to prompt if required permission wasn'\''t passed]' \
'--cached-only[Require that remote dependencies are already cached]' \
'--no-run[Cache test modules, but don'\''t run tests]' \
+'--doc[UNSTABLE: type check code blocks]' \
'--fail-fast[Stop on first error]' \
'--allow-none[Don'\''t return error code if no test files are found]' \
+'(--no-run --coverage)--watch[UNSTABLE: Watch for file changes and restart process automatically]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
@@ -472,8 +499,9 @@ _deno_commands() {
local commands; commands=(
"bundle:Bundle module and dependencies into single file" \
"cache:Cache the dependencies" \
-"compile:Compile the script into a self contained executable" \
+"compile:UNSTABLE: Compile the script into a self contained executable" \
"completions:Generate shell completions" \
+"coverage:Print coverage reports" \
"doc:Show documentation for a module" \
"eval:Eval script" \
"fmt:Format source files" \
@@ -482,7 +510,7 @@ _deno_commands() {
"lsp:Start the language server" \
"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." \
+"run:Run a JavaScript or TypeScript program" \
"test:Run tests" \
"types:Print runtime TypeScript declarations" \
"upgrade:Upgrade deno executable to given version" \
@@ -518,6 +546,13 @@ _deno__completions_commands() {
)
_describe -t commands 'deno completions commands' commands "$@"
}
+(( $+functions[_deno__coverage_commands] )) ||
+_deno__coverage_commands() {
+ local commands; commands=(
+
+ )
+ _describe -t commands 'deno coverage commands' commands "$@"
+}
(( $+functions[_deno__doc_commands] )) ||
_deno__doc_commands() {
local commands; commands=(
diff --git a/zsh/.zshenv b/zsh/.zshenv
index 8b585a9..4f1727d 100644
--- a/zsh/.zshenv
+++ b/zsh/.zshenv
@@ -46,6 +46,9 @@ path=("$npm_config_prefix/bin" "$path[@]")
export DOCKER_CONFIG="$XDG_CONFIG_HOME/docker"
export MACHINE_STORAGE_PATH="$XDG_DATA_HOME/docker-machine"
+# Python
+export PYENV_ROOT="$XDG_DATA_HOME/pyenv"
+
# Other
export CCACHE_CONFIGPATH="$XDG_CONFIG_HOME/ccache.conf"
export CCACHE_DIR="$XDG_CACHE_HOME/ccache"