commit 771da09122505f63bb61ebd7e1970356e06f51a2
parent 3e46abd2c6e966d09d6c855ec055cb1edaeeddc5
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Fri, 7 Feb 2020 13:49:53 +0100
shell: got rid of oh-my-zsh
It gives me too much stuff that I don't use, I'd rather manually select
what I want.
Former-commit-id: 9903113b7a2cef04bdbb4c49031c0e05fea6c87e
Diffstat:
14 files changed, 497 insertions(+), 83 deletions(-)
diff --git a/.gitmodules b/.gitmodules
@@ -1,6 +1,12 @@
[submodule "shell/z"]
path = shell/z
url = https://github.com/rupa/z.git
-[submodule "oh-my-zsh"]
- path = oh-my-zsh
- url = https://github.com/robbyrussell/oh-my-zsh.git
+[submodule "shell/powerlevel10k"]
+ path = shell/powerlevel10k
+ url = https://github.com/romkatv/powerlevel10k.git
+[submodule "shell/zsh-syntax-highlighting"]
+ path = shell/zsh-syntax-highlighting
+ url = https://github.com/zsh-users/zsh-syntax-highlighting.git
+[submodule "shell/zsh-completions"]
+ path = shell/zsh-completions
+ url = https://github.com/zsh-users/zsh-completions.git
diff --git a/dot.map b/dot.map
@@ -14,7 +14,6 @@ irssi: ~/.config/irssi
karabiner: ~/.config/karabiner
lf: ~/.config/lf
newsboat: ~/.newsboat
-oh-my-zsh: ~/.oh-my-zsh
polybar: ~/.config/polybar
radio:
- radio-config: ~/.radio-config
diff --git a/oh-my-zsh b/oh-my-zsh
@@ -1 +0,0 @@
-Subproject commit ce298d090b737cbce2a87afaada2195b0bb2e801
diff --git a/shell/functions b/shell/functions
@@ -46,12 +46,14 @@ extract () {
fi
}
+# Docker functions
if command -v docker &>/dev/null; then
eslint_here() {
docker run -it --rm -v $(pwd):/data cytopia/eslint . -f unix;
}
fi
+# Applescript-reliant functions
if command -v osascript &> /dev/null; then
# cd to current Finder directory
cdf() {
@@ -73,6 +75,7 @@ if command -v osascript &> /dev/null; then
}
fi
+# fzf-reliant functions
if [ -f ~/.fzf.zsh ] || [ -f ~/.fzf.bash ]; then
export FZF_DEFAULT_OPTS="--preview-window right:100:hidden:wrap --bind '?:toggle-preview' --preview='(bat --style=numbers --color=always {} || cat {}) 2>/dev/null | head -500'"
export FZF_DEFAULT_COMMAND="ag -l -g \"\""
@@ -124,3 +127,65 @@ if [ -f ~/.fzf.zsh ] || [ -f ~/.fzf.bash ]; then
fzf --preview "cat $1 | jq {q}"
}
fi
+
+# clipcopy - Copy data to clipboard (from oh-my-zsh)
+# Usage:
+# <command> | clipcopy - copies stdin to clipboard
+# clipcopy <file> - copies a file's contents to clipboard
+function clipcopy() {
+ emulate -L zsh
+ local file=$1
+ if [[ $OSTYPE == darwin* ]]; then
+ if [[ -z $file ]]; then
+ pbcopy
+ else
+ cat $file | pbcopy
+ fi
+ elif [[ $OSTYPE == (cygwin|msys)* ]]; then
+ if [[ -z $file ]]; then
+ cat > /dev/clipboard
+ else
+ cat $file > /dev/clipboard
+ fi
+ else
+ if (( $+commands[xclip] )); then
+ if [[ -z $file ]]; then
+ xclip -in -selection clipboard
+ else
+ xclip -in -selection clipboard $file
+ fi
+ elif (( $+commands[xsel] )); then
+ if [[ -z $file ]]; then
+ xsel --clipboard --input
+ else
+ cat "$file" | xsel --clipboard --input
+ fi
+ else
+ print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
+ return 1
+ fi
+ fi
+}
+
+# clippaste - "Paste" data from clipboard to stdout (from oh-my-zsh)
+# Usage:
+# clippaste - writes clipboard's contents to stdout
+# clippaste | <command> - pastes contents and pipes it to another process
+# clippaste > <file> - paste contents to a file
+function clippaste() {
+ emulate -L zsh
+ if [[ $OSTYPE == darwin* ]]; then
+ pbpaste
+ elif [[ $OSTYPE == (cygwin|msys)* ]]; then
+ cat /dev/clipboard
+ else
+ if (( $+commands[xclip] )); then
+ xclip -out -selection clipboard
+ elif (( $+commands[xsel] )); then
+ xsel --clipboard --output
+ else
+ print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
+ return 1
+ fi
+ fi
+}
diff --git a/shell/oh-my-zsh-defaults/clipboard.zsh b/shell/oh-my-zsh-defaults/clipboard.zsh
@@ -0,0 +1,86 @@
+# System clipboard integration
+#
+# This file has support for doing system clipboard copy and paste operations
+# from the command line in a generic cross-platform fashion.
+#
+# On OS X and Windows, the main system clipboard or "pasteboard" is used. On other
+# Unix-like OSes, this considers the X Windows CLIPBOARD selection to be the
+# "system clipboard", and the X Windows `xclip` command must be installed.
+
+# clipcopy - Copy data to clipboard
+#
+# Usage:
+#
+# <command> | clipcopy - copies stdin to clipboard
+#
+# clipcopy <file> - copies a file's contents to clipboard
+#
+function clipcopy() {
+ emulate -L zsh
+ local file=$1
+ if [[ $OSTYPE == darwin* ]]; then
+ if [[ -z $file ]]; then
+ pbcopy
+ else
+ cat $file | pbcopy
+ fi
+ elif [[ $OSTYPE == (cygwin|msys)* ]]; then
+ if [[ -z $file ]]; then
+ cat > /dev/clipboard
+ else
+ cat $file > /dev/clipboard
+ fi
+ else
+ if (( $+commands[xclip] )); then
+ if [[ -z $file ]]; then
+ xclip -in -selection clipboard
+ else
+ xclip -in -selection clipboard $file
+ fi
+ elif (( $+commands[xsel] )); then
+ if [[ -z $file ]]; then
+ xsel --clipboard --input
+ else
+ cat "$file" | xsel --clipboard --input
+ fi
+ else
+ print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
+ return 1
+ fi
+ fi
+}
+
+# clippaste - "Paste" data from clipboard to stdout
+#
+# Usage:
+#
+# clippaste - writes clipboard's contents to stdout
+#
+# clippaste | <command> - pastes contents and pipes it to another process
+#
+# clippaste > <file> - paste contents to a file
+#
+# Examples:
+#
+# # Pipe to another process
+# clippaste | grep foo
+#
+# # Paste to a file
+# clippaste > file.txt
+function clippaste() {
+ emulate -L zsh
+ if [[ $OSTYPE == darwin* ]]; then
+ pbpaste
+ elif [[ $OSTYPE == (cygwin|msys)* ]]; then
+ cat /dev/clipboard
+ else
+ if (( $+commands[xclip] )); then
+ xclip -out -selection clipboard
+ elif (( $+commands[xsel] )); then
+ xsel --clipboard --output
+ else
+ print "clipcopy: Platform $OSTYPE not supported or xclip/xsel not installed" >&2
+ return 1
+ fi
+ fi
+}
diff --git a/shell/oh-my-zsh-defaults/completion.zsh b/shell/oh-my-zsh-defaults/completion.zsh
@@ -0,0 +1,73 @@
+# fixme - the load process here seems a bit bizarre
+zmodload -i zsh/complist
+
+WORDCHARS=''
+
+unsetopt menu_complete # do not autoselect the first completion entry
+unsetopt flowcontrol
+setopt auto_menu # show completion menu on successive tab press
+setopt complete_in_word
+setopt always_to_end
+
+# should this be in keybindings?
+bindkey -M menuselect '^o' accept-and-infer-next-history
+zstyle ':completion:*:*:*:*:*' menu select
+
+# case insensitive (all), partial-word and substring completion
+if [[ "$CASE_SENSITIVE" = true ]]; then
+ zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*'
+else
+ if [[ "$HYPHEN_INSENSITIVE" = true ]]; then
+ zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*'
+ else
+ zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
+ fi
+fi
+unset CASE_SENSITIVE HYPHEN_INSENSITIVE
+
+# Complete . and .. special directories
+zstyle ':completion:*' special-dirs true
+
+zstyle ':completion:*' list-colors ''
+zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
+
+if [[ "$OSTYPE" = solaris* ]]; then
+ zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm"
+else
+ zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
+fi
+
+# disable named-directories autocompletion
+zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
+
+# Use caching so that commands like apt and dpkg complete are useable
+zstyle ':completion::complete:*' use-cache 1
+zstyle ':completion::complete:*' cache-path $ZSH_CACHE_DIR
+
+# Don't complete uninteresting users
+zstyle ':completion:*:*:*:users' ignored-patterns \
+ adm amanda apache at avahi avahi-autoipd beaglidx bin cacti canna \
+ clamav daemon dbus distcache dnsmasq dovecot fax ftp games gdm \
+ gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust kdm \
+ ldap lp mail mailman mailnull man messagebus mldonkey mysql nagios \
+ named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \
+ operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \
+ rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \
+ usbmux uucp vcsa wwwrun xfs '_*'
+
+# ... unless we really want to.
+zstyle '*' single-ignored show
+
+if [[ $COMPLETION_WAITING_DOTS = true ]]; then
+ expand-or-complete-with-dots() {
+ # toggle line-wrapping off and back on again
+ [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti rmam
+ print -Pn "%{%F{red}......%f%}"
+ [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti smam
+
+ zle expand-or-complete
+ zle redisplay
+ }
+ zle -N expand-or-complete-with-dots
+ bindkey "^I" expand-or-complete-with-dots
+fi
diff --git a/shell/oh-my-zsh-defaults/directories.zsh b/shell/oh-my-zsh-defaults/directories.zsh
@@ -0,0 +1,20 @@
+# Changing/making/removing directory
+setopt auto_pushd
+setopt pushd_ignore_dups
+setopt pushdminus
+
+alias -g ...='../..'
+alias -g ....='../../..'
+alias -g .....='../../../..'
+alias -g ......='../../../../..'
+
+alias -- -='cd -'
+
+function d () {
+ if [[ -n $1 ]]; then
+ dirs "$@"
+ else
+ dirs -v | head -10
+ fi
+}
+compdef _dirs d
diff --git a/shell/p10k-light.zsh b/shell/p10k-light.zsh
@@ -1,7 +1,7 @@
-# Generated by Powerlevel10k configuration wizard on 2020-02-01 at 15:33 CET.
-# Based on romkatv/powerlevel10k/config/p10k-lean-8colors.zsh, checksum 28962.
+# Generated by Powerlevel10k configuration wizard on 2020-02-07 at 14:38 CET.
+# Based on romkatv/powerlevel10k/config/p10k-lean-8colors.zsh, checksum 53373.
# Wizard options: nerdfont-complete + powerline, small icons, lean_8colors, time,
-# 1 line, sparse, few icons, concise, instant_prompt=quiet.
+# 1 line, sparse, few icons, concise, instant_prompt=verbose.
# Type `p10k configure` to generate another config.
#
# Config for Powerlevel10k with 8-color lean prompt style. Type `p10k configure` to generate
@@ -49,50 +49,52 @@
status # exit code of the last command
command_execution_time # duration of the last command
background_jobs # presence of background jobs
- # direnv # direnv status (https://direnv.net/)
+ direnv # direnv status (https://direnv.net/)
+ asdf # asdf version manager (https://github.com/asdf-vm/asdf)
virtualenv # python virtual environment (https://docs.python.org/3/library/venv.html)
- # anaconda # conda environment (https://conda.io/)
- # pyenv # python environment (https://github.com/pyenv/pyenv)
- # goenv # go environment (https://github.com/syndbg/goenv)
- # nodenv # node.js version from nodenv (https://github.com/nodenv/nodenv)
- # nvm # node.js version from nvm (https://github.com/nvm-sh/nvm)
- # nodeenv # node.js environment (https://github.com/ekalinin/nodeenv)
+ anaconda # conda environment (https://conda.io/)
+ pyenv # python environment (https://github.com/pyenv/pyenv)
+ goenv # go environment (https://github.com/syndbg/goenv)
+ nodenv # node.js version from nodenv (https://github.com/nodenv/nodenv)
+ nvm # node.js version from nvm (https://github.com/nvm-sh/nvm)
+ nodeenv # node.js environment (https://github.com/ekalinin/nodeenv)
# node_version # node.js version
# go_version # go version (https://golang.org)
# rust_version # rustc version (https://www.rust-lang.org)
# dotnet_version # .NET version (https://dotnet.microsoft.com)
rbenv # ruby version from rbenv (https://github.com/rbenv/rbenv)
- # rvm # ruby version from rvm (https://rvm.io)
- # fvm # flutter version management (https://github.com/leoafarias/fvm)
- # luaenv # lua version from luaenv (https://github.com/cehoffman/luaenv)
- # jenv # java version from jenv (https://github.com/jenv/jenv)
- # plenv # perl version from plenv (https://github.com/tokuhirom/plenv)
- # kubecontext # current kubernetes context (https://kubernetes.io/)
- # terraform # terraform workspace (https://www.terraform.io)
- # aws # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html)
- # aws_eb_env # aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/)
- # 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)
+ rvm # ruby version from rvm (https://rvm.io)
+ fvm # flutter version management (https://github.com/leoafarias/fvm)
+ luaenv # lua version from luaenv (https://github.com/cehoffman/luaenv)
+ jenv # java version from jenv (https://github.com/jenv/jenv)
+ plenv # perl version from plenv (https://github.com/tokuhirom/plenv)
+ kubecontext # current kubernetes context (https://kubernetes.io/)
+ terraform # terraform workspace (https://www.terraform.io)
+ aws # aws profile (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html)
+ aws_eb_env # aws elastic beanstalk environment (https://aws.amazon.com/elasticbeanstalk/)
+ 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)
vim_shell # vim shell indicator (:sh)
- # midnight_commander # midnight commander shell (https://midnight-commander.org/)
- # nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html)
- # vi_mode # vi mode (you don't need this if you've enabled prompt_char)
+ midnight_commander # midnight commander shell (https://midnight-commander.org/)
+ nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html)
# vpn_ip # virtual private network indicator
# load # CPU load
# disk_usage # disk usage
# ram # free RAM
# swap # used swap
- # todo # todo items (https://github.com/todotxt/todo.txt-cli)
- # timewarrior # timewarrior tracking status (https://timewarrior.net/)
+ todo # todo items (https://github.com/todotxt/todo.txt-cli)
+ timewarrior # timewarrior tracking status (https://timewarrior.net/)
time # current time
+ # ip # ip address and bandwidth usage for a specified network interface
# public_ip # public IP address
# proxy # system-wide http/https/ftp proxy
# battery # internal battery
+ # wifi # wifi speed
# example # example user-defined segment (see prompt_example function below)
)
@@ -254,7 +256,12 @@
.hg
.node-version
.python-version
+ .go-version
.ruby-version
+ .lua-version
+ .java-version
+ .perl-version
+ .tool-version
.shorten_folder_marker
.svn
.terraform
@@ -265,6 +272,11 @@
package.json
)
typeset -g POWERLEVEL9K_SHORTEN_FOLDER_MARKER="(${(j:|:)anchor_files})"
+ # If set to true, remove everything before the last (deepest) subdirectory that contains files
+ # matching $POWERLEVEL9K_SHORTEN_FOLDER_MARKER. For example, when the current directory is
+ # /foo/bar/git_repo/baz, prompt will display git_repo/baz. This assumes that /foo/bar/git_repo
+ # contains a marker (.git) and other directories don't.
+ typeset -g POWERLEVEL9K_DIR_TRUNCATE_BEFORE_MARKER=false
# Don't shorten this many last directory segments. They are anchors.
typeset -g POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
# Shorten directory if it's longer than this even if there is space for it. The value can
@@ -513,6 +525,101 @@
# Custom icon.
# typeset -g POWERLEVEL9K_DIRENV_VISUAL_IDENTIFIER_EXPANSION='⭐'
+ ###############[ asdf: asdf version manager (https://github.com/asdf-vm/asdf) ]###############
+ # Default asdf color. Only used to display tools for which there is no color override (see below).
+ typeset -g POWERLEVEL9K_ASDF_FOREGROUND=6
+
+ # There are three parameters that can be used to hide tools. If at least one of them decides
+ # to hide a tool, that tool gets hidden. POWERLEVEL9K_ASDF_SHOW_SYSTEM=false hides "system". To
+ # see the difference between POWERLEVEL9K_ASDF_SOURCES and POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW
+ # consider the effect of the following commands:
+ #
+ # asdf local python 3.8.1
+ # asdf global python 3.8.1
+ #
+ # After running both commands the current python version is 3.8.1 and its source is "local" as
+ # it takes precedence over "global". If POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW is set to false,
+ # it'll hide python version in this case because 3.8.1 is the same as the global version.
+ # POWERLEVEL9K_ASDF_SOURCES will hide python version only if the value of this parameter doesn't
+ # contain "local".
+
+ # Hide tool versions that don't come from one of these sources.
+ #
+ # Available sources:
+ #
+ # - shell `asdf current` says "set by ASDF_${TOOL}_VERSION environment variable"
+ # - local `asdf current` says "set by /some/not/home/directory/file"
+ # - global `asdf current` says "set by /home/username/file"
+ #
+ # Note: If this parameter is set to (shell local global), it won't hide tools.
+ # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_SOURCES.
+ typeset -g POWERLEVEL9K_ASDF_SOURCES=(shell local global)
+
+ # If set to false, hide tool versions that are the same as global.
+ #
+ # Note: The name of this parameter doesn't reflect its meaning at all.
+ # Note: If this parameter is set to true, it won't hide tools.
+ # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_PROMPT_ALWAYS_SHOW.
+ typeset -g POWERLEVEL9K_ASDF_PROMPT_ALWAYS_SHOW=false
+
+ # If set to false, hide tool versions that are equal to "system".
+ #
+ # Note: If this parameter is set to true, it won't hide tools.
+ # Tip: Override this parameter for ${TOOL} with POWERLEVEL9K_ASDF_${TOOL}_SHOW_SYSTEM.
+ typeset -g POWERLEVEL9K_ASDF_SHOW_SYSTEM=true
+
+ # Ruby version from asdf.
+ typeset -g POWERLEVEL9K_ASDF_RUBY_FOREGROUND=1
+ # typeset -g POWERLEVEL9K_ASDF_RUBY_VISUAL_IDENTIFIER_EXPANSION='⭐'
+
+ # Python version from asdf.
+ typeset -g POWERLEVEL9K_ASDF_PYTHON_FOREGROUND=6
+ # typeset -g POWERLEVEL9K_ASDF_PYTHON_VISUAL_IDENTIFIER_EXPANSION='⭐'
+
+ # Go version from asdf.
+ typeset -g POWERLEVEL9K_ASDF_GO_FOREGROUND=6
+ # typeset -g POWERLEVEL9K_ASDF_GO_VISUAL_IDENTIFIER_EXPANSION='⭐'
+
+ # Node.js version from asdf.
+ typeset -g POWERLEVEL9K_ASDF_NODEJS_FOREGROUND=2
+ # typeset -g POWERLEVEL9K_ASDF_NODEJS_VISUAL_IDENTIFIER_EXPANSION='⭐'
+
+ # Rust version from asdf.
+ typeset -g POWERLEVEL9K_ASDF_RUST_FOREGROUND=4
+ # typeset -g POWERLEVEL9K_ASDF_RUST_VISUAL_IDENTIFIER_EXPANSION='⭐'
+
+ # .NET Core version from asdf.
+ typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_FOREGROUND=5
+ # typeset -g POWERLEVEL9K_ASDF_DOTNET_CORE_VISUAL_IDENTIFIER_EXPANSION='⭐'
+
+ # Flutter version from asdf.
+ typeset -g POWERLEVEL9K_ASDF_FLUTTER_FOREGROUND=4
+ # typeset -g POWERLEVEL9K_ASDF_FLUTTER_VISUAL_IDENTIFIER_EXPANSION='⭐'
+
+ # Lua version from asdf.
+ typeset -g POWERLEVEL9K_ASDF_LUA_FOREGROUND=4
+ # typeset -g POWERLEVEL9K_ASDF_LUA_VISUAL_IDENTIFIER_EXPANSION='⭐'
+
+ # Java version from asdf.
+ typeset -g POWERLEVEL9K_ASDF_JAVA_FOREGROUND=4
+ # typeset -g POWERLEVEL9K_ASDF_JAVA_VISUAL_IDENTIFIER_EXPANSION='⭐'
+
+ # Perl version from asdf.
+ typeset -g POWERLEVEL9K_ASDF_PERL_FOREGROUND=6
+ # typeset -g POWERLEVEL9K_ASDF_PERL_VISUAL_IDENTIFIER_EXPANSION='⭐'
+
+ # Erlang version from asdf.
+ typeset -g POWERLEVEL9K_ASDF_ERLANG_FOREGROUND=1
+ # typeset -g POWERLEVEL9K_ASDF_ERLANG_VISUAL_IDENTIFIER_EXPANSION='⭐'
+
+ # Elixir version from asdf.
+ typeset -g POWERLEVEL9K_ASDF_ELIXIR_FOREGROUND=5
+ # typeset -g POWERLEVEL9K_ASDF_ELIXIR_VISUAL_IDENTIFIER_EXPANSION='⭐'
+
+ # Postgres version from asdf.
+ typeset -g POWERLEVEL9K_ASDF_POSTGRES_FOREGROUND=6
+ # typeset -g POWERLEVEL9K_ASDF_POSTGRES_VISUAL_IDENTIFIER_EXPANSION='⭐'
+
##########[ nordvpn: nordvpn connection status, linux only (https://nordvpn.com/) ]###########
# NordVPN connection indicator color.
typeset -g POWERLEVEL9K_NORDVPN_FOREGROUND=6
@@ -1064,12 +1171,32 @@
# When on VPN, show just an icon without the IP address.
# Tip: To display the private IP address when on VPN, remove the next line.
typeset -g POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION=
- # Regular expression for the VPN network interface. Run ifconfig while on VPN to see the
- # name of the interface.
+ # Regular expression for the VPN network interface. Run `ifconfig` or `ip -4 a show` while on VPN
+ # to see the name of the interface.
typeset -g POWERLEVEL9K_VPN_IP_INTERFACE='(wg|(.*tun))[0-9]*'
# Custom icon.
# typeset -g POWERLEVEL9K_VPN_IP_VISUAL_IDENTIFIER_EXPANSION='⭐'
+ ###########[ ip: ip address and bandwidth usage for a specified network interface ]###########
+ # IP color.
+ typeset -g POWERLEVEL9K_IP_FOREGROUND=4
+ # The following parameters are accessible within the expansion:
+ #
+ # Parameter | Meaning
+ # ----------------------+---------------
+ # P9K_IP_IP | IP address
+ # P9K_IP_INTERFACE | network interface
+ # P9K_IP_RX_BYTES | total number of bytes received
+ # P9K_IP_TX_BYTES | total number of bytes sent
+ # P9K_IP_RX_RATE | receive rate (since last prompt)
+ # P9K_IP_TX_RATE | send rate (since last prompt)
+ typeset -g POWERLEVEL9K_IP_CONTENT_EXPANSION='$P9K_IP_IP %2F⇣$P9K_IP_RX_RATE %3F⇡$P9K_IP_TX_RATE'
+ # Show information for the first network interface whose name matches this regular expression.
+ # Run `ifconfig` or `ip -4 a show` to see the names of all network interfaces.
+ typeset -g POWERLEVEL9K_IP_INTERFACE='e.*'
+ # Custom icon.
+ # typeset -g POWERLEVEL9K_IP_VISUAL_IDENTIFIER_EXPANSION='⭐'
+
#########################[ proxy: system-wide http/https/ftp proxy ]##########################
# Proxy color.
typeset -g POWERLEVEL9K_PROXY_FOREGROUND=2
@@ -1085,10 +1212,40 @@
# Show battery in yellow when it's discharging.
typeset -g POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND=3
# Battery pictograms going from low to high level of charge.
- typeset -g POWERLEVEL9K_BATTERY_STAGES=$'\uf58d\uf579\uf57a\uf57b\uf57c\uf57d\uf57e\uf57f\uf580\uf581\uf578'
+ typeset -g POWERLEVEL9K_BATTERY_STAGES='\uf58d\uf579\uf57a\uf57b\uf57c\uf57d\uf57e\uf57f\uf580\uf581\uf578'
# Don't show the remaining time to charge/discharge.
typeset -g POWERLEVEL9K_BATTERY_VERBOSE=false
+ #####################################[ wifi: wifi speed ]#####################################
+ # WiFi color.
+ typeset -g POWERLEVEL9K_WIFI_FOREGROUND=4
+ # Custom icon.
+ # typeset -g POWERLEVEL9K_WIFI_VISUAL_IDENTIFIER_EXPANSION='⭐'
+
+ # Use different colors and icons depending on signal strength ($P9K_WIFI_BARS).
+ #
+ # # Wifi colors and icons for different signal strength levels (low to high).
+ # typeset -g my_wifi_fg=(4 4 4 4 4) # <-- change these values
+ # typeset -g my_wifi_icon=('WiFi' 'WiFi' 'WiFi' 'WiFi' 'WiFi') # <-- change these values
+ #
+ # typeset -g POWERLEVEL9K_WIFI_CONTENT_EXPANSION='%F{${my_wifi_fg[P9K_WIFI_BARS+1]}}$P9K_WIFI_LAST_TX_RATE Mbps'
+ # typeset -g POWERLEVEL9K_WIFI_VISUAL_IDENTIFIER_EXPANSION='%F{${my_wifi_fg[P9K_WIFI_BARS+1]}}${my_wifi_icon[P9K_WIFI_BARS+1]}'
+ #
+ # The following parameters are accessible within the expansions:
+ #
+ # Parameter | Meaning
+ # ----------------------+---------------
+ # P9K_WIFI_SSID | service set identifier, a.k.a. network name
+ # P9K_WIFI_LINK_AUTH | authentication protocol such as "wpa2-psk" or "none"
+ # P9K_WIFI_LAST_TX_RATE | wireless transmit rate in megabits per second
+ # P9K_WIFI_RSSI | signal strength in dBm, from -120 to 0
+ # P9K_WIFI_NOISE | noise in dBm, from -120 to 0
+ # P9K_WIFI_BARS | signal strength in bars, from 0 to 4 (derived from P9K_WIFI_RSSI and P9K_WIFI_NOISE)
+ #
+ # All parameters except P9K_WIFI_BARS are extracted from the output of the following command:
+ #
+ # /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I
+
####################################[ time: current time ]####################################
# Current time color.
typeset -g POWERLEVEL9K_TIME_FOREGROUND=6
@@ -1154,7 +1311,7 @@
# - verbose: Enable instant prompt and print a warning when detecting console output during
# zsh initialization. Choose this if you've never tried instant prompt, haven't
# seen the warning, or if you are unsure what this all means.
- typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet
+ typeset -g POWERLEVEL9K_INSTANT_PROMPT=verbose
# Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized.
# For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload
diff --git a/shell/powerlevel10k b/shell/powerlevel10k
@@ -0,0 +1 @@
+Subproject commit 6a79008aec9833c53ff0d8118c636f27368a1fff
diff --git a/shell/zsh-completions b/shell/zsh-completions
@@ -0,0 +1 @@
+Subproject commit a6e641b977373740e9744182e6fad9af9ff39bc5
diff --git a/shell/zsh-completions/_lf b/shell/zsh-completions/_lf
@@ -1,29 +0,0 @@
-#compdef lf
-
-# For using these completions you must:
-# - rename this file to _lf
-# - add the containing folder to $fpath in .zshrc, like this:
-# '''
-# fpath=(/path/to/folder/containing_lf $fpath)
-# autoload -U compinit
-# compinit
-# '''
-#
-# zsh completions for 'lf'
-# automatically generated with http://github.com/RobSis/zsh-completion-generator
-local arguments
-
-arguments=(
- '-command[command to execute on client initialization]'
- '-cpuprofile[path to the file to write the CPU profile]'
- '-doc[show documentation]'
- '-last-dir-path[path to the file to write the last dir on exit (to use for cd)]'
- '-memprofile[path to the file to write the memory profile]'
- '-remote[send remote command to server]'
- '-selection-path[path to the file to write selected files on open (to use as open file dialog)]'
- '-server[start server (automatic)]'
- '-version[show version]'
- '*:filename:_files'
-)
-
-_arguments -s $arguments
diff --git a/shell/zsh-powerlevelrc b/shell/zsh-powerlevelrc
@@ -1,2 +0,0 @@
-POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(user dir virtualenv vcs)
-POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs history ram time battery)
diff --git a/shell/zsh-syntax-highlighting b/shell/zsh-syntax-highlighting
@@ -0,0 +1 @@
+Subproject commit dde84e1b25f059a298ce3189cddfd0778f998df3
diff --git a/shell/zshrc b/shell/zshrc
@@ -5,8 +5,37 @@ if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
-export ZSH="$HOME/.dotfiles/oh-my-zsh"
-ZSH_THEME="powerlevel10k/powerlevel10k"
+source_if_exists() {
+ if [[ -f "$1" ]]; then
+ source "$1"
+ fi
+}
+
+# Allow comments in shell
+setopt interactivecomments
+
+# Enable extra completions
+fpath=($DOTFILES/shell/zsh-completions/src $fpath)
+autoload -Uz compinit
+compinit
+source $DOTFILES/shell/oh-my-zsh-defaults/completion.zsh
+source $DOTFILES/shell/oh-my-zsh-defaults/directories.zsh
+
+# Auto correct commands, with exceptions (from oh-my-zsh)
+if [[ "$ENABLE_CORRECTION" == "true" ]]; then
+ alias cp='nocorrect cp'
+ alias ebuild='nocorrect ebuild'
+ alias gist='nocorrect gist'
+ alias heroku='nocorrect heroku'
+ alias hpodder='nocorrect hpodder'
+ alias man='nocorrect man'
+ alias mkdir='nocorrect mkdir'
+ alias mv='nocorrect mv'
+ alias mysql='nocorrect mysql'
+ alias sudo='nocorrect sudo'
+
+ setopt correct_all
+fi
# Import colorscheme from 'wal' asynchronously
# & # Run the process in the background.
@@ -14,10 +43,10 @@ ZSH_THEME="powerlevel10k/powerlevel10k"
(cat ~/.cache/wal/sequences &)
# # To add support for TTYs this line can be optionally added.
-source ~/.cache/wal/colors-tty.sh
+. ~/.cache/wal/colors-tty.sh
-. $HOME/.dotfiles/shell/z/z.sh
+# Enable virtualenvwrapper if installed
if [ -f /usr/local/bin/virtualenvwrapper.sh ]; then
export WORKON_HOME=$HOME/.config/virtualenvs
export VIRTUALENVWRAPPER_PYTHON=`which python3`
@@ -26,14 +55,19 @@ if [ -f /usr/local/bin/virtualenvwrapper.sh ]; then
source /usr/local/bin/virtualenvwrapper_lazy.sh
fi
-plugins=(git gitignore zsh-syntax-highlighting httpie)
-source $ZSH/oh-my-zsh.sh
+# Powerlevel10k theme
+source_if_exists ~/.p10k.zsh
+source_if_exists $DOTFILES/shell/powerlevel10k/powerlevel10k.zsh-theme
-# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
-[[ -f ~/.p10k.zsh ]] && source ~/.p10k.zsh
-[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
-[[ -f ~/.aliases ]] && source ~/.aliases
-[[ -f ~/.functions ]] && source ~/.functions
+# The 'z' command to jump around dirs
+source_if_exists $DOTFILES/shell/z/z.sh
+
+# FZF for fuzzy finding
+source_if_exists ~/.fzf.zsh
+
+# Enable custom aliases and functions
+source_if_exists ~/.aliases
+source_if_exists ~/.functions
insert-arg-of-prev-cmd() {
: ${NUMERIC:-1}
@@ -62,6 +96,9 @@ lfcd () {
}
bindkey -s '^o' 'lfcd\n'
-
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
+source_if_exists $DOTFILES/shell/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
+
+# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
+[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh