mirror of
https://github.com/akelge/zsh
synced 2025-07-03 13:09:07 +00:00
Compare commits
106 Commits
gpg
...
not-minimi
Author | SHA1 | Date | |
---|---|---|---|
f13995870e
|
|||
9dd1f6819f | |||
05eb0c7819 | |||
dfac2b93b2
|
|||
1ae598ea4e | |||
495087ae48
|
|||
2ef865b328
|
|||
2a0372ae11
|
|||
8f26560749
|
|||
71f50c2157
|
|||
9064a7bed3
|
|||
1267b3033f | |||
ff87851e7e
|
|||
1d175dd9cc
|
|||
34b07d5610
|
|||
21a8089908
|
|||
894ed572a3
|
|||
e9105f880c | |||
26a92fc414 | |||
ff3b1e4db3 | |||
b8eec1e213 | |||
0173294d2a | |||
c50a178bb7 | |||
5932577a7d | |||
4df8afd81f | |||
c577ac480e | |||
8d0b2db580 | |||
4a7b17c07b | |||
ee52b6a547 | |||
51bd0516d6 | |||
0ae9cfdb9e | |||
3beca17833 | |||
eba3c19aab | |||
8a913947e3 | |||
293ef30aaa | |||
c8576d59ca | |||
ca8a24d28e | |||
f89f77715c | |||
e9c8d01fe9 | |||
eee598fa52 | |||
9b3bf80a3b | |||
44860d71f3 | |||
368dc1d452 | |||
c951f3d048 | |||
3dd3bd61c3 | |||
c2f1f88766 | |||
e4335ba022 | |||
e7a5d9c7e9 | |||
ddcda3ad7c | |||
ec0eab3b21 | |||
863abe744e | |||
a0587918c3 | |||
5e2a7e1420 | |||
2c390530be | |||
cecec1b6f2 | |||
bb26b1374d | |||
907de2ec1b | |||
4f2a64d0f3 | |||
3abc63bd04 | |||
4d60d43ff8 | |||
115a35d1ae | |||
6bd3e4b627 | |||
030a3b8aca | |||
5482387eb3 | |||
8b02f06f98 | |||
48634fc7a8 | |||
9dcf5a473b | |||
6d957302da | |||
2a0691f654 | |||
d6aa0053e9 | |||
d0b17cc7aa | |||
7db6c99902 | |||
ed9333b79a | |||
6e85b0ced9 | |||
31ead6cf67 | |||
73455f0d9e | |||
ec13969e0f | |||
6b9bbdadb9 | |||
1487224aaa | |||
7023dd4906 | |||
a65005aa7d | |||
1dbe3a174b | |||
a98a44ba5d | |||
360ae5fa01 | |||
4bc0575d66 | |||
4de7794b46 | |||
3d9237d5ce | |||
4166f55fd4 | |||
9e4de7b42c | |||
6771d8b38c | |||
85e6b157b5 | |||
66df77560a | |||
e368970184 | |||
c90d534efd | |||
fcc0a92123 | |||
a5a9830d90 | |||
74e5d63ee7 | |||
86dcb33a49 | |||
7f26e0b6c0 | |||
f8ef49befc | |||
0581ce6ba4 | |||
85ace81751 | |||
f4a4abba6f | |||
ee0f1bb04d | |||
22273f51f5 | |||
73b7757d87 |
270
.gitignore
vendored
270
.gitignore
vendored
@ -1,4 +1,268 @@
|
||||
zsh.d/99-local.zsh
|
||||
zsh.d/Darwin/99-local.zsh
|
||||
# File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos,linux,python,vim
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,macos,linux,python,vim
|
||||
|
||||
### Linux ###
|
||||
*~
|
||||
*.swp
|
||||
|
||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||
.fuse_hidden*
|
||||
|
||||
# KDE directory preferences
|
||||
.directory
|
||||
|
||||
# Linux trash folder which might appear on any partition or disk
|
||||
.Trash-*
|
||||
|
||||
# .nfs files are created when an open file is removed but is still being accessed
|
||||
.nfs*
|
||||
|
||||
### macOS ###
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
### macOS Patch ###
|
||||
# iCloud generated files
|
||||
*.icloud
|
||||
|
||||
### Python ###
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# poetry
|
||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||
#poetry.lock
|
||||
|
||||
# pdm
|
||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||
#pdm.lock
|
||||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||
# in version control.
|
||||
# https://pdm.fming.dev/#use-with-ide
|
||||
.pdm.toml
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
# PyCharm
|
||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
|
||||
### Python Patch ###
|
||||
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
|
||||
poetry.toml
|
||||
|
||||
# ruff
|
||||
.ruff_cache/
|
||||
|
||||
# LSP config files
|
||||
pyrightconfig.json
|
||||
|
||||
### Vim ###
|
||||
# Swap
|
||||
[._]*.s[a-v][a-z]
|
||||
!*.svg # comment out if you don't need vector files
|
||||
[._]*.sw[a-p]
|
||||
[._]s[a-rt-v][a-z]
|
||||
[._]ss[a-gi-z]
|
||||
[._]sw[a-p]
|
||||
|
||||
# Session
|
||||
Session.vim
|
||||
Sessionx.vim
|
||||
|
||||
# Temporary
|
||||
.netrwhist
|
||||
# Auto-generated tag files
|
||||
tags
|
||||
# Persistent undo
|
||||
[._]*.un~
|
||||
|
||||
### VisualStudioCode ###
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
!.vscode/*.code-snippets
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# Built Visual Studio Code Extensions
|
||||
*.vsix
|
||||
|
||||
### VisualStudioCode Patch ###
|
||||
# Ignore all local history of files
|
||||
.history
|
||||
.ionide
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos,linux,python,vim
|
||||
|
||||
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
|
||||
|
||||
zsh.d/99-local.zsh
|
||||
|
5
.gitmodules
vendored
5
.gitmodules
vendored
@ -1,3 +1,6 @@
|
||||
[submodule "zsh.d/prompts/pure"]
|
||||
path = zsh.d/prompts/pure
|
||||
url = git@github.com:sindresorhus/pure.git
|
||||
url = https://github.com/sindresorhus/pure.git
|
||||
[submodule "zsh.d/plugins/zsh-z"]
|
||||
path = zsh.d/plugins/zsh-z
|
||||
url = https://github.com/agkozak/zsh-z
|
||||
|
27
README.md
27
README.md
@ -1,6 +1,29 @@
|
||||
# zsh
|
||||
My zsh configuration files
|
||||
|
||||
Good for Linux and OSX, tested on Ubuntu, CentOS, Debian and FreeBSD
|
||||
Works on Linux, *BSD and OSX, tested on Ubuntu, CentOS, Debian, FreeBSD and several versions of macOS.
|
||||
|
||||
Last github PGP another
|
||||
|
||||
### Supported plugins
|
||||
|
||||
There is native support for:
|
||||
- [homebrew](https://brew.sh/);
|
||||
- [zoxide](https://github.com/ajeetdsouza/zoxide), if not installed falls back to zsh-z native plugin;
|
||||
- kubectl;
|
||||
- [krew](ihttps://krew.sigs.k8s.io/);
|
||||
- [pyenv](https://github.com/pyenv/pyenv);
|
||||
- [thefuck](https://github.com/nvbn/thefuck)
|
||||
|
||||
These plugins must be installed in another way, I only support using them
|
||||
|
||||
There is also native support for [iTerm2](https://iterm2.com/) shell integration, if you are running on macOS
|
||||
|
||||
### Installation
|
||||
|
||||
- Clone recurively this repo in `/etc/zsh`: `sudo git clone --recurse <url> /etc/zsh`;
|
||||
- Copy `/etc/zsh/zshrc` in `/etc`;
|
||||
- Done
|
||||
|
||||
**NOTE**: on macOS with each update of the OS, the file `/etc/zshrc` is restored to the default, you will have to copy again the one in `/etc/zsh`: `sudo cp /etc/zsh/zshrc /etc/zshrc`
|
||||
|
||||
If you prefer to avoid touching `/etc/` you can clone the repo in `~/.zsh` and copy the `zshrc` into `~/.zshrc`: `cp ~/.zsh/zshrc ~/.zshrc`, but then you have to add your own customisations to `.zshrc` at the end of the file.
|
||||
|
@ -1,12 +0,0 @@
|
||||
source /home/andre/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/plugins/git/git.plugin.zsh
|
||||
fpath+=( /home/andre/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/plugins/git )
|
||||
source /home/andre/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/plugins/pip/pip.plugin.zsh
|
||||
fpath+=( /home/andre/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/plugins/pip )
|
||||
|
||||
source /home/andre/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/plugins/docker-compose/docker-compose.plugin.zsh
|
||||
fpath+=( /home/andre/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/plugins/docker-compose )
|
||||
source /home/andre/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/plugins/aws/aws.plugin.zsh
|
||||
fpath+=( /home/andre/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh/plugins/aws )
|
||||
|
||||
source /home/andre/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-agnoster-SLASH-agnoster-zsh-theme/agnoster.zsh-theme
|
||||
fpath+=( /home/andre/.cache/antibody/https-COLON--SLASH--SLASH-github.com-SLASH-agnoster-SLASH-agnoster-zsh-theme )
|
@ -1,33 +0,0 @@
|
||||
# To update plugins, add them below, then run
|
||||
# antibody bundle < ~/.zshdir/plugins.txt > ~/.zshdir/plugins.sh
|
||||
|
||||
|
||||
# Bundles from the default repo (robbyrussell's oh-my-zsh).
|
||||
# heroku
|
||||
# lein
|
||||
# command-not-found
|
||||
# sudo
|
||||
# fancy-ctrl-z
|
||||
# zsh_reload
|
||||
# vagrant
|
||||
# zsh-users/zsh-completions src
|
||||
# brew-cask
|
||||
# brew
|
||||
|
||||
robbyrussell/oh-my-zsh path:plugins/git
|
||||
# robbyrussell/oh-my-zsh path:plugins/git-prompt
|
||||
robbyrussell/oh-my-zsh path:plugins/pip
|
||||
# robbyrussell/oh-my-zsh path:plugins/svn
|
||||
# robbyrussell/oh-my-zsh path:plugins/osx
|
||||
robbyrussell/oh-my-zsh path:plugins/docker
|
||||
robbyrussell/oh-my-zsh path:plugins/docker-compose
|
||||
robbyrussell/oh-my-zsh path:plugins/aws
|
||||
robbyrussell/oh-my-zsh path:plugins/httpie
|
||||
|
||||
# Syntax highlighting bundle.
|
||||
# zsh-users/zsh-syntax-highlighting
|
||||
|
||||
# Load the theme.
|
||||
agnoster/agnoster-zsh-theme
|
||||
|
||||
# vim: set ts=4 sw=4 tw=0 ft=sh :
|
@ -1,10 +0,0 @@
|
||||
# Created by newuser for 5.7.1
|
||||
#
|
||||
export DEFAULT_USER=$(whoami)
|
||||
export WORKON_HOME=$HOME/Src/virtualenvs
|
||||
export PROJECT_HOME=$HOME/Src/projects
|
||||
|
||||
ZSH="$(antibody home)/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh"
|
||||
source ~/.zshdir/plugins.sh
|
||||
|
||||
cd
|
140
oh-my-posh/mypure.omp.yaml
Normal file
140
oh-my-posh/mypure.omp.yaml
Normal file
@ -0,0 +1,140 @@
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
|
||||
console_title: true
|
||||
console_title_style: template
|
||||
# console_title_template: "{{if .Env.SSH_CONNECTION}} {{ .HostName }} :: {{end}}{{.Folder}}"
|
||||
console_title_template: "{{if .Env.SSH_CONNECTION}}@{{ .HostName }}:{{end}}{{.Folder}}"
|
||||
final_space: false
|
||||
|
||||
blocks:
|
||||
- type: prompt
|
||||
alignment: left
|
||||
newline: false
|
||||
segments:
|
||||
- type: session
|
||||
style: plain
|
||||
foreground: yellow
|
||||
properties:
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
template: '{{if .SSHSession}}|{{ .HostName }}| {{end}}'
|
||||
|
||||
- type: text
|
||||
style: plain
|
||||
foreground: lightBlue
|
||||
properties:
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
text: "$([ $(jobs|wc -l|xargs) -gt 0 ] && echo '\u2622 ')"
|
||||
|
||||
- type: root
|
||||
style: plain
|
||||
foreground: yellow
|
||||
properties:
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
root_icon: "\u26A1"
|
||||
# root_icon: "# "
|
||||
|
||||
- type: path
|
||||
style: plain
|
||||
foreground: lightBlue
|
||||
properties:
|
||||
prefix: ""
|
||||
# style: agnoster_short
|
||||
# max_depth: 2
|
||||
style: full
|
||||
|
||||
- type: git
|
||||
style: plain
|
||||
foreground: yellow
|
||||
properties:
|
||||
branch_ahead_icon: <#88C0D0>⇡</>
|
||||
branch_behind_icon: <#88C0D0>⇣</>
|
||||
branch_icon: ""
|
||||
display_status: true
|
||||
fetch_status: true
|
||||
prefix: ""
|
||||
template: '{{ .HEAD }}{{.BranchStatus}}{{ if .Working.Changed }}<#FF0000>* {{ .Working.String }}</>{{ end }}'
|
||||
# template: '{{.BranchStatus}}{{ if .Working.Changed }}<#FF0000>* {{ .Working.String }}</>{{ end }}'
|
||||
|
||||
- type: executiontime
|
||||
style: plain
|
||||
foreground: yellow
|
||||
properties:
|
||||
always_enabled: false
|
||||
postfix: ""
|
||||
prefix: " "
|
||||
style: austin
|
||||
threshold: 30000
|
||||
|
||||
- type: prompt
|
||||
alignment: right
|
||||
segments:
|
||||
|
||||
- type: aws
|
||||
style: plain
|
||||
foreground: yellow
|
||||
properties:
|
||||
postfix: ""
|
||||
# prefix: " "
|
||||
prefix: " "
|
||||
# prefix: " "
|
||||
template: '{{if .Profile}}{{.Profile}}{{end}}'
|
||||
|
||||
- type: kubectl
|
||||
style: plain
|
||||
foreground: lightBlue
|
||||
properties:
|
||||
display_error: true
|
||||
parse_kubeconfig: true
|
||||
postfix: ""
|
||||
prefix: ""
|
||||
# template: '{{if eq "on" .Env.KUBE_PS1_ENABLED}} ﴱ {{.Context}}{{if .Namespace}}/{{.Namespace}}{{end}}{{end}}'
|
||||
template: '{{if eq "on" .Env.KUBE_PS1_ENABLED}} ﴱ {{.Context}}/{{.Namespace}}{{end}}'
|
||||
# template: '{{ .Context }}/{{ .Namespace }}'
|
||||
|
||||
- type: command
|
||||
style: plain
|
||||
foreground: green
|
||||
properties:
|
||||
shell: /bin/sh
|
||||
command: "ifconfig utun2 > /dev/null 2>&1 && echo '\uF023' || echo '\0'"
|
||||
|
||||
|
||||
- type: prompt
|
||||
alignment: left
|
||||
newline: true
|
||||
segments:
|
||||
|
||||
- type: python
|
||||
style: plain
|
||||
foreground: darkGray
|
||||
properties:
|
||||
display_version: false
|
||||
postfix: ""
|
||||
prefix: ""
|
||||
|
||||
- type: exit
|
||||
style: plain
|
||||
foreground: lightYellow
|
||||
foreground_templates:
|
||||
- '{{ if gt .Code 0 }}#FF0000{{ end }}'
|
||||
properties:
|
||||
always_enabled: true
|
||||
prefix: ""
|
||||
# template: ❯
|
||||
template: "\u276F"
|
||||
|
||||
tooltips:
|
||||
- type: kubectl
|
||||
style: plain
|
||||
foreground: lightBlue
|
||||
postfix: ""
|
||||
prefix: ""
|
||||
tips:
|
||||
- kubectl
|
||||
- k
|
||||
- stern
|
||||
properties:
|
||||
template: 'ﴱ {{.Context}}{{ if .Namespace }}/{{.Namespace}}{{end}}'
|
||||
|
118
oh-my-posh/realpure.omp.yaml
Normal file
118
oh-my-posh/realpure.omp.yaml
Normal file
@ -0,0 +1,118 @@
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
|
||||
console_title: true
|
||||
console_title_style: template
|
||||
console_title_template: '{{if .Env.SSH_CONNECTION}} {{ .Host }} {{end}}{{.Path}}'
|
||||
final_space: false
|
||||
|
||||
blocks:
|
||||
- type: prompt
|
||||
alignment: left
|
||||
newline: false
|
||||
segments:
|
||||
|
||||
- type: session
|
||||
style: plain
|
||||
foreground: yellow
|
||||
properties:
|
||||
postfix: ""
|
||||
prefix: ""
|
||||
template: '{{if .SSHSession}}@{{ .ComputerName }} {{end}}'
|
||||
|
||||
|
||||
- type: root
|
||||
style: plain
|
||||
foreground: yellow
|
||||
properties:
|
||||
postfix: ""
|
||||
prefix: ""
|
||||
root_icon: "\u26A1"
|
||||
# root_icon: "# "
|
||||
|
||||
|
||||
- type: path
|
||||
style: plain
|
||||
# style: agnoster_left
|
||||
max_depth: 2
|
||||
foreground: lightBlue
|
||||
properties:
|
||||
prefix: ""
|
||||
style: full
|
||||
|
||||
- type: git
|
||||
style: plain
|
||||
foreground: yellow
|
||||
properties:
|
||||
branch_ahead_icon: <#88C0D0>⇡</>
|
||||
branch_behind_icon: <#88C0D0>⇣</>
|
||||
branch_icon: ""
|
||||
display_status: true
|
||||
fetch_status: true
|
||||
prefix: ""
|
||||
template: '{{ .HEAD }}{{.BranchStatus}}{{ if .Working.Changed }}<#FF0000>* {{ .Working.String }}</>{{ end }}'
|
||||
# template: '{{.BranchStatus}}{{ if .Working.Changed }}<#FF0000>* {{ .Working.String }}</>{{ end }}'
|
||||
|
||||
- type: executiontime
|
||||
style: plain
|
||||
foreground: yellow
|
||||
properties:
|
||||
always_enabled: false
|
||||
postfix: ""
|
||||
prefix: " "
|
||||
style: austin
|
||||
threshold: 30000
|
||||
|
||||
- type: prompt
|
||||
alignment: right
|
||||
segments:
|
||||
|
||||
- type: aws
|
||||
style: plain
|
||||
foreground: "#ffA000"
|
||||
properties:
|
||||
postfix: ""
|
||||
# prefix: " "
|
||||
prefix: " "
|
||||
template: '{{if .Profile}}{{.Profile}}{{end}}'
|
||||
|
||||
- type: kubectl
|
||||
style: plain
|
||||
foreground: lightBlue
|
||||
properties:
|
||||
parse_kubeconfig: true
|
||||
postfix: ""
|
||||
prefix: " "
|
||||
template: '{{if eq "on" .Env.KUBE_PS1_ENABLED}}|{{.Context}}/{{if .Namespace}}{{.Namespace}}{{else}}default{{end}}|{{end}}'
|
||||
|
||||
# - type: command
|
||||
# style: plain
|
||||
# foreground: white
|
||||
# properties:
|
||||
# shell: /bin/sh
|
||||
# # command: "ifconfig utun2 > /dev/null 2>&1 && echo '\uF023' || echo ''"
|
||||
# # command: "ifconfig utun2 > /dev/null 2>&1 && echo '<#00FF00>\u2713</>' || echo '\u2717'"
|
||||
# command: "ifconfig utun2 > /dev/null 2>&1 && echo '<#00FF00>\u2713</>' || echo ' '"
|
||||
|
||||
|
||||
- type: prompt
|
||||
alignment: left
|
||||
newline: true
|
||||
segments:
|
||||
|
||||
- type: python
|
||||
style: plain
|
||||
foreground: darkGray
|
||||
properties:
|
||||
display_version: false
|
||||
postfix: ""
|
||||
prefix: ""
|
||||
|
||||
- type: exit
|
||||
style: plain
|
||||
foreground: lightYellow
|
||||
foreground_templates:
|
||||
- '{{ if gt .Code 0 }}#FF0000{{ end }}'
|
||||
properties:
|
||||
always_enabled: true
|
||||
prefix: ""
|
||||
# template: ❯
|
||||
template: "\u276F"
|
876
starship/mine.toml
Normal file
876
starship/mine.toml
Normal file
@ -0,0 +1,876 @@
|
||||
"$schema" = 'https://starship.rs/config-schema.json'
|
||||
|
||||
# $all is shorthand for $username$hostname$shlvl$singularity$kubernetes$directory$vcsh$git_branch$git_commit$git_state$git_metrics$git_status$hg_branch$docker_context$package$cmake$cobol$dart$deno$dotnet$elixir$elm$erlang$golang$helm$java$julia$kotlin$lua$nim$nodejs$ocaml$perl$php$pulumi$purescript$python$rlang$red$ruby$rust$scala$swift$terraform$vlang$vagrant$zig$nix_shell$conda$memory_usage$aws$gcloud$openstack$azure$env_var$crystal$custom$sudo$cmd_duration$line_break$jobs$battery$time$status$shell$character
|
||||
# format = '$all'
|
||||
format = """
|
||||
${custom.vpn}\
|
||||
${custom.root}\
|
||||
$hostname\
|
||||
$jobs\
|
||||
$directory\
|
||||
$git_branch\
|
||||
$git_commit\
|
||||
$git_state\
|
||||
$git_status\
|
||||
$git_metrics\
|
||||
$cmd_duration\
|
||||
$fill\
|
||||
$aws\
|
||||
$kubernetes\
|
||||
$line_break\
|
||||
$python\
|
||||
$character"""
|
||||
|
||||
# right_format = """
|
||||
# ${custom.local_title}\
|
||||
# ${custom.remote_title}"""
|
||||
|
||||
scan_timeout = 30
|
||||
command_timeout = 500
|
||||
add_newline = false
|
||||
|
||||
palette = 'extras'
|
||||
|
||||
[palettes.extras]
|
||||
aws_fg = '#202020'
|
||||
aws_bg = '#ff9900'
|
||||
|
||||
k8s_fg = '#d0d0d0'
|
||||
k8s_bg = '#3970e4'
|
||||
|
||||
[aws]
|
||||
# format = '[$symbol($profile )(\($region\) )(\[$duration\])]($style)'
|
||||
# format = '[$symbol ($profile)(/($region)) ]($style)'
|
||||
format = '[ $symbol($profile)(/($region)) ]($style)'
|
||||
# symbol = '☁️ '
|
||||
# symbol = ' '
|
||||
symbol = ' '
|
||||
style = 'bold aws_fg bg:aws_bg'
|
||||
disabled = false
|
||||
expiration_symbol = 'X'
|
||||
|
||||
[aws.region_aliases]
|
||||
eu-west-1 = "ire1"
|
||||
eu-central-1 = "fra1"
|
||||
us-east-2 = "ohio1"
|
||||
|
||||
[azure]
|
||||
format = 'on [$symbol($subscription)]($style) '
|
||||
symbol = 'ﴃ '
|
||||
style = 'blue bold'
|
||||
disabled = true
|
||||
|
||||
[battery]
|
||||
full_symbol = ' '
|
||||
charging_symbol = ' '
|
||||
discharging_symbol = ' '
|
||||
unknown_symbol = ' '
|
||||
empty_symbol = ' '
|
||||
disabled = false
|
||||
format = '[$symbol$percentage]($style) '
|
||||
|
||||
[[battery.display]]
|
||||
threshold = 10
|
||||
style = 'red bold'
|
||||
|
||||
[character]
|
||||
format = '$symbol '
|
||||
success_symbol = '[❯](bright-yellow)'
|
||||
error_symbol = '[❯](bold red)'
|
||||
vicmd_symbol = '[❮](bright-yellow)'
|
||||
disabled = false
|
||||
|
||||
[cmake]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '△ '
|
||||
style = 'bold blue'
|
||||
disabled = false
|
||||
detect_extensions = []
|
||||
detect_files = [
|
||||
'CMakeLists.txt',
|
||||
'CMakeCache.txt',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[cmd_duration]
|
||||
min_time = 30_000
|
||||
format = '[$duration]($style) '
|
||||
style = 'yellow'
|
||||
show_milliseconds = false
|
||||
disabled = false
|
||||
show_notifications = false
|
||||
|
||||
[cobol]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '⚙️ '
|
||||
style = 'bold blue'
|
||||
disabled = false
|
||||
detect_extensions = [
|
||||
'cbl',
|
||||
'cob',
|
||||
'CBL',
|
||||
'COB',
|
||||
]
|
||||
detect_files = []
|
||||
detect_folders = []
|
||||
|
||||
[conda]
|
||||
truncation_length = 1
|
||||
format = 'via [$symbol$environment]($style) '
|
||||
symbol = '🅒 '
|
||||
style = 'green bold'
|
||||
ignore_base = true
|
||||
disabled = false
|
||||
|
||||
[crystal]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🔮 '
|
||||
style = 'bold red'
|
||||
disabled = false
|
||||
detect_extensions = ['cr']
|
||||
detect_files = ['shard.yml']
|
||||
detect_folders = []
|
||||
|
||||
[dart]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🎯 '
|
||||
style = 'bold blue'
|
||||
disabled = false
|
||||
detect_extensions = ['dart']
|
||||
detect_files = [
|
||||
'pubspec.yaml',
|
||||
'pubspec.yml',
|
||||
'pubspec.lock',
|
||||
]
|
||||
detect_folders = ['.dart_tool']
|
||||
|
||||
[deno]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🦕 '
|
||||
style = 'green bold'
|
||||
disabled = false
|
||||
detect_extensions = []
|
||||
detect_files = [
|
||||
'mod.ts',
|
||||
'deps.ts',
|
||||
'mod.js',
|
||||
'deps.js',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[directory]
|
||||
truncation_length = 5
|
||||
truncate_to_repo = true
|
||||
repo_root_style = "underline italic bold blue"
|
||||
fish_style_pwd_dir_length = 0
|
||||
use_logical_path = true
|
||||
format = '[$path]($style)[$read_only]($read_only_style) '
|
||||
# repo_root_format = '[$before_root_path]($style)[$repo_root]($repo_root_style)[$path]($style)[$read_only]($read_only_style) '
|
||||
style = 'blue bold'
|
||||
disabled = false
|
||||
read_only = " \u2718"
|
||||
read_only_style = 'bright-red bold'
|
||||
truncation_symbol = '.../'
|
||||
home_symbol = '~'
|
||||
|
||||
[directory.substitutions]
|
||||
|
||||
[docker_context]
|
||||
symbol = '🐳 '
|
||||
style = 'blue bold'
|
||||
format = 'via [$symbol$context]($style) '
|
||||
only_with_files = true
|
||||
disabled = true
|
||||
detect_extensions = []
|
||||
detect_files = [
|
||||
'docker-compose.yml',
|
||||
'docker-compose.yaml',
|
||||
'Dockerfile',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[dotnet]
|
||||
format = 'via [$symbol($version )(🎯 $tfm )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '.NET '
|
||||
style = 'blue bold'
|
||||
heuristic = true
|
||||
disabled = false
|
||||
detect_extensions = [
|
||||
'csproj',
|
||||
'fsproj',
|
||||
'xproj',
|
||||
]
|
||||
detect_files = [
|
||||
'global.json',
|
||||
'project.json',
|
||||
'Directory.Build.props',
|
||||
'Directory.Build.targets',
|
||||
'Packages.props',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[elixir]
|
||||
format = 'via [$symbol($version \(OTP $otp_version\) )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '💧 '
|
||||
style = 'bold purple'
|
||||
disabled = false
|
||||
detect_extensions = []
|
||||
detect_files = ['mix.exs']
|
||||
detect_folders = []
|
||||
|
||||
[elm]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🌳 '
|
||||
style = 'cyan bold'
|
||||
disabled = false
|
||||
detect_extensions = ['elm']
|
||||
detect_files = [
|
||||
'elm.json',
|
||||
'elm-package.json',
|
||||
'.elm-version',
|
||||
]
|
||||
detect_folders = ['elm-stuff']
|
||||
|
||||
[env_var]
|
||||
|
||||
[erlang]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = ' '
|
||||
style = 'bold red'
|
||||
disabled = false
|
||||
detect_extensions = []
|
||||
detect_files = [
|
||||
'rebar.config',
|
||||
'erlang.mk',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[fill]
|
||||
style = 'bold black'
|
||||
symbol = ' '
|
||||
disabled = false
|
||||
|
||||
[gcloud]
|
||||
format = 'on [$symbol$account(@$domain)(\($region\))]($style) '
|
||||
symbol = '☁️ '
|
||||
style = 'bold blue'
|
||||
disabled = false
|
||||
|
||||
[gcloud.region_aliases]
|
||||
|
||||
[git_branch]
|
||||
format = '[$symbol$branch]($style)(:[$remote]($style)) '
|
||||
symbol = ' '
|
||||
style = 'yellow'
|
||||
truncation_length = 9223372036854775807
|
||||
truncation_symbol = '…'
|
||||
only_attached = false
|
||||
always_show_remote = false
|
||||
disabled = false
|
||||
|
||||
[git_commit]
|
||||
commit_hash_length = 7
|
||||
format = '[\($hash$tag\)]($style) '
|
||||
style = 'green bold'
|
||||
only_detached = true
|
||||
disabled = false
|
||||
tag_symbol = ' 🏷 '
|
||||
tag_disabled = true
|
||||
|
||||
[git_metrics]
|
||||
added_style = 'bold green'
|
||||
deleted_style = 'bold red'
|
||||
only_nonzero_diffs = true
|
||||
format = '([+$added]($added_style) )([-$deleted]($deleted_style) )'
|
||||
disabled = true
|
||||
|
||||
[git_state]
|
||||
rebase = 'REBASING'
|
||||
merge = 'MERGING'
|
||||
revert = 'REVERTING'
|
||||
cherry_pick = 'CHERRY-PICKING'
|
||||
bisect = 'BISECTING'
|
||||
am = 'AM'
|
||||
am_or_rebase = 'AM/REBASE'
|
||||
style = 'bold yellow'
|
||||
format = '\([$state( $progress_current/$progress_total)]($style)\) '
|
||||
disabled = false
|
||||
|
||||
[git_status]
|
||||
format = '([\[$all_status$ahead_behind\]]($style) )'
|
||||
style = 'red bold'
|
||||
stashed = '\$'
|
||||
ahead = '⇡'
|
||||
behind = '⇣'
|
||||
up_to_date = ''
|
||||
diverged = '⇕'
|
||||
conflicted = '='
|
||||
deleted = '✘'
|
||||
renamed = '»'
|
||||
modified = '!'
|
||||
staged = '+'
|
||||
untracked = '?'
|
||||
disabled = false
|
||||
|
||||
[golang]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🐹 '
|
||||
style = 'bold cyan'
|
||||
disabled = false
|
||||
detect_extensions = ['go']
|
||||
detect_files = [
|
||||
'go.mod',
|
||||
'go.sum',
|
||||
'glide.yaml',
|
||||
'Gopkg.yml',
|
||||
'Gopkg.lock',
|
||||
'.go-version',
|
||||
]
|
||||
detect_folders = ['Godeps']
|
||||
|
||||
[helm]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '⎈ '
|
||||
style = 'bold white'
|
||||
disabled = false
|
||||
detect_extensions = []
|
||||
detect_files = [
|
||||
'helmfile.yaml',
|
||||
'Chart.yaml',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[hg_branch]
|
||||
symbol = ' '
|
||||
style = 'bold purple'
|
||||
format = 'on [$symbol$branch]($style) '
|
||||
truncation_length = 9223372036854775807
|
||||
truncation_symbol = '…'
|
||||
disabled = true
|
||||
|
||||
[hostname]
|
||||
ssh_only = true
|
||||
trim_at = '.'
|
||||
format = '|[$hostname]($style)| '
|
||||
style = 'white'
|
||||
disabled = false
|
||||
|
||||
[java]
|
||||
disabled = false
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
style = 'red dimmed'
|
||||
symbol = '☕ '
|
||||
detect_extensions = [
|
||||
'java',
|
||||
'class',
|
||||
'jar',
|
||||
'gradle',
|
||||
'clj',
|
||||
'cljc',
|
||||
]
|
||||
detect_files = [
|
||||
'pom.xml',
|
||||
'build.gradle.kts',
|
||||
'build.sbt',
|
||||
'.java-version',
|
||||
'deps.edn',
|
||||
'project.clj',
|
||||
'build.boot',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[jobs]
|
||||
threshold = 1
|
||||
symbol_threshold = 1
|
||||
number_threshold = 2
|
||||
format = '[$symbol$number]($style) '
|
||||
# symbol = '✦'
|
||||
symbol = "\u2622"
|
||||
style = 'bold bright-yellow'
|
||||
disabled = false
|
||||
|
||||
[julia]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = 'ஃ '
|
||||
style = 'bold purple'
|
||||
disabled = false
|
||||
detect_extensions = ['jl']
|
||||
detect_files = [
|
||||
'Project.toml',
|
||||
'Manifest.toml',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[kotlin]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🅺 '
|
||||
style = 'bold blue'
|
||||
kotlin_binary = 'kotlin'
|
||||
disabled = false
|
||||
detect_extensions = [
|
||||
'kt',
|
||||
'kts',
|
||||
]
|
||||
detect_files = []
|
||||
detect_folders = []
|
||||
|
||||
[kubernetes]
|
||||
symbol = '☸ '
|
||||
format = '[ $symbol$context::$namespace ]($style)'
|
||||
style = 'bold k8s_fg bg:k8s_bg'
|
||||
disabled = false
|
||||
|
||||
[[kubernetes.contexts]]
|
||||
context_pattern = "prod01.jafx-ire1.lan"
|
||||
style = 'bold bright-yellow bg:k8s_bg'
|
||||
context_alias = "prod01"
|
||||
|
||||
[[kubernetes.contexts]]
|
||||
context_pattern = "preprod01.jafx-ire1.lan"
|
||||
context_alias = "preprod01"
|
||||
|
||||
[[kubernetes.contexts]]
|
||||
context_pattern = "test01.jafx-ire1.lan"
|
||||
style = 'bold green bg:k8s_bg'
|
||||
context_alias = "test01"
|
||||
|
||||
[[kubernetes.contexts]]
|
||||
context_pattern = "infra01.arr.lan"
|
||||
context_alias = "infra01"
|
||||
|
||||
[[kubernetes.contexts]]
|
||||
context_pattern = "k3s.ifson.lan"
|
||||
context_alias = "k3s"
|
||||
|
||||
# [kubernetes.context_aliases]
|
||||
# 'preprod01.jafx-ire1.lan' = 'preprod01'
|
||||
# 'prod01.jafx-ire1.lan' = 'prod01'
|
||||
# 'test01.jafx-ire1.lan' = 'test01'
|
||||
# 'infra01.arr.lan' = 'infra01'
|
||||
|
||||
[line_break]
|
||||
disabled = false
|
||||
|
||||
[lua]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🌙 '
|
||||
style = 'bold blue'
|
||||
lua_binary = 'lua'
|
||||
disabled = false
|
||||
detect_extensions = ['lua']
|
||||
detect_files = ['.lua-version']
|
||||
detect_folders = ['lua']
|
||||
|
||||
[memory_usage]
|
||||
threshold = 75
|
||||
format = 'via $symbol[$ram( | $swap)]($style) '
|
||||
style = 'white bold dimmed'
|
||||
symbol = '🐏 '
|
||||
disabled = false
|
||||
|
||||
[nim]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '👑 '
|
||||
style = 'yellow bold'
|
||||
disabled = false
|
||||
detect_extensions = [
|
||||
'nim',
|
||||
'nims',
|
||||
'nimble',
|
||||
]
|
||||
detect_files = ['nim.cfg']
|
||||
detect_folders = []
|
||||
|
||||
[nix_shell]
|
||||
format = 'via [$symbol$state( \($name\))]($style) '
|
||||
symbol = '❄️ '
|
||||
style = 'bold blue'
|
||||
impure_msg = 'impure'
|
||||
pure_msg = 'pure'
|
||||
disabled = false
|
||||
|
||||
[nodejs]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = ' '
|
||||
style = 'bold green'
|
||||
disabled = false
|
||||
not_capable_style = 'bold red'
|
||||
detect_extensions = [
|
||||
'js',
|
||||
'mjs',
|
||||
'cjs',
|
||||
'ts',
|
||||
]
|
||||
detect_files = [
|
||||
'package.json',
|
||||
'.node-version',
|
||||
'.nvmrc',
|
||||
]
|
||||
detect_folders = ['node_modules']
|
||||
|
||||
[ocaml]
|
||||
format = 'via [$symbol($version )(\($switch_indicator$switch_name\) )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
global_switch_indicator = ''
|
||||
local_switch_indicator = '*'
|
||||
symbol = '🐫 '
|
||||
style = 'bold yellow'
|
||||
disabled = false
|
||||
detect_extensions = [
|
||||
'opam',
|
||||
'ml',
|
||||
'mli',
|
||||
're',
|
||||
'rei',
|
||||
]
|
||||
detect_files = [
|
||||
'dune',
|
||||
'dune-project',
|
||||
'jbuild',
|
||||
'jbuild-ignore',
|
||||
'.merlin',
|
||||
]
|
||||
detect_folders = [
|
||||
'_opam',
|
||||
'esy.lock',
|
||||
]
|
||||
|
||||
[openstack]
|
||||
format = 'on [$symbol$cloud(\($project\))]($style) '
|
||||
symbol = '☁️ '
|
||||
style = 'bold yellow'
|
||||
disabled = false
|
||||
|
||||
[package]
|
||||
format = 'is [$symbol$version]($style) '
|
||||
symbol = '📦 '
|
||||
style = '208 bold'
|
||||
display_private = false
|
||||
disabled = false
|
||||
version_format = 'v${raw}'
|
||||
|
||||
[perl]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🐪 '
|
||||
style = '149 bold'
|
||||
disabled = false
|
||||
detect_extensions = [
|
||||
'pl',
|
||||
'pm',
|
||||
'pod',
|
||||
]
|
||||
detect_files = [
|
||||
'Makefile.PL',
|
||||
'Build.PL',
|
||||
'cpanfile',
|
||||
'cpanfile.snapshot',
|
||||
'META.json',
|
||||
'META.yml',
|
||||
'.perl-version',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[php]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🐘 '
|
||||
style = '147 bold'
|
||||
disabled = false
|
||||
detect_extensions = ['php']
|
||||
detect_files = [
|
||||
'composer.json',
|
||||
'.php-version',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[pulumi]
|
||||
format = 'via [$symbol$stack]($style) '
|
||||
version_format = 'v${raw}'
|
||||
symbol = ' '
|
||||
style = 'bold 5'
|
||||
disabled = false
|
||||
|
||||
[purescript]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '<=> '
|
||||
style = 'bold white'
|
||||
disabled = false
|
||||
detect_extensions = ['purs']
|
||||
detect_files = ['spago.dhall']
|
||||
detect_folders = []
|
||||
|
||||
[python]
|
||||
pyenv_version_name = false
|
||||
pyenv_prefix = 'pyenv '
|
||||
python_binary = [
|
||||
'python3',
|
||||
'python'
|
||||
]
|
||||
# format = 'via [${symbol}${pyenv_prefix}(${version} )(\($virtualenv\) )]($style)'
|
||||
format = '[($virtualenv:)${version}]($style)'
|
||||
# version_format = '${raw}'
|
||||
version_format = '${major}.${minor}'
|
||||
style = 'bright-black'
|
||||
# symbol = '🐍 '
|
||||
# symbol = ''
|
||||
# symbol = ''
|
||||
disabled = false
|
||||
detect_extensions = ['py']
|
||||
detect_files = [
|
||||
'requirements.txt',
|
||||
'.python-version',
|
||||
'pyproject.toml',
|
||||
'Pipfile',
|
||||
'tox.ini',
|
||||
'setup.py',
|
||||
'__init__.py',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[red]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🔺 '
|
||||
style = 'red bold'
|
||||
disabled = false
|
||||
detect_extensions = [
|
||||
'red',
|
||||
'reds',
|
||||
]
|
||||
detect_files = []
|
||||
detect_folders = []
|
||||
|
||||
[rlang]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
style = 'blue bold'
|
||||
symbol = '📐 '
|
||||
disabled = false
|
||||
detect_extensions = [
|
||||
'R',
|
||||
'Rd',
|
||||
'Rmd',
|
||||
'Rproj',
|
||||
'Rsx',
|
||||
]
|
||||
detect_files = ['.Rprofile']
|
||||
detect_folders = ['.Rproj.user']
|
||||
|
||||
[ruby]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '💎 '
|
||||
style = 'bold red'
|
||||
disabled = false
|
||||
detect_extensions = ['rb']
|
||||
detect_files = [
|
||||
'Gemfile',
|
||||
'.ruby-version',
|
||||
]
|
||||
detect_folders = []
|
||||
detect_variables = [
|
||||
'RUBY_VERSION',
|
||||
'RBENV_VERSION',
|
||||
]
|
||||
|
||||
[rust]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🦀 '
|
||||
style = 'bold red'
|
||||
disabled = false
|
||||
detect_extensions = ['rs']
|
||||
detect_files = ['Cargo.toml']
|
||||
detect_folders = []
|
||||
|
||||
[scala]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
disabled = false
|
||||
style = 'red bold'
|
||||
symbol = '🆂 '
|
||||
detect_extensions = [
|
||||
'sbt',
|
||||
'scala',
|
||||
]
|
||||
detect_files = [
|
||||
'.scalaenv',
|
||||
'.sbtenv',
|
||||
'build.sbt',
|
||||
]
|
||||
detect_folders = ['.metals']
|
||||
|
||||
[shell]
|
||||
format = '[$indicator]($style) '
|
||||
bash_indicator = 'bsh'
|
||||
fish_indicator = 'fsh'
|
||||
zsh_indicator = 'zsh'
|
||||
powershell_indicator = 'psh'
|
||||
ion_indicator = 'ion'
|
||||
elvish_indicator = 'esh'
|
||||
tcsh_indicator = 'tsh'
|
||||
nu_indicator = 'nu'
|
||||
xonsh_indicator = 'xsh'
|
||||
unknown_indicator = ''
|
||||
style = 'white bold'
|
||||
disabled = true
|
||||
|
||||
[shlvl]
|
||||
threshold = 2
|
||||
format = '[$symbol$shlvl]($style) '
|
||||
symbol = '↕️ '
|
||||
repeat = false
|
||||
style = 'bold yellow'
|
||||
disabled = true
|
||||
|
||||
[singularity]
|
||||
symbol = ''
|
||||
format = '[$symbol\[$env\]]($style) '
|
||||
style = 'blue bold dimmed'
|
||||
disabled = false
|
||||
|
||||
[status]
|
||||
format = '[$symbol$status]($style) '
|
||||
symbol = '✖'
|
||||
success_symbol = '✔️'
|
||||
not_executable_symbol = '🚫'
|
||||
not_found_symbol = '🔍'
|
||||
sigint_symbol = '🧱'
|
||||
signal_symbol = '⚡'
|
||||
style = 'bold red'
|
||||
map_symbol = true
|
||||
recognize_signal_code = true
|
||||
pipestatus = false
|
||||
pipestatus_separator = '|'
|
||||
pipestatus_format = '\[$pipestatus\] => [$symbol$common_meaning$signal_name$maybe_int]($style)'
|
||||
disabled = true
|
||||
|
||||
[sudo]
|
||||
format = '[as $symbol]($style)'
|
||||
symbol = '🧙 '
|
||||
style = 'bold blue'
|
||||
allow_windows = false
|
||||
disabled = true
|
||||
|
||||
[swift]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🐦 '
|
||||
style = 'bold 202'
|
||||
disabled = false
|
||||
detect_extensions = ['swift']
|
||||
detect_files = ['Package.swift']
|
||||
detect_folders = []
|
||||
|
||||
[terraform]
|
||||
format = '[$symbol$version]($style)'
|
||||
version_format = '${raw}'
|
||||
symbol = '💠 '
|
||||
style = 'bold 105'
|
||||
disabled = false
|
||||
detect_extensions = [
|
||||
'tf',
|
||||
'tfplan',
|
||||
'tfstate',
|
||||
]
|
||||
detect_files = []
|
||||
detect_folders = ['.terraform']
|
||||
|
||||
[time]
|
||||
format = 'at [$time]($style) '
|
||||
style = 'bold yellow'
|
||||
use_12hr = false
|
||||
disabled = true
|
||||
utc_time_offset = 'local'
|
||||
time_range = '-'
|
||||
|
||||
[username]
|
||||
format = '[$user]($style)'
|
||||
style_root = 'red bold'
|
||||
style_user = 'yellow bold'
|
||||
show_always = false
|
||||
disabled = false
|
||||
|
||||
[vagrant]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '⍱ '
|
||||
style = 'cyan bold'
|
||||
disabled = false
|
||||
detect_extensions = []
|
||||
detect_files = ['Vagrantfile']
|
||||
detect_folders = []
|
||||
|
||||
[vcsh]
|
||||
symbol = ''
|
||||
style = 'bold yellow'
|
||||
format = 'vcsh [$symbol$repo]($style) '
|
||||
disabled = false
|
||||
|
||||
[vlang]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = 'V '
|
||||
style = 'blue bold'
|
||||
disabled = false
|
||||
detect_extensions = ['v']
|
||||
detect_files = [
|
||||
'v.mod',
|
||||
'vpkg.json',
|
||||
'.vpkg-lock.json',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[zig]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '↯ '
|
||||
style = 'bold yellow'
|
||||
disabled = false
|
||||
detect_extensions = ['zig']
|
||||
detect_files = []
|
||||
detect_folders = []
|
||||
|
||||
[custom]
|
||||
|
||||
[custom.vpn]
|
||||
description = "vpn status"
|
||||
command = "echo \uF023"
|
||||
# when = "ifconfig utun4 > /dev/null 2>&1"
|
||||
when = "pgrep openvpn"
|
||||
# format = "[$symbol($output)]($style)" # Remove extra blank after output
|
||||
# style = "green"
|
||||
style = "bright-green"
|
||||
|
||||
[custom.root]
|
||||
description = "show if user is root"
|
||||
command = "echo \u26A1"
|
||||
when = "[ $USER = 'root' ]"
|
||||
style = "bright-yellow"
|
||||
|
||||
[custom.window_title]
|
||||
description = "set window title"
|
||||
command = '[ -z $SSH_CLIENT] && print -Pn "\e]1;%2~\a" || print -Pn "\e]1;(%m) %2~\a"'
|
||||
# format = "[$symbol($output)]($style) " # Remove extra blank after output
|
||||
format="($output)"
|
||||
when = "true"
|
||||
|
838
starship/pureplus.toml
Normal file
838
starship/pureplus.toml
Normal file
@ -0,0 +1,838 @@
|
||||
# Warning: This config does not include keys that have an unset value
|
||||
|
||||
# $all is shorthand for $username$hostname$shlvl$singularity$kubernetes$directory$vcsh$git_branch$git_commit$git_state$git_metrics$git_status$hg_branch$docker_context$package$cmake$cobol$dart$deno$dotnet$elixir$elm$erlang$golang$helm$java$julia$kotlin$lua$nim$nodejs$ocaml$perl$php$pulumi$purescript$python$rlang$red$ruby$rust$scala$swift$terraform$vlang$vagrant$zig$nix_shell$conda$memory_usage$aws$gcloud$openstack$azure$env_var$crystal$custom$sudo$cmd_duration$line_break$jobs$battery$time$status$shell$character
|
||||
# format = '$all'
|
||||
format = """
|
||||
${custom.root}\
|
||||
$hostname\
|
||||
$jobs\
|
||||
$directory\
|
||||
$git_branch\
|
||||
$git_state\
|
||||
$git_status\
|
||||
$cmd_duration\
|
||||
$fill\
|
||||
$aws\
|
||||
$kubernetes\
|
||||
${custom.vpn}\
|
||||
$line_break\
|
||||
$python\
|
||||
$character"""
|
||||
|
||||
# right_format = """
|
||||
# ${custom.local_title}\
|
||||
# ${custom.remote_title}"""
|
||||
|
||||
scan_timeout = 30
|
||||
command_timeout = 500
|
||||
add_newline = false
|
||||
|
||||
[aws]
|
||||
# format = '[$symbol($profile )(\($region\) )(\[$duration\])]($style)'
|
||||
format = '[ $symbol($profile)(/($region)) ]($style)'
|
||||
# symbol = '☁️ '
|
||||
symbol = ' '
|
||||
# symbol = ' '
|
||||
style = 'inverted bright-yellow'
|
||||
disabled = false
|
||||
expiration_symbol = 'X'
|
||||
|
||||
[aws.region_aliases]
|
||||
eu-west-1 = "ire1"
|
||||
eu-central-1 = "fra1"
|
||||
us-east-2 = "ohio1"
|
||||
|
||||
[azure]
|
||||
format = 'on [$symbol($subscription)]($style) '
|
||||
symbol = 'ﴃ '
|
||||
style = 'blue bold'
|
||||
disabled = true
|
||||
|
||||
[battery]
|
||||
full_symbol = ' '
|
||||
charging_symbol = ' '
|
||||
discharging_symbol = ' '
|
||||
unknown_symbol = ' '
|
||||
empty_symbol = ' '
|
||||
disabled = false
|
||||
format = '[$symbol$percentage]($style) '
|
||||
|
||||
[[battery.display]]
|
||||
threshold = 10
|
||||
style = 'red bold'
|
||||
|
||||
[character]
|
||||
format = '$symbol '
|
||||
success_symbol = '[❯](bright-yellow)'
|
||||
error_symbol = '[❯](bold red)'
|
||||
vicmd_symbol = '[❮](bright-yellow)'
|
||||
disabled = false
|
||||
|
||||
[cmake]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '△ '
|
||||
style = 'bold blue'
|
||||
disabled = false
|
||||
detect_extensions = []
|
||||
detect_files = [
|
||||
'CMakeLists.txt',
|
||||
'CMakeCache.txt',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[cmd_duration]
|
||||
min_time = 30000
|
||||
format = '[$duration]($style) '
|
||||
style = 'yellow'
|
||||
show_milliseconds = false
|
||||
disabled = false
|
||||
show_notifications = false
|
||||
min_time_to_notify = 45000
|
||||
|
||||
[cobol]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '⚙️ '
|
||||
style = 'bold blue'
|
||||
disabled = false
|
||||
detect_extensions = [
|
||||
'cbl',
|
||||
'cob',
|
||||
'CBL',
|
||||
'COB',
|
||||
]
|
||||
detect_files = []
|
||||
detect_folders = []
|
||||
|
||||
[conda]
|
||||
truncation_length = 1
|
||||
format = 'via [$symbol$environment]($style) '
|
||||
symbol = '🅒 '
|
||||
style = 'green bold'
|
||||
ignore_base = true
|
||||
disabled = false
|
||||
|
||||
[crystal]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🔮 '
|
||||
style = 'bold red'
|
||||
disabled = false
|
||||
detect_extensions = ['cr']
|
||||
detect_files = ['shard.yml']
|
||||
detect_folders = []
|
||||
|
||||
[dart]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🎯 '
|
||||
style = 'bold blue'
|
||||
disabled = false
|
||||
detect_extensions = ['dart']
|
||||
detect_files = [
|
||||
'pubspec.yaml',
|
||||
'pubspec.yml',
|
||||
'pubspec.lock',
|
||||
]
|
||||
detect_folders = ['.dart_tool']
|
||||
|
||||
[deno]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🦕 '
|
||||
style = 'green bold'
|
||||
disabled = false
|
||||
detect_extensions = []
|
||||
detect_files = [
|
||||
'mod.ts',
|
||||
'deps.ts',
|
||||
'mod.js',
|
||||
'deps.js',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[directory]
|
||||
truncation_length = 5
|
||||
truncate_to_repo = true
|
||||
repo_root_style = "underline italic bold blue"
|
||||
fish_style_pwd_dir_length = 0
|
||||
use_logical_path = true
|
||||
format = '[$path]($style)[$read_only]($read_only_style) '
|
||||
# repo_root_format = '[$before_root_path]($style)[$repo_root]($repo_root_style)[$path]($style)[$read_only]($read_only_style) '
|
||||
style = 'blue bold'
|
||||
disabled = false
|
||||
# read_only = '🔒'
|
||||
read_only = " \u2718"
|
||||
read_only_style = 'bright-red bold'
|
||||
truncation_symbol = '.../'
|
||||
home_symbol = '~'
|
||||
|
||||
[directory.substitutions]
|
||||
|
||||
[docker_context]
|
||||
symbol = '🐳 '
|
||||
style = 'blue bold'
|
||||
format = 'via [$symbol$context]($style) '
|
||||
only_with_files = true
|
||||
disabled = true
|
||||
detect_extensions = []
|
||||
detect_files = [
|
||||
'docker-compose.yml',
|
||||
'docker-compose.yaml',
|
||||
'Dockerfile',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[dotnet]
|
||||
format = 'via [$symbol($version )(🎯 $tfm )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '.NET '
|
||||
style = 'blue bold'
|
||||
heuristic = true
|
||||
disabled = false
|
||||
detect_extensions = [
|
||||
'csproj',
|
||||
'fsproj',
|
||||
'xproj',
|
||||
]
|
||||
detect_files = [
|
||||
'global.json',
|
||||
'project.json',
|
||||
'Directory.Build.props',
|
||||
'Directory.Build.targets',
|
||||
'Packages.props',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[elixir]
|
||||
format = 'via [$symbol($version \(OTP $otp_version\) )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '💧 '
|
||||
style = 'bold purple'
|
||||
disabled = false
|
||||
detect_extensions = []
|
||||
detect_files = ['mix.exs']
|
||||
detect_folders = []
|
||||
|
||||
[elm]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🌳 '
|
||||
style = 'cyan bold'
|
||||
disabled = false
|
||||
detect_extensions = ['elm']
|
||||
detect_files = [
|
||||
'elm.json',
|
||||
'elm-package.json',
|
||||
'.elm-version',
|
||||
]
|
||||
detect_folders = ['elm-stuff']
|
||||
|
||||
[env_var]
|
||||
|
||||
[erlang]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = ' '
|
||||
style = 'bold red'
|
||||
disabled = false
|
||||
detect_extensions = []
|
||||
detect_files = [
|
||||
'rebar.config',
|
||||
'erlang.mk',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[fill]
|
||||
style = 'bold black'
|
||||
symbol = ' '
|
||||
disabled = false
|
||||
|
||||
[gcloud]
|
||||
format = 'on [$symbol$account(@$domain)(\($region\))]($style) '
|
||||
symbol = '☁️ '
|
||||
style = 'bold blue'
|
||||
disabled = false
|
||||
|
||||
[gcloud.region_aliases]
|
||||
|
||||
[git_branch]
|
||||
format = '[$symbol$branch]($style)(:[$remote]($style)) '
|
||||
symbol = ' '
|
||||
style = 'yellow'
|
||||
truncation_length = 9223372036854775807
|
||||
truncation_symbol = '…'
|
||||
only_attached = false
|
||||
always_show_remote = false
|
||||
disabled = false
|
||||
|
||||
[git_commit]
|
||||
commit_hash_length = 7
|
||||
format = '[\($hash$tag\)]($style) '
|
||||
style = 'green bold'
|
||||
only_detached = true
|
||||
disabled = false
|
||||
tag_symbol = ' 🏷 '
|
||||
tag_disabled = true
|
||||
|
||||
[git_metrics]
|
||||
added_style = 'bold green'
|
||||
deleted_style = 'bold red'
|
||||
only_nonzero_diffs = true
|
||||
format = '([+$added]($added_style) )([-$deleted]($deleted_style) )'
|
||||
disabled = true
|
||||
|
||||
[git_state]
|
||||
rebase = 'REBASING'
|
||||
merge = 'MERGING'
|
||||
revert = 'REVERTING'
|
||||
cherry_pick = 'CHERRY-PICKING'
|
||||
bisect = 'BISECTING'
|
||||
am = 'AM'
|
||||
am_or_rebase = 'AM/REBASE'
|
||||
style = 'bold yellow'
|
||||
format = '\([$state( $progress_current/$progress_total)]($style)\) '
|
||||
disabled = false
|
||||
|
||||
[git_status]
|
||||
format = '([\[$all_status$ahead_behind\]]($style) )'
|
||||
style = 'red bold'
|
||||
stashed = '\$'
|
||||
ahead = '⇡'
|
||||
behind = '⇣'
|
||||
up_to_date = ''
|
||||
diverged = '⇕'
|
||||
conflicted = '='
|
||||
deleted = '✘'
|
||||
renamed = '»'
|
||||
modified = '!'
|
||||
staged = '+'
|
||||
untracked = '?'
|
||||
disabled = false
|
||||
|
||||
[golang]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🐹 '
|
||||
style = 'bold cyan'
|
||||
disabled = false
|
||||
detect_extensions = ['go']
|
||||
detect_files = [
|
||||
'go.mod',
|
||||
'go.sum',
|
||||
'glide.yaml',
|
||||
'Gopkg.yml',
|
||||
'Gopkg.lock',
|
||||
'.go-version',
|
||||
]
|
||||
detect_folders = ['Godeps']
|
||||
|
||||
[helm]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '⎈ '
|
||||
style = 'bold white'
|
||||
disabled = false
|
||||
detect_extensions = []
|
||||
detect_files = [
|
||||
'helmfile.yaml',
|
||||
'Chart.yaml',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[hg_branch]
|
||||
symbol = ' '
|
||||
style = 'bold purple'
|
||||
format = 'on [$symbol$branch]($style) '
|
||||
truncation_length = 9223372036854775807
|
||||
truncation_symbol = '…'
|
||||
disabled = true
|
||||
|
||||
[hostname]
|
||||
ssh_only = true
|
||||
trim_at = '.'
|
||||
format = '|[$hostname]($style)| '
|
||||
style = 'white'
|
||||
disabled = false
|
||||
|
||||
[java]
|
||||
disabled = false
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
style = 'red dimmed'
|
||||
symbol = '☕ '
|
||||
detect_extensions = [
|
||||
'java',
|
||||
'class',
|
||||
'jar',
|
||||
'gradle',
|
||||
'clj',
|
||||
'cljc',
|
||||
]
|
||||
detect_files = [
|
||||
'pom.xml',
|
||||
'build.gradle.kts',
|
||||
'build.sbt',
|
||||
'.java-version',
|
||||
'deps.edn',
|
||||
'project.clj',
|
||||
'build.boot',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[jobs]
|
||||
threshold = 1
|
||||
symbol_threshold = 1
|
||||
number_threshold = 2
|
||||
format = '[$symbol$number]($style) '
|
||||
# symbol = '✦'
|
||||
symbol = "\u2622"
|
||||
style = 'bold bright-blue'
|
||||
disabled = false
|
||||
|
||||
[julia]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = 'ஃ '
|
||||
style = 'bold purple'
|
||||
disabled = false
|
||||
detect_extensions = ['jl']
|
||||
detect_files = [
|
||||
'Project.toml',
|
||||
'Manifest.toml',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[kotlin]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🅺 '
|
||||
style = 'bold blue'
|
||||
kotlin_binary = 'kotlin'
|
||||
disabled = false
|
||||
detect_extensions = [
|
||||
'kt',
|
||||
'kts',
|
||||
]
|
||||
detect_files = []
|
||||
detect_folders = []
|
||||
|
||||
[kubernetes]
|
||||
symbol = '☸ '
|
||||
format = '[ $symbol$context/$namespace]($style) '
|
||||
style = 'inverted bold bright-blue'
|
||||
disabled = false
|
||||
|
||||
[kubernetes.context_aliases]
|
||||
|
||||
[line_break]
|
||||
disabled = false
|
||||
|
||||
[lua]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🌙 '
|
||||
style = 'bold blue'
|
||||
lua_binary = 'lua'
|
||||
disabled = false
|
||||
detect_extensions = ['lua']
|
||||
detect_files = ['.lua-version']
|
||||
detect_folders = ['lua']
|
||||
|
||||
[memory_usage]
|
||||
threshold = 75
|
||||
format = 'via $symbol[$ram( | $swap)]($style) '
|
||||
style = 'white bold dimmed'
|
||||
symbol = '🐏 '
|
||||
disabled = false
|
||||
|
||||
[nim]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '👑 '
|
||||
style = 'yellow bold'
|
||||
disabled = false
|
||||
detect_extensions = [
|
||||
'nim',
|
||||
'nims',
|
||||
'nimble',
|
||||
]
|
||||
detect_files = ['nim.cfg']
|
||||
detect_folders = []
|
||||
|
||||
[nix_shell]
|
||||
format = 'via [$symbol$state( \($name\))]($style) '
|
||||
symbol = '❄️ '
|
||||
style = 'bold blue'
|
||||
impure_msg = 'impure'
|
||||
pure_msg = 'pure'
|
||||
disabled = false
|
||||
|
||||
[nodejs]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = ' '
|
||||
style = 'bold green'
|
||||
disabled = false
|
||||
not_capable_style = 'bold red'
|
||||
detect_extensions = [
|
||||
'js',
|
||||
'mjs',
|
||||
'cjs',
|
||||
'ts',
|
||||
]
|
||||
detect_files = [
|
||||
'package.json',
|
||||
'.node-version',
|
||||
'.nvmrc',
|
||||
]
|
||||
detect_folders = ['node_modules']
|
||||
|
||||
[ocaml]
|
||||
format = 'via [$symbol($version )(\($switch_indicator$switch_name\) )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
global_switch_indicator = ''
|
||||
local_switch_indicator = '*'
|
||||
symbol = '🐫 '
|
||||
style = 'bold yellow'
|
||||
disabled = false
|
||||
detect_extensions = [
|
||||
'opam',
|
||||
'ml',
|
||||
'mli',
|
||||
're',
|
||||
'rei',
|
||||
]
|
||||
detect_files = [
|
||||
'dune',
|
||||
'dune-project',
|
||||
'jbuild',
|
||||
'jbuild-ignore',
|
||||
'.merlin',
|
||||
]
|
||||
detect_folders = [
|
||||
'_opam',
|
||||
'esy.lock',
|
||||
]
|
||||
|
||||
[openstack]
|
||||
format = 'on [$symbol$cloud(\($project\))]($style) '
|
||||
symbol = '☁️ '
|
||||
style = 'bold yellow'
|
||||
disabled = false
|
||||
|
||||
[package]
|
||||
format = 'is [$symbol$version]($style) '
|
||||
symbol = '📦 '
|
||||
style = '208 bold'
|
||||
display_private = false
|
||||
disabled = false
|
||||
version_format = 'v${raw}'
|
||||
|
||||
[perl]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🐪 '
|
||||
style = '149 bold'
|
||||
disabled = false
|
||||
detect_extensions = [
|
||||
'pl',
|
||||
'pm',
|
||||
'pod',
|
||||
]
|
||||
detect_files = [
|
||||
'Makefile.PL',
|
||||
'Build.PL',
|
||||
'cpanfile',
|
||||
'cpanfile.snapshot',
|
||||
'META.json',
|
||||
'META.yml',
|
||||
'.perl-version',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[php]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🐘 '
|
||||
style = '147 bold'
|
||||
disabled = false
|
||||
detect_extensions = ['php']
|
||||
detect_files = [
|
||||
'composer.json',
|
||||
'.php-version',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[pulumi]
|
||||
format = 'via [$symbol$stack]($style) '
|
||||
version_format = 'v${raw}'
|
||||
symbol = ' '
|
||||
style = 'bold 5'
|
||||
disabled = false
|
||||
|
||||
[purescript]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '<=> '
|
||||
style = 'bold white'
|
||||
disabled = false
|
||||
detect_extensions = ['purs']
|
||||
detect_files = ['spago.dhall']
|
||||
detect_folders = []
|
||||
|
||||
[python]
|
||||
pyenv_version_name = false
|
||||
pyenv_prefix = 'pyenv '
|
||||
python_binary = [
|
||||
'python',
|
||||
'python3',
|
||||
'python2',
|
||||
]
|
||||
# format = 'via [${symbol}${pyenv_prefix}(${version} )(\($virtualenv\) )]($style)'
|
||||
format = '[($virtualenv:)${version}]($style)'
|
||||
version_format = '${raw}'
|
||||
style = 'bright-black'
|
||||
# symbol = '🐍 '
|
||||
# symbol = ''
|
||||
symbol = ''
|
||||
disabled = false
|
||||
detect_extensions = ['py']
|
||||
detect_files = [
|
||||
'requirements.txt',
|
||||
'.python-version',
|
||||
'pyproject.toml',
|
||||
'Pipfile',
|
||||
'tox.ini',
|
||||
'setup.py',
|
||||
'__init__.py',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[red]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🔺 '
|
||||
style = 'red bold'
|
||||
disabled = false
|
||||
detect_extensions = [
|
||||
'red',
|
||||
'reds',
|
||||
]
|
||||
detect_files = []
|
||||
detect_folders = []
|
||||
|
||||
[rlang]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
style = 'blue bold'
|
||||
symbol = '📐 '
|
||||
disabled = false
|
||||
detect_extensions = [
|
||||
'R',
|
||||
'Rd',
|
||||
'Rmd',
|
||||
'Rproj',
|
||||
'Rsx',
|
||||
]
|
||||
detect_files = ['.Rprofile']
|
||||
detect_folders = ['.Rproj.user']
|
||||
|
||||
[ruby]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '💎 '
|
||||
style = 'bold red'
|
||||
disabled = false
|
||||
detect_extensions = ['rb']
|
||||
detect_files = [
|
||||
'Gemfile',
|
||||
'.ruby-version',
|
||||
]
|
||||
detect_folders = []
|
||||
detect_variables = [
|
||||
'RUBY_VERSION',
|
||||
'RBENV_VERSION',
|
||||
]
|
||||
|
||||
[rust]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🦀 '
|
||||
style = 'bold red'
|
||||
disabled = false
|
||||
detect_extensions = ['rs']
|
||||
detect_files = ['Cargo.toml']
|
||||
detect_folders = []
|
||||
|
||||
[scala]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
disabled = false
|
||||
style = 'red bold'
|
||||
symbol = '🆂 '
|
||||
detect_extensions = [
|
||||
'sbt',
|
||||
'scala',
|
||||
]
|
||||
detect_files = [
|
||||
'.scalaenv',
|
||||
'.sbtenv',
|
||||
'build.sbt',
|
||||
]
|
||||
detect_folders = ['.metals']
|
||||
|
||||
[shell]
|
||||
format = '[$indicator]($style) '
|
||||
bash_indicator = 'bsh'
|
||||
fish_indicator = 'fsh'
|
||||
zsh_indicator = 'zsh'
|
||||
powershell_indicator = 'psh'
|
||||
ion_indicator = 'ion'
|
||||
elvish_indicator = 'esh'
|
||||
tcsh_indicator = 'tsh'
|
||||
nu_indicator = 'nu'
|
||||
xonsh_indicator = 'xsh'
|
||||
unknown_indicator = ''
|
||||
style = 'white bold'
|
||||
disabled = true
|
||||
|
||||
[shlvl]
|
||||
threshold = 2
|
||||
format = '[$symbol$shlvl]($style) '
|
||||
symbol = '↕️ '
|
||||
repeat = false
|
||||
style = 'bold yellow'
|
||||
disabled = true
|
||||
|
||||
[singularity]
|
||||
symbol = ''
|
||||
format = '[$symbol\[$env\]]($style) '
|
||||
style = 'blue bold dimmed'
|
||||
disabled = false
|
||||
|
||||
[status]
|
||||
format = '[$symbol$status]($style) '
|
||||
symbol = '✖'
|
||||
success_symbol = '✔️'
|
||||
not_executable_symbol = '🚫'
|
||||
not_found_symbol = '🔍'
|
||||
sigint_symbol = '🧱'
|
||||
signal_symbol = '⚡'
|
||||
style = 'bold red'
|
||||
map_symbol = false
|
||||
recognize_signal_code = true
|
||||
pipestatus = false
|
||||
pipestatus_separator = '|'
|
||||
pipestatus_format = '\[$pipestatus\] => [$symbol$common_meaning$signal_name$maybe_int]($style)'
|
||||
disabled = true
|
||||
|
||||
[sudo]
|
||||
format = '[as $symbol]($style)'
|
||||
symbol = '🧙 '
|
||||
style = 'bold blue'
|
||||
allow_windows = false
|
||||
disabled = true
|
||||
|
||||
[swift]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '🐦 '
|
||||
style = 'bold 202'
|
||||
disabled = false
|
||||
detect_extensions = ['swift']
|
||||
detect_files = ['Package.swift']
|
||||
detect_folders = []
|
||||
|
||||
[terraform]
|
||||
format = '[$symbol$version]($style)'
|
||||
version_format = '${raw}'
|
||||
symbol = '💠 '
|
||||
style = 'bold 105'
|
||||
disabled = false
|
||||
detect_extensions = [
|
||||
'tf',
|
||||
'tfplan',
|
||||
'tfstate',
|
||||
]
|
||||
detect_files = []
|
||||
detect_folders = ['.terraform']
|
||||
|
||||
[time]
|
||||
format = 'at [$time]($style) '
|
||||
style = 'bold yellow'
|
||||
use_12hr = false
|
||||
disabled = true
|
||||
utc_time_offset = 'local'
|
||||
time_range = '-'
|
||||
|
||||
[username]
|
||||
format = '[$user]($style)'
|
||||
style_root = 'red bold'
|
||||
style_user = 'yellow bold'
|
||||
show_always = false
|
||||
disabled = false
|
||||
|
||||
[vagrant]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '⍱ '
|
||||
style = 'cyan bold'
|
||||
disabled = false
|
||||
detect_extensions = []
|
||||
detect_files = ['Vagrantfile']
|
||||
detect_folders = []
|
||||
|
||||
[vcsh]
|
||||
symbol = ''
|
||||
style = 'bold yellow'
|
||||
format = 'vcsh [$symbol$repo]($style) '
|
||||
disabled = false
|
||||
|
||||
[vlang]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = 'V '
|
||||
style = 'blue bold'
|
||||
disabled = false
|
||||
detect_extensions = ['v']
|
||||
detect_files = [
|
||||
'v.mod',
|
||||
'vpkg.json',
|
||||
'.vpkg-lock.json',
|
||||
]
|
||||
detect_folders = []
|
||||
|
||||
[zig]
|
||||
format = 'via [$symbol($version )]($style)'
|
||||
version_format = 'v${raw}'
|
||||
symbol = '↯ '
|
||||
style = 'bold yellow'
|
||||
disabled = false
|
||||
detect_extensions = ['zig']
|
||||
detect_files = []
|
||||
detect_folders = []
|
||||
|
||||
[custom]
|
||||
|
||||
[custom.vpn]
|
||||
description = "vpn status"
|
||||
command = "echo \uF023"
|
||||
when = "ifconfig utun3 > /dev/null 2>&1"
|
||||
# format = "[$symbol($output)]($style)" # Remove extra blank after output
|
||||
style = "green"
|
||||
|
||||
[custom.root]
|
||||
description = "show if user is root"
|
||||
command = "echo \u26A1"
|
||||
when = "[ $USER = 'root' ]"
|
||||
style = "bright-yellow"
|
||||
|
||||
[custom.window_title]
|
||||
description = "set window title"
|
||||
command = '[ -z $SSH_CLIENT] && print -Pn "\e]1;%2~\a" || print -Pn "\e]1;(%m) %2~\a"'
|
||||
# format = "[$symbol($output)]($style) " # Remove extra blank after output
|
||||
format="($output)"
|
||||
when = "true"
|
||||
|
@ -1,11 +1,8 @@
|
||||
# setopt ALL_EXPORT
|
||||
|
||||
setopt ALWAYS_TO_END
|
||||
setopt AUTONAMEDIRS
|
||||
setopt AUTO_PARAM_SLASH
|
||||
setopt AUTO_REMOVE_SLASH
|
||||
setopt AUTO_RESUME
|
||||
#setopt CDABLE_VARS
|
||||
unsetopt CDABLE_VARS
|
||||
setopt CORRECT
|
||||
setopt FUNCTION_ARGZERO
|
||||
@ -19,21 +16,23 @@ setopt HIST_NO_STORE
|
||||
setopt HIST_REDUCE_BLANKS
|
||||
setopt INC_APPEND_HISTORY
|
||||
setopt NO_HIST_BEEP
|
||||
# setopt SHARE_HISTORY
|
||||
|
||||
setopt LIST_TYPES
|
||||
setopt LONG_LIST_JOBS
|
||||
|
||||
#setopt no_CLOBBER
|
||||
|
||||
setopt no_BEEP
|
||||
setopt no_HUP
|
||||
setopt NOTIFY
|
||||
setopt PATH_DIRS
|
||||
setopt SHORT_LOOPS
|
||||
|
||||
setopt prompt_subst
|
||||
setopt PROMPT_SUBST
|
||||
|
||||
setopt AUTO_CD
|
||||
setopt AUTO_MENU
|
||||
setopt no_MENU_COMPLETE
|
||||
setopt AUTO_LIST
|
||||
|
||||
# vim: set ts=4 sw=4 tw=0 ft=zsh :
|
||||
|
@ -2,9 +2,6 @@
|
||||
# Variables
|
||||
|
||||
## Vars used always
|
||||
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$HOME/bin:."
|
||||
# LANG="it_IT.UTF-8"
|
||||
# TZ='Europe/Rome'
|
||||
MIBS=all
|
||||
LOGD=/var/log
|
||||
|
||||
@ -13,7 +10,7 @@ LOGD=/var/log
|
||||
|
||||
## Vars only for interactive sessions
|
||||
SAVEHIST=10000000
|
||||
HISTFILE=~/.history
|
||||
HISTFILE=~/.zsh_history
|
||||
HISTFILESIZE=10000000
|
||||
HISTSIZE=10000000
|
||||
|
||||
@ -27,10 +24,8 @@ EDITOR=vim
|
||||
VISUAL=vim
|
||||
|
||||
export QUOTING_STYLE=escape
|
||||
#
|
||||
# Hack for svn
|
||||
export SVN_EDITOR=${VISUAL}
|
||||
|
||||
# Set umask to collaborative mode
|
||||
umask 002
|
||||
|
||||
# vim: set ts=4 sw=4 tw=0 ft=zsh :
|
||||
|
@ -1,31 +1,65 @@
|
||||
#######################################################################################
|
||||
#
|
||||
|
||||
# By default we choose emacs mode
|
||||
bindkey "-e"
|
||||
|
||||
# Backward-kill-word stop on dir delimiter
|
||||
autoload -U select-word-style
|
||||
select-word-style bash
|
||||
|
||||
# History search
|
||||
autoload -Uz history-search-end
|
||||
|
||||
zle -N history-beginning-search-backward-end history-search-end
|
||||
zle -N history-beginning-search-forward-end history-search-end
|
||||
|
||||
# Command line editing in $EDITOR
|
||||
autoload -z edit-command-line
|
||||
zle -N edit-command-line
|
||||
bindkey "^X^E" edit-command-line
|
||||
|
||||
# Standard Linux
|
||||
bindkey "^[[1;5C" forward-word
|
||||
bindkey "^[[1;5D" backward-word
|
||||
|
||||
bindkey "^S" kill-line
|
||||
bindkey "^U" backward-kill-line
|
||||
|
||||
bindkey "\e[3~" delete-char
|
||||
|
||||
# Useful under iTerm
|
||||
bindkey "-e"
|
||||
bindkey "\eOH" beginning-of-line
|
||||
bindkey "\eOF" end-of-line
|
||||
bindkey "\e[H" beginning-of-line
|
||||
bindkey "\e[1~" beginning-of-line
|
||||
|
||||
bindkey "\e[F" end-of-line
|
||||
bindkey "\e[4~" end-of-line
|
||||
bindkey "\e[3~" delete-char
|
||||
bindkey "\eOA" history-search-backward
|
||||
bindkey "\eOB" history-search-forward
|
||||
|
||||
bindkey "\e[A" history-search-backward
|
||||
bindkey "\e[B" history-search-forward
|
||||
|
||||
# Required by Terminus in Sublime Text
|
||||
bindkey "\e[1;3C" forward-word
|
||||
bindkey "\e[1;3D" backward-word
|
||||
|
||||
|
||||
# VI mode history search
|
||||
bindkey -M vicmd '^[[A' history-beginning-search-backward-end \
|
||||
'^[OA' history-beginning-search-backward-end \
|
||||
'^[[B' history-beginning-search-forward-end \
|
||||
'^[OB' history-beginning-search-forward-end
|
||||
bindkey -M viins '^[[A' history-beginning-search-backward-end \
|
||||
'^[OA' history-beginning-search-backward-end \
|
||||
'^[[B' history-beginning-search-forward-end \
|
||||
'^[OB' history-beginning-search-forward-end
|
||||
|
||||
bindkey -M viins "\e[H" beginning-of-line \
|
||||
"\e[1~" beginning-of-line \
|
||||
"^A" beginning-of-line \
|
||||
"\e[F" end-of-line \
|
||||
"\e[4~" end-of-line \
|
||||
"^E" end-of-line
|
||||
|
||||
bindkey -M vicmd "\e[H" beginning-of-line \
|
||||
"\e[1~" beginning-of-line \
|
||||
"^A" beginning-of-line \
|
||||
"\e[F" end-of-line \
|
||||
"\e[4~" end-of-line \
|
||||
"^E" end-of-line
|
||||
|
||||
# vim: set ts=4 sw=4 tw=0 ft=zsh :
|
||||
|
@ -1,15 +1,15 @@
|
||||
#######################################################################################
|
||||
# Start autocomplete
|
||||
autoload -U compinit && compinit -u
|
||||
autoload -Uz compinit
|
||||
|
||||
for dump in ~/.zcompdump(N.mh+24); do
|
||||
compinit
|
||||
touch ~/.zcompdump
|
||||
done
|
||||
|
||||
compinit -C
|
||||
|
||||
autoload bashcompinit && bashcompinit
|
||||
# autoload -Uz compinit
|
||||
#if [ $(date +'%j') != $(stat -f '%Sm' -t '%j' ~/.zcompdump) ]; then
|
||||
# compinit -C
|
||||
# else
|
||||
# compinit -C
|
||||
# fi
|
||||
autoload -U compsys;
|
||||
compctl -g "*(-/)" + -g ".*(-/)" cd
|
||||
|
||||
# allow approximate
|
||||
zstyle ':completion:*' completer _complete _match _approximate
|
||||
@ -23,6 +23,4 @@ zstyle ':completion:*:kill:*' force-list always
|
||||
# # cd not select parent dir
|
||||
zstyle ':completion:*:cd:*' ignore-parents parent pwd
|
||||
|
||||
# compctl -g "*(-/)" + -g ".*(-/)" cd
|
||||
#
|
||||
# vim: set ts=4 sw=4 tw=0 ft=zsh :
|
||||
|
@ -1,7 +1,7 @@
|
||||
#######################################################################################
|
||||
# Aliases
|
||||
|
||||
alias ls='ls -F --color'
|
||||
# alias ls='ls -F --color'
|
||||
alias dir='ls -l'
|
||||
alias la='ls -A'
|
||||
alias ll='ls -l'
|
||||
@ -29,13 +29,14 @@ alias vi="vim "
|
||||
|
||||
alias du1="du -h --max-depth=1"
|
||||
alias psg="ps ax|grep "
|
||||
alias myip="dig +short myip.opendns.com @resolver1.opendns.com"
|
||||
alias myip="dig +short ANY @resolver1.opendns.com myip.opendns.com"
|
||||
|
||||
alias delkey="ssh-keygen -R "
|
||||
|
||||
# Global Aliases
|
||||
#
|
||||
alias -g G="|grep "
|
||||
alias -g K="-o yaml | kubectl neat | less"
|
||||
alias -g L="|less"
|
||||
alias -g NO="> /dev/null"
|
||||
alias -g NE="2> /dev/null"
|
||||
|
@ -18,6 +18,13 @@ PAGER=/usr/bin/less
|
||||
export LESS
|
||||
export PAGER
|
||||
|
||||
LESSOPEN="|lesspipe.sh %s"; export LESSOPEN
|
||||
local LESSOPEN_SCRIPT=$(whence lesspipe lesspipe.sh)
|
||||
if [ $LESSOPEN_SCRIPT ]; then
|
||||
LESSOPEN="|${LESSOPEN_SCRIPT} %s"
|
||||
LESS_ADVANCED_PREPROCESSOR=1
|
||||
|
||||
export LESSOPEN
|
||||
export LESS_ADVANCED_PREPROCESSOR
|
||||
fi
|
||||
|
||||
# vim: set ts=4 sw=4 tw=0 ft=zsh :
|
||||
|
@ -1,17 +1,18 @@
|
||||
fpath=($0:h/prompts $fpath)
|
||||
fpath+=$0:h/prompts/mypure
|
||||
fpath+=$0:h/prompts/pure
|
||||
# fpath+=$0:h/prompts/pure
|
||||
|
||||
autoload -U promptinit;promptinit
|
||||
|
||||
zstyle :prompt:pure:user color white
|
||||
zstyle :prompt:pure:host color white
|
||||
zstyle :prompt:pure:prompt:success color yellow
|
||||
|
||||
PURE_CMD_MAX_EXEC_TIME=30
|
||||
|
||||
# Default prompt is pure
|
||||
#
|
||||
# prompt mypure
|
||||
prompt pure
|
||||
# prompt pure
|
||||
|
||||
# vim: set ts=4 sw=4 tw=0 ft=zsh :
|
||||
# vim: set ts=4 sw=4 tw=0 ft=zsh :
|
||||
|
@ -1,29 +1,20 @@
|
||||
#######################################################################################
|
||||
# Functions
|
||||
|
||||
# cdb - Goes to folder by complete path
|
||||
autoload -U cdb
|
||||
|
||||
# hist - Grep from history
|
||||
autoload -U hist
|
||||
|
||||
# hdu - Human readable report of files and directories sizes
|
||||
autoload -U hdu
|
||||
|
||||
# dust - list total size in . directory
|
||||
autoload -U dust
|
||||
|
||||
# bak - remove backup files
|
||||
autoload -U bak
|
||||
#
|
||||
# fancyTerm - returns true if we are on xterm/rxvt/screen, elsewhere false
|
||||
autoload -U fancyTerm
|
||||
#
|
||||
#
|
||||
#
|
||||
# Load usefule modules
|
||||
|
||||
# # repo_char - returns a character based on the type of repo we are in
|
||||
# autoload -U repo_char
|
||||
zmodload -F zsh/stat b:zstat
|
||||
zmodload zsh/datetime
|
||||
#
|
||||
# Autoload all functions in zshfunctions
|
||||
#
|
||||
autoload -U $LIBRARY/zshfunctions/*(.:t)
|
||||
|
||||
autoload -U x509
|
||||
# Add zsh-hook function
|
||||
autoload -Uz add-zsh-hook
|
||||
|
||||
autoload -U awslogin
|
||||
|
||||
# vim: set ts=4 sw=4 tw=0 ft=zsh :
|
||||
# Add async support
|
||||
autoload -Uz async && async
|
||||
|
30
zsh.d/60-hooks.zsh
Normal file
30
zsh.d/60-hooks.zsh
Normal file
@ -0,0 +1,30 @@
|
||||
# Hooks for zsh
|
||||
#
|
||||
# - precmd
|
||||
# - chpwd
|
||||
# - preexec
|
||||
# - periodic
|
||||
# - zshaddhistory
|
||||
# - zshexit
|
||||
#
|
||||
|
||||
# Async Git update
|
||||
autoload -Uz vcs_info
|
||||
|
||||
_vbe_vcs_info_done() {
|
||||
local stdout=$3
|
||||
vcs_info_msg_0_=$stdout
|
||||
# echo $(date +"%Y-%m-%d %H:%M:%S") $PWD info $vcs_info_msg_0_ $vcs_info_msg_1_ >> ~/vcs.log
|
||||
zle reset-prompt
|
||||
}
|
||||
|
||||
_vbe_vcs_precmd() {
|
||||
# echo $(date +"%Y-%m-%d %H:%M:%S") $PWD pre >> ~/vcs.log
|
||||
async_flush_jobs vcs_info
|
||||
async_job vcs_info _vbe_vcs_info $PWD
|
||||
}
|
||||
|
||||
async_init
|
||||
async_start_worker vcs_info
|
||||
async_register_callback vcs_info _vbe_vcs_info_done
|
||||
add-zsh-hook precmd _vbe_vcs_precmd
|
33
zsh.d/90-plugins.zsh
Normal file
33
zsh.d/90-plugins.zsh
Normal file
@ -0,0 +1,33 @@
|
||||
# pyenv
|
||||
if type pyenv > /dev/null; then
|
||||
export PYENV_ROOT="$HOME/.pyenv"
|
||||
# eval "$(pyenv init --path)"
|
||||
eval "$(pyenv init -)"
|
||||
eval "$(pyenv virtualenv-init -)"
|
||||
fi
|
||||
|
||||
# # thefuck
|
||||
# type thefuck > /dev/null && eval $(thefuck --alias)
|
||||
|
||||
# z
|
||||
# [ -f $LIBRARY/plugins/zsh-z/zsh-z.plugin.zsh ] && source $LIBRARY/plugins/zsh-z/zsh-z.plugin.zsh
|
||||
if type zoxide > /dev/null; then ## zoxide is installed
|
||||
eval "$(zoxide init zsh)"
|
||||
export Z_COMMAND=zoxide
|
||||
elif [ -f $LIBRARY/plugins/zsh-z/zsh-z.plugin.zsh ]; then ## zsh-z is installed
|
||||
source $LIBRARY/plugins/zsh-z/zsh-z.plugin.zsh
|
||||
export Z_COMMAND=zsh-z
|
||||
else
|
||||
echo "No zoxide or zsh-z found, z command disabled"
|
||||
fi
|
||||
|
||||
# kubectl/krew
|
||||
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
|
||||
|
||||
if type kubectl > /dev/null; then
|
||||
alias k=kubectl
|
||||
alias kk='kubectl konfig merge ~/.kube/configs/* > ~/.kube/config'
|
||||
fi
|
||||
|
||||
# Setup iTerm shell integration
|
||||
#test -e $HOME/.iterm2_shell_integration.zsh && source $HOME/.iterm2_shell_integration.zsh && export ITERM_ENABLE_SHELL_INTEGRATION_WITH_TMUX=YES || echo "iTerm sh integration not installed"
|
@ -1,29 +0,0 @@
|
||||
function venv {
|
||||
|
||||
# export WORKON_HOME=$HOME/Src/virtualenvs
|
||||
# export PROJECT_HOME=$HOME/Src/projects
|
||||
if [ -z $WORKON_HOME ] || [ -z $PROJECT_HOME ]; then
|
||||
echo "Please, set WORKON_HOME and PROJECT_HOME first."
|
||||
echo "Better place to set them is 99-local.zsh"
|
||||
return
|
||||
fi
|
||||
|
||||
[ -z $VIRTUALENV_SCRIPT ] && VIRTUALENV_SCRIPT=/usr/local/bin/virtualenvwrapper.sh
|
||||
|
||||
[ -d $WORKON_HOME ] || mkdir -p $WORKON_HOME
|
||||
[ -d $PROJECT_HOME ] || mkdir -p $PROJECT_HOME
|
||||
|
||||
source $VIRTUALENV_SCRIPT
|
||||
|
||||
if [ -z $1 ]; then
|
||||
echo "virtualenv enabled."
|
||||
echo "WORKON_HOME: $WORKON_HOME"
|
||||
echo "PROJECT_HOME: $PROJECT_HOME"
|
||||
echo
|
||||
echo "Virtualenvs:"
|
||||
lsvirtualenv -b
|
||||
echo
|
||||
else
|
||||
workon $1
|
||||
fi
|
||||
}
|
@ -1,14 +1,26 @@
|
||||
# Darwin/OSX
|
||||
# Environment and aliases for OSX
|
||||
|
||||
|
||||
# Setup brew
|
||||
# We need it here to fix the PATH
|
||||
# so we can setup pyenv and other stuff
|
||||
#
|
||||
for prefix in /usr/local /opt/homebrew; do
|
||||
brew=$(whence $prefix/bin/brew)
|
||||
if [ $brew ]; then
|
||||
eval "$($brew shellenv)"
|
||||
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
export LSCOLORS="ExgxcxdxCxegedabagacad"
|
||||
alias ldd='otool -L'
|
||||
|
||||
alias ls='ls -F -G'
|
||||
alias ldd='otool -L'
|
||||
alias skill=killall
|
||||
alias lsrebuild='/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user'
|
||||
|
||||
# alias vim='/Applications/MacVim.app/Contents/MacOS/Vim '
|
||||
# alias vi='/Applications/MacVim.app/Contents/MacOS/Vim '
|
||||
# alias mvim='mvim --remote-tab-silent '
|
||||
# alias mvim='open -a MacVim '
|
||||
|
||||
# vim: set ts=4 sw=4 tw=0 ft=zsh :
|
||||
|
@ -1,19 +0,0 @@
|
||||
# Core Utils
|
||||
which gcp > /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
if [ -f /etc/zsh/gdircolors ]; then
|
||||
eval `gdircolors /etc/zsh/gdircolors`
|
||||
else
|
||||
eval `gdircolors`
|
||||
fi
|
||||
#alias ls='gls --color -F' # OSX ls is better (supports extended attributes)
|
||||
alias ll='ls -l'
|
||||
alias la='ls -a'
|
||||
alias cp='gcp'
|
||||
alias mv='gmv'
|
||||
alias rm='grm'
|
||||
alias du='gdu'
|
||||
alias df='gdf -a'
|
||||
fi
|
||||
|
||||
# vim: set ts=4 sw=4 tw=0 ft=zsh :
|
@ -8,7 +8,7 @@ if which dircolors > /dev/null; then
|
||||
fi
|
||||
fi
|
||||
|
||||
alias ls='LANG=C ls -F --color=auto --group-directories-first'
|
||||
alias ls='LC_ALL=C ls -F --color=auto --group-directories-first'
|
||||
alias open='xdg-open '
|
||||
|
||||
# vim: set ts=4 sw=4 tw=0 ft=zsh :
|
||||
|
237
zsh.d/completions/_beet
Normal file
237
zsh.d/completions/_beet
Normal file
@ -0,0 +1,237 @@
|
||||
#compdef beet
|
||||
|
||||
# zsh completion for beets music library manager and MusicBrainz tagger: https://beets.io/
|
||||
|
||||
# Default values for BEETS_LIBRARY & BEETS_CONFIG needed for the cache checking function.
|
||||
# They will be updated under the assumption that the config file is in the same directory as the library.
|
||||
local BEETS_LIBRARY=~/.config/beets/library.db
|
||||
local BEETS_CONFIG=~/.config/beets/config.yaml
|
||||
# Use separate caches for file locations, command completions, and query completions.
|
||||
# This allows the use of different rules for when to update each one.
|
||||
zstyle ":completion:${curcontext}:" cache-policy _beet_check_cache
|
||||
_beet_check_cache () {
|
||||
local cachefile="$(basename ${1})"
|
||||
if [[ ! -a "${1}" ]] || [[ "${1}" -ot =beet ]]; then
|
||||
# always update the cache if it doesnt exist, or if the beet executable changes
|
||||
return 0
|
||||
fi
|
||||
case cachefile; in
|
||||
(beetslibrary)
|
||||
if [[ ! -a "${~BEETS_LIBRARY}" ]] || [[ "${1}" -ot "${~BEETS_CONFIG}" ]]; then
|
||||
return 0
|
||||
fi
|
||||
;;
|
||||
(beetscmds)
|
||||
_retrieve_cache beetslibrary
|
||||
if [[ "${1}" -ot "${~BEETS_CONFIG}" ]]; then
|
||||
return 0
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
return 1
|
||||
}
|
||||
|
||||
# useful: argument to _regex_arguments for matching any word
|
||||
local matchany=/$'[^\0]##\0'/
|
||||
# arguments to _regex_arguments for completing files and directories
|
||||
local -a files dirs
|
||||
files=("$matchany" ':file:file:_files')
|
||||
dirs=("$matchany" ':dir:directory:_dirs')
|
||||
|
||||
# Retrieve or update caches
|
||||
if ! _retrieve_cache beetslibrary || _cache_invalid beetslibrary; then
|
||||
local BEETS_LIBRARY="${$(beet config|grep library|cut -f 2 -d ' '):-${BEETS_LIBRARY}}"
|
||||
local BEETS_CONFIG="${$(beet config -p):-${BEETS_CONFIG}}"
|
||||
_store_cache beetslibrary BEETS_LIBRARY BEETS_CONFIG
|
||||
fi
|
||||
|
||||
if ! _retrieve_cache beetscmds || _cache_invalid beetscmds; then
|
||||
local -a subcommands fields beets_regex_words_subcmds beets_regex_words_help query modify
|
||||
local subcmd cmddesc matchquery matchmodify field fieldargs queryelem modifyelem
|
||||
# Useful function for joining grouped lines of output into single lines (taken from _completion_helpers)
|
||||
_join_lines() {
|
||||
awk -v SEP="$1" -v ARG2="$2" -v START="$3" -v END2="$4" 'BEGIN {if(START==""){f=1}{f=0};
|
||||
if(ARG2 ~ "^[0-9]+"){LINE1 = "^[[:space:]]{,"ARG2"}[^[:space:]]"}else{LINE1 = ARG2}}
|
||||
($0 ~ END2 && f>0 && END2!="") {exit}
|
||||
($0 ~ START && f<1) {f=1; if(length(START)!=0){next}}
|
||||
($0 ~ LINE1 && f>0) {if(f<2){f=2; printf("%s",$0)}else{printf("\n%s",$0)}; next}
|
||||
(f>1) {gsub(/^[[:space:]]+|[[:space:]]+$/,"",$0); printf("%s%s",SEP, $0); next}
|
||||
END {print ""}'
|
||||
}
|
||||
# Variables used for completing subcommands and queries
|
||||
subcommands=(${${(f)"$(beet help | _join_lines ' ' 3 'Commands:')"}[@]})
|
||||
fields=($(beet fields | grep -G '^ ' | sort -u | colrm 1 2))
|
||||
for field in "${fields[@]}"
|
||||
do
|
||||
fieldargs="$fieldargs '$field:::{_beet_field_values $field}'"
|
||||
done
|
||||
queryelem="_values -S : 'query field (add an extra : to match by regexp)' '::' $fieldargs"
|
||||
modifyelem="_values -S = 'modify field (replace = with ! to remove field)' $(echo "'${^fields[@]}:: '")"
|
||||
# regexps for matching query and modify terms on the command line
|
||||
matchquery=/"(${(j/|/)fields[@]})"$':[^\0]##\0'/
|
||||
matchmodify=/"(${(j/|/)fields[@]})"$'(=[^\0]##|!)\0'/
|
||||
# create completion function for queries
|
||||
_regex_arguments _beet_query "$matchany" \# \( "$matchquery" ":query:query string:$queryelem" \) \#
|
||||
local "beets_query"="$(which _beet_query)"
|
||||
# arguments for _regex_arguments for completing lists of queries and modifications
|
||||
beets_query_args=( \( "$matchquery" ":query:query string:{_beet_query}" \) \# )
|
||||
beets_modify_args=( \( "$matchmodify" ":modify:modify string:$modifyelem" \) \# )
|
||||
# now build arguments for _beet and _beet_help completion functions
|
||||
beets_regex_words_subcmds=('(')
|
||||
for i in ${subcommands[@]}; do
|
||||
subcmd="${i[(w)1]}"
|
||||
# remove first word and parenthesised alias, replace : with -, [ with (, ] with ), and remove single quotes
|
||||
cmddesc="${${${${${i[(w)2,-1]##\(*\) #}//:/-}//\[/(}//\]/)}//\'/}"
|
||||
# update arguments needed for creating _beet
|
||||
beets_regex_words_subcmds+=(/"${subcmd}"$'\0'/ ":subcmds:subcommands:((${subcmd}:${cmddesc// /\ }))")
|
||||
beets_regex_words_subcmds+=(\( "${matchany}" ":option:option:{_beet_subcmd ${subcmd}}" \) \# \|)
|
||||
# update arguments needed for creating _beet_help
|
||||
beets_regex_words_help+=("${subcmd}:${cmddesc}")
|
||||
done
|
||||
beets_regex_words_subcmds[-1]=')'
|
||||
_store_cache beetscmds beets_regex_words_subcmds beets_regex_words_help beets_query_args beets_modify_args beets_query
|
||||
else
|
||||
# Evaluate the variable containing the query completer function
|
||||
eval "${beets_query}"
|
||||
fi
|
||||
|
||||
# Function for getting unique values for field from database (you may need to change the path to the database).
|
||||
_beet_field_values() {
|
||||
local -a output fieldvals
|
||||
local sqlcmd="select distinct $1 from items;"
|
||||
_retrieve_cache beetslibrary
|
||||
case ${1}
|
||||
in
|
||||
lyrics)
|
||||
fieldvals=
|
||||
;;
|
||||
*)
|
||||
if [[ "$(sqlite3 ${~BEETS_LIBRARY} ${sqlcmd} 2>&1)" =~ "no such column" ]]; then
|
||||
sqlcmd="select distinct value from item_attributes where key=='$1' and value!='';"
|
||||
fi
|
||||
output="$(sqlite3 ${~BEETS_LIBRARY} ${sqlcmd} 2>/dev/null | sed -rn '/^-+$/,${{/^[- ]+$/n};p}')"
|
||||
fieldvals=("${(f)output[@]}")
|
||||
;;
|
||||
esac
|
||||
compadd -P \" -S \" -M 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' -Q -a fieldvals
|
||||
}
|
||||
|
||||
# This function takes a beet subcommand as its first argument, and then uses _regex_words to set ${reply[@]}
|
||||
# to an array containing arguments for the _regex_arguments function.
|
||||
_beet_subcmd_options() {
|
||||
local shortopt optarg optdesc
|
||||
local matchany=/$'[^\0]##\0'/
|
||||
local -a regex_words
|
||||
regex_words=()
|
||||
for i in ${${(f)"$(beet help $1 | awk '/^ +-/{if(x)print x;x=$0;next}/^ *$/{if(x) exit}{if(x) x=x$0}END{print x}')"}[@]}
|
||||
do
|
||||
opt="${i[(w)1]/,/}"
|
||||
optarg="${${${i## #[-a-zA-Z]# }##[- ]##*}%%[, ]*}"
|
||||
optdesc="${${${${${i[(w)2,-1]/[A-Z, ]#--[-a-z]##[=A-Z]# #/}//:/-}//\[/(}//\]/)}//\'/}"
|
||||
case $optarg; in
|
||||
("")
|
||||
if [[ "$1" == "import" && "$opt" == "-L" ]]; then
|
||||
regex_words+=("$opt:$optdesc:\${beets_query_args[@]}")
|
||||
else
|
||||
regex_words+=("$opt:$optdesc")
|
||||
fi
|
||||
;;
|
||||
(LOG)
|
||||
local -a files
|
||||
files=("$matchany" ':file:file:_files')
|
||||
regex_words+=("$opt:$optdesc:\$files")
|
||||
;;
|
||||
(CONFIG)
|
||||
local -a configfile
|
||||
configfile=("$matchany" ':file:config file:{_files -g *.yaml}')
|
||||
regex_words+=("$opt:$optdesc:\$configfile")
|
||||
;;
|
||||
(LIB|LIBRARY)
|
||||
local -a libfile
|
||||
libfile=("$matchany" ':file:database file:{_files -g *.db}')
|
||||
regex_words+=("$opt:$optdesc:\$libfile")
|
||||
;;
|
||||
(DIR|DIRECTORY)
|
||||
local -a dirs
|
||||
dirs=("$matchany" ':dir:directory:_dirs')
|
||||
regex_words+=("$opt:$optdesc:\$dirs")
|
||||
;;
|
||||
(SOURCE)
|
||||
if [[ "${1}" -eq lastgenre ]]; then
|
||||
local -a lastgenresource
|
||||
lastgenresource=(/$'(artist|album|track)\0'/ ':source:genre source:(artist album track)')
|
||||
regex_words+=("$opt:$optdesc:\$lastgenresource")
|
||||
else
|
||||
regex_words+=("$opt:$optdesc:\$matchany")
|
||||
fi
|
||||
;;
|
||||
(*)
|
||||
regex_words+=("$opt:$optdesc:\$matchany")
|
||||
;;
|
||||
esac
|
||||
done
|
||||
_regex_words options "$1 options" "${regex_words[@]}"
|
||||
}
|
||||
|
||||
## Function for completing subcommands. It calls another completion function which is first created if it doesn't already exist.
|
||||
_beet_subcmd() {
|
||||
local -a options
|
||||
local subcmd="${1}"
|
||||
if [[ ! $(type _beet_${subcmd} | grep function) =~ function ]]; then
|
||||
if ! _retrieve_cache "beets${subcmd}" || _cache_invalid "beets${subcmd}"; then
|
||||
local matchany=/$'[^\0]##\0'/
|
||||
local -a files
|
||||
files=("$matchany" ':file:file:_files')
|
||||
# get arguments for completing subcommand options
|
||||
_beet_subcmd_options "$subcmd"
|
||||
options=("${reply[@]}" \#)
|
||||
_retrieve_cache beetscmds
|
||||
case ${subcmd}; in
|
||||
(import)
|
||||
_regex_arguments _beet_import "${matchany}" /"${subcmd}"$'\0'/ "${options[@]}" "${files[@]}" \#
|
||||
;;
|
||||
(modify)
|
||||
_regex_arguments _beet_modify "${matchany}" /"${subcmd}"$'\0'/ "${options[@]}" \
|
||||
"${beets_query_args[@]}" "${beets_modify_args[@]}"
|
||||
;;
|
||||
(fields|migrate|version|config)
|
||||
_regex_arguments _beet_${subcmd} "${matchany}" /"${subcmd}"$'\0'/ "${options[@]}"
|
||||
;;
|
||||
(help)
|
||||
_regex_words subcmds "subcommands" "${beets_regex_words_help[@]}"
|
||||
_regex_arguments _beet_help "${matchany}" /$'help\0'/ "${options[@]}" "${reply[@]}"
|
||||
;;
|
||||
(*) # Other commands have options followed by a query
|
||||
_regex_arguments _beet_${subcmd} "${matchany}" /"${subcmd}"$'\0'/ "${options[@]}" "${beets_query_args[@]}"
|
||||
;;
|
||||
esac
|
||||
# Store completion function in a cache file
|
||||
local "beets_${subcmd}"="$(which _beet_${subcmd})"
|
||||
_store_cache "beets${subcmd}" "beets_${subcmd}"
|
||||
else
|
||||
# Evaluate the function which is stored in $beets_${subcmd}
|
||||
local var="beets_${subcmd}"
|
||||
eval "${(P)var}"
|
||||
fi
|
||||
fi
|
||||
_beet_${subcmd}
|
||||
}
|
||||
|
||||
# Global options
|
||||
local -a globalopts
|
||||
_regex_words options "global options" '-c:path to configuration file:$files' '-v:print debugging information' \
|
||||
'-l:library database file to use:$files' '-h:show this help message and exit' '-d:destination music directory:$dirs'
|
||||
globalopts=("${reply[@]}")
|
||||
|
||||
# Create main completion function
|
||||
_regex_arguments _beet "$matchany" \( "${globalopts[@]}" \# \) "${beets_regex_words_subcmds[@]}"
|
||||
|
||||
# Set tag-order so that options are completed separately from arguments
|
||||
zstyle ":completion:${curcontext}:" tag-order '! options'
|
||||
|
||||
# Execute the completion function
|
||||
_beet "$@"
|
||||
|
||||
# Local Variables:
|
||||
# mode:shell-script
|
||||
# End:
|
File diff suppressed because it is too large
Load Diff
@ -1,117 +0,0 @@
|
||||
#compdef salt
|
||||
# ------------------------------------------------------------------------------
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the zsh-users nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# Completion script for salt (http://saltstack.com/).
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
_minions() {
|
||||
ls /etc/salt/pki/master/minions | while read minion; do
|
||||
_wanted 'target' expl 'target' compadd $minion
|
||||
done
|
||||
}
|
||||
|
||||
_modules() {
|
||||
for module in $(salt-call sys.list_modules 2&>/dev/null --output=key | tail -n+2); do
|
||||
_wanted 'module' expl 'module' compadd $module
|
||||
done
|
||||
}
|
||||
|
||||
_functions() {
|
||||
for fn in $(salt-call sys.list_functions 2&>/dev/null --output=key | tail -n+2); do
|
||||
_wanted 'function' expl 'function' compadd $fn
|
||||
done
|
||||
}
|
||||
|
||||
_salt() {
|
||||
local _loglevels
|
||||
_loglevels=(all garbage trace debug info warning error quiet)
|
||||
|
||||
_arguments -s \
|
||||
"--version[show program's version number and exit]" \
|
||||
"--versions-report[show program's dependencies version number and exit]" \
|
||||
"(-h --help)"{-h,--help}"[show help message and exit]" \
|
||||
"(-c --config-dir)"{-c+,--config-dir=}"[Pass in an alternative configuration directory.]:configuration directory:_files -/" \
|
||||
"(-t --timeout)"{-t+,--timeout=}"[Change the timeout, if applicable, for the running command]:timeout" \
|
||||
"(-s --static)"{-s,--static}"[Return the data from minions as a group after they all return]" \
|
||||
"--async[Run the salt command but don't wait for a reply]" \
|
||||
"(--state-output --state_output)"{--state-output=,--state_output=}"[Override the configured state_output value for minion output]:state output" \
|
||||
"--subset=[Execute the routine on a random subset of the targeted minions]:subset" \
|
||||
"(-v --verbose)"{-v,--verbose}"[Turn on command verbosity, display jid and active job queries]" \
|
||||
"--show-timeout[Display minions that timeout]" \
|
||||
"(-b --batch --batch-size)"{-b+,--batch=,--batch-size=}"[Execute the salt job in batch mode]:batch" \
|
||||
"(-a --auth --eauth --extended-auth)"{-a+,--auth=,--eauth=,--extended--auth=}"[Specify an extended authentication system to use]:eauth" \
|
||||
"(-T --make-token)"{-T,--make-token}"[Generate and save an authentication token for re-use]" \
|
||||
"--return=[Set an alternative return method]:returner" \
|
||||
"(-d --doc --documentation)"{-d,--doc,--documentation}"[Return the documentation for the specified module or for all modules]::function:_functions" \
|
||||
"--args-separator=[Set the special argument used as a delimiter between command arguments of compound commands]:args separator" \
|
||||
\
|
||||
"(-l --log-level)"{-l+,--log-level=}"[Console logging log level]:level:($_loglevels[@])" \
|
||||
"--log-file=[Log file path]:log file:_files" \
|
||||
"--log-file-level=[Logfile logging log level]:level:($_loglevels[@])" \
|
||||
\
|
||||
"(-E --pcre)"{-E,--pcre}"[Target servers using pcre regular expressions]" \
|
||||
"(-L --list)"{-L,--list}"[Target servers using a comma or space delimited list of servers]" \
|
||||
"(-G --grain)"{-G,--grain}"[Target servers using a grain value]" \
|
||||
"--grain-pcre[Target servers using a grain value matched by a pcre regular expression]" \
|
||||
"(-N --nodegroup)"{-N,--nodegroup}"[Target servers using a predefined nodegroup]" \
|
||||
"(-R --range)"{-R,--range}"[Target servers using range expression]" \
|
||||
"(-C --compound)"{-C,--compound}"[Target servers using compound selectors]" \
|
||||
"(-X --exsel)"{-X,--exsel}"[Target servers using the return code of a function]" \
|
||||
"(-I --pillar)"{-I,--pillar}"[Target servers using a pillar value]" \
|
||||
"(-S --ipcidr)"{-S,--ipcidr}"[Match servers based on subnet (CIDR or IPv4 address)]" \
|
||||
\
|
||||
"(--out --output)"{--out=,--output=}"[Print the output using the specified outputter]:outputter:(no_return grains yaml overstatestage json pprint nested raw highstate quiet key txt virt_query)" \
|
||||
"(--out-indent --output-indent)"{--out-indent=,--output-indent=}"[Print the output indented by the provided value in spaces]:nr spaces" \
|
||||
"(--out-file --output-file)"{--out-file=,--output-file=}"[Write the output to the specified file]:output:_files" \
|
||||
"(--no-color --no-colour)"{--no-color,--no-colour}"[Disable all colored output]" \
|
||||
"(--force-color --force-colour)"{--force-color,--force-colour}"[Force colored output]" \
|
||||
\
|
||||
'1:target:_minions' \
|
||||
'2:function:_functions' \
|
||||
'*::arguments'
|
||||
}
|
||||
|
||||
case "$service" in
|
||||
salt)
|
||||
_salt "@"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Local Variables:
|
||||
# mode: Shell-Script
|
||||
# sh-indentation: 2
|
||||
# indent-tabs-mode: nil
|
||||
# sh-basic-offset: 2
|
||||
# End:
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
178
zsh.d/completions/_stern
Normal file
178
zsh.d/completions/_stern
Normal file
@ -0,0 +1,178 @@
|
||||
#compdef _stern stern
|
||||
|
||||
# zsh completion for stern -*- shell-script -*-
|
||||
|
||||
__stern_debug()
|
||||
{
|
||||
local file="$BASH_COMP_DEBUG_FILE"
|
||||
if [[ -n ${file} ]]; then
|
||||
echo "$*" >> "${file}"
|
||||
fi
|
||||
}
|
||||
|
||||
_stern()
|
||||
{
|
||||
local shellCompDirectiveError=1
|
||||
local shellCompDirectiveNoSpace=2
|
||||
local shellCompDirectiveNoFileComp=4
|
||||
local shellCompDirectiveFilterFileExt=8
|
||||
local shellCompDirectiveFilterDirs=16
|
||||
|
||||
local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace
|
||||
local -a completions
|
||||
|
||||
__stern_debug "\n========= starting completion logic =========="
|
||||
__stern_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}"
|
||||
|
||||
# The user could have moved the cursor backwards on the command-line.
|
||||
# We need to trigger completion from the $CURRENT location, so we need
|
||||
# to truncate the command-line ($words) up to the $CURRENT location.
|
||||
# (We cannot use $CURSOR as its value does not work when a command is an alias.)
|
||||
words=("${=words[1,CURRENT]}")
|
||||
__stern_debug "Truncated words[*]: ${words[*]},"
|
||||
|
||||
lastParam=${words[-1]}
|
||||
lastChar=${lastParam[-1]}
|
||||
__stern_debug "lastParam: ${lastParam}, lastChar: ${lastChar}"
|
||||
|
||||
# For zsh, when completing a flag with an = (e.g., stern -n=<TAB>)
|
||||
# completions must be prefixed with the flag
|
||||
setopt local_options BASH_REMATCH
|
||||
if [[ "${lastParam}" =~ '-.*=' ]]; then
|
||||
# We are dealing with a flag with an =
|
||||
flagPrefix="-P ${BASH_REMATCH}"
|
||||
fi
|
||||
|
||||
# Prepare the command to obtain completions
|
||||
requestComp="${words[1]} __complete ${words[2,-1]}"
|
||||
if [ "${lastChar}" = "" ]; then
|
||||
# If the last parameter is complete (there is a space following it)
|
||||
# We add an extra empty parameter so we can indicate this to the go completion code.
|
||||
__stern_debug "Adding extra empty parameter"
|
||||
requestComp="${requestComp} \"\""
|
||||
fi
|
||||
|
||||
__stern_debug "About to call: eval ${requestComp}"
|
||||
|
||||
# Use eval to handle any environment variables and such
|
||||
out=$(eval ${requestComp} 2>/dev/null)
|
||||
__stern_debug "completion output: ${out}"
|
||||
|
||||
# Extract the directive integer following a : from the last line
|
||||
local lastLine
|
||||
while IFS='\n' read -r line; do
|
||||
lastLine=${line}
|
||||
done < <(printf "%s\n" "${out[@]}")
|
||||
__stern_debug "last line: ${lastLine}"
|
||||
|
||||
if [ "${lastLine[1]}" = : ]; then
|
||||
directive=${lastLine[2,-1]}
|
||||
# Remove the directive including the : and the newline
|
||||
local suffix
|
||||
(( suffix=${#lastLine}+2))
|
||||
out=${out[1,-$suffix]}
|
||||
else
|
||||
# There is no directive specified. Leave $out as is.
|
||||
__stern_debug "No directive found. Setting do default"
|
||||
directive=0
|
||||
fi
|
||||
|
||||
__stern_debug "directive: ${directive}"
|
||||
__stern_debug "completions: ${out}"
|
||||
__stern_debug "flagPrefix: ${flagPrefix}"
|
||||
|
||||
if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
|
||||
__stern_debug "Completion received error. Ignoring completions."
|
||||
return
|
||||
fi
|
||||
|
||||
while IFS='\n' read -r comp; do
|
||||
if [ -n "$comp" ]; then
|
||||
# If requested, completions are returned with a description.
|
||||
# The description is preceded by a TAB character.
|
||||
# For zsh's _describe, we need to use a : instead of a TAB.
|
||||
# We first need to escape any : as part of the completion itself.
|
||||
comp=${comp//:/\\:}
|
||||
|
||||
local tab=$(printf '\t')
|
||||
comp=${comp//$tab/:}
|
||||
|
||||
__stern_debug "Adding completion: ${comp}"
|
||||
completions+=${comp}
|
||||
lastComp=$comp
|
||||
fi
|
||||
done < <(printf "%s\n" "${out[@]}")
|
||||
|
||||
if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
|
||||
__stern_debug "Activating nospace."
|
||||
noSpace="-S ''"
|
||||
fi
|
||||
|
||||
if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then
|
||||
# File extension filtering
|
||||
local filteringCmd
|
||||
filteringCmd='_files'
|
||||
for filter in ${completions[@]}; do
|
||||
if [ ${filter[1]} != '*' ]; then
|
||||
# zsh requires a glob pattern to do file filtering
|
||||
filter="\*.$filter"
|
||||
fi
|
||||
filteringCmd+=" -g $filter"
|
||||
done
|
||||
filteringCmd+=" ${flagPrefix}"
|
||||
|
||||
__stern_debug "File filtering command: $filteringCmd"
|
||||
_arguments '*:filename:'"$filteringCmd"
|
||||
elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
|
||||
# File completion for directories only
|
||||
local subDir
|
||||
subdir="${completions[1]}"
|
||||
if [ -n "$subdir" ]; then
|
||||
__stern_debug "Listing directories in $subdir"
|
||||
pushd "${subdir}" >/dev/null 2>&1
|
||||
else
|
||||
__stern_debug "Listing directories in ."
|
||||
fi
|
||||
|
||||
local result
|
||||
_arguments '*:dirname:_files -/'" ${flagPrefix}"
|
||||
result=$?
|
||||
if [ -n "$subdir" ]; then
|
||||
popd >/dev/null 2>&1
|
||||
fi
|
||||
return $result
|
||||
else
|
||||
__stern_debug "Calling _describe"
|
||||
if eval _describe "completions" completions $flagPrefix $noSpace; then
|
||||
__stern_debug "_describe found some completions"
|
||||
|
||||
# Return the success of having called _describe
|
||||
return 0
|
||||
else
|
||||
__stern_debug "_describe did not find completions."
|
||||
__stern_debug "Checking if we should do file completion."
|
||||
if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
|
||||
__stern_debug "deactivating file completion"
|
||||
|
||||
# We must return an error code here to let zsh know that there were no
|
||||
# completions found by _describe; this is what will trigger other
|
||||
# matching algorithms to attempt to find completions.
|
||||
# For example zsh can match letters in the middle of words.
|
||||
return 1
|
||||
else
|
||||
# Perform file completion
|
||||
__stern_debug "Activating file completion"
|
||||
|
||||
# We must return the result of this command, so it must be the
|
||||
# last command, or else we must store its result to return it.
|
||||
_arguments '*:filename:_files'" ${flagPrefix}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# don't run the completion function when being source-ed or eval-ed
|
||||
if [ "$funcstack[1]" = "_stern" ]; then
|
||||
_stern
|
||||
fi
|
||||
compdef _stern stern
|
213
zsh.d/completions/_talosctl
Normal file
213
zsh.d/completions/_talosctl
Normal file
@ -0,0 +1,213 @@
|
||||
#compdef talosctl
|
||||
compdef _talosctl talosctl
|
||||
|
||||
# zsh completion for talosctl -*- shell-script -*-
|
||||
|
||||
__talosctl_debug()
|
||||
{
|
||||
local file="$BASH_COMP_DEBUG_FILE"
|
||||
if [[ -n ${file} ]]; then
|
||||
echo "$*" >> "${file}"
|
||||
fi
|
||||
}
|
||||
|
||||
_talosctl()
|
||||
{
|
||||
local shellCompDirectiveError=1
|
||||
local shellCompDirectiveNoSpace=2
|
||||
local shellCompDirectiveNoFileComp=4
|
||||
local shellCompDirectiveFilterFileExt=8
|
||||
local shellCompDirectiveFilterDirs=16
|
||||
local shellCompDirectiveKeepOrder=32
|
||||
|
||||
local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace keepOrder
|
||||
local -a completions
|
||||
|
||||
__talosctl_debug "\n========= starting completion logic =========="
|
||||
__talosctl_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}"
|
||||
|
||||
# The user could have moved the cursor backwards on the command-line.
|
||||
# We need to trigger completion from the $CURRENT location, so we need
|
||||
# to truncate the command-line ($words) up to the $CURRENT location.
|
||||
# (We cannot use $CURSOR as its value does not work when a command is an alias.)
|
||||
words=("${=words[1,CURRENT]}")
|
||||
__talosctl_debug "Truncated words[*]: ${words[*]},"
|
||||
|
||||
lastParam=${words[-1]}
|
||||
lastChar=${lastParam[-1]}
|
||||
__talosctl_debug "lastParam: ${lastParam}, lastChar: ${lastChar}"
|
||||
|
||||
# For zsh, when completing a flag with an = (e.g., talosctl -n=<TAB>)
|
||||
# completions must be prefixed with the flag
|
||||
setopt local_options BASH_REMATCH
|
||||
if [[ "${lastParam}" =~ '-.*=' ]]; then
|
||||
# We are dealing with a flag with an =
|
||||
flagPrefix="-P ${BASH_REMATCH}"
|
||||
fi
|
||||
|
||||
# Prepare the command to obtain completions
|
||||
requestComp="${words[1]} __complete ${words[2,-1]}"
|
||||
if [ "${lastChar}" = "" ]; then
|
||||
# If the last parameter is complete (there is a space following it)
|
||||
# We add an extra empty parameter so we can indicate this to the go completion code.
|
||||
__talosctl_debug "Adding extra empty parameter"
|
||||
requestComp="${requestComp} \"\""
|
||||
fi
|
||||
|
||||
__talosctl_debug "About to call: eval ${requestComp}"
|
||||
|
||||
# Use eval to handle any environment variables and such
|
||||
out=$(eval ${requestComp} 2>/dev/null)
|
||||
__talosctl_debug "completion output: ${out}"
|
||||
|
||||
# Extract the directive integer following a : from the last line
|
||||
local lastLine
|
||||
while IFS='\n' read -r line; do
|
||||
lastLine=${line}
|
||||
done < <(printf "%s\n" "${out[@]}")
|
||||
__talosctl_debug "last line: ${lastLine}"
|
||||
|
||||
if [ "${lastLine[1]}" = : ]; then
|
||||
directive=${lastLine[2,-1]}
|
||||
# Remove the directive including the : and the newline
|
||||
local suffix
|
||||
(( suffix=${#lastLine}+2))
|
||||
out=${out[1,-$suffix]}
|
||||
else
|
||||
# There is no directive specified. Leave $out as is.
|
||||
__talosctl_debug "No directive found. Setting do default"
|
||||
directive=0
|
||||
fi
|
||||
|
||||
__talosctl_debug "directive: ${directive}"
|
||||
__talosctl_debug "completions: ${out}"
|
||||
__talosctl_debug "flagPrefix: ${flagPrefix}"
|
||||
|
||||
if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
|
||||
__talosctl_debug "Completion received error. Ignoring completions."
|
||||
return
|
||||
fi
|
||||
|
||||
local activeHelpMarker="_activeHelp_ "
|
||||
local endIndex=${#activeHelpMarker}
|
||||
local startIndex=$((${#activeHelpMarker}+1))
|
||||
local hasActiveHelp=0
|
||||
while IFS='\n' read -r comp; do
|
||||
# Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker)
|
||||
if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then
|
||||
__talosctl_debug "ActiveHelp found: $comp"
|
||||
comp="${comp[$startIndex,-1]}"
|
||||
if [ -n "$comp" ]; then
|
||||
compadd -x "${comp}"
|
||||
__talosctl_debug "ActiveHelp will need delimiter"
|
||||
hasActiveHelp=1
|
||||
fi
|
||||
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ -n "$comp" ]; then
|
||||
# If requested, completions are returned with a description.
|
||||
# The description is preceded by a TAB character.
|
||||
# For zsh's _describe, we need to use a : instead of a TAB.
|
||||
# We first need to escape any : as part of the completion itself.
|
||||
comp=${comp//:/\\:}
|
||||
|
||||
local tab="$(printf '\t')"
|
||||
comp=${comp//$tab/:}
|
||||
|
||||
__talosctl_debug "Adding completion: ${comp}"
|
||||
completions+=${comp}
|
||||
lastComp=$comp
|
||||
fi
|
||||
done < <(printf "%s\n" "${out[@]}")
|
||||
|
||||
# Add a delimiter after the activeHelp statements, but only if:
|
||||
# - there are completions following the activeHelp statements, or
|
||||
# - file completion will be performed (so there will be choices after the activeHelp)
|
||||
if [ $hasActiveHelp -eq 1 ]; then
|
||||
if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then
|
||||
__talosctl_debug "Adding activeHelp delimiter"
|
||||
compadd -x "--"
|
||||
hasActiveHelp=0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
|
||||
__talosctl_debug "Activating nospace."
|
||||
noSpace="-S ''"
|
||||
fi
|
||||
|
||||
if [ $((directive & shellCompDirectiveKeepOrder)) -ne 0 ]; then
|
||||
__talosctl_debug "Activating keep order."
|
||||
keepOrder="-V"
|
||||
fi
|
||||
|
||||
if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then
|
||||
# File extension filtering
|
||||
local filteringCmd
|
||||
filteringCmd='_files'
|
||||
for filter in ${completions[@]}; do
|
||||
if [ ${filter[1]} != '*' ]; then
|
||||
# zsh requires a glob pattern to do file filtering
|
||||
filter="\*.$filter"
|
||||
fi
|
||||
filteringCmd+=" -g $filter"
|
||||
done
|
||||
filteringCmd+=" ${flagPrefix}"
|
||||
|
||||
__talosctl_debug "File filtering command: $filteringCmd"
|
||||
_arguments '*:filename:'"$filteringCmd"
|
||||
elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
|
||||
# File completion for directories only
|
||||
local subdir
|
||||
subdir="${completions[1]}"
|
||||
if [ -n "$subdir" ]; then
|
||||
__talosctl_debug "Listing directories in $subdir"
|
||||
pushd "${subdir}" >/dev/null 2>&1
|
||||
else
|
||||
__talosctl_debug "Listing directories in ."
|
||||
fi
|
||||
|
||||
local result
|
||||
_arguments '*:dirname:_files -/'" ${flagPrefix}"
|
||||
result=$?
|
||||
if [ -n "$subdir" ]; then
|
||||
popd >/dev/null 2>&1
|
||||
fi
|
||||
return $result
|
||||
else
|
||||
__talosctl_debug "Calling _describe"
|
||||
if eval _describe $keepOrder "completions" completions $flagPrefix $noSpace; then
|
||||
__talosctl_debug "_describe found some completions"
|
||||
|
||||
# Return the success of having called _describe
|
||||
return 0
|
||||
else
|
||||
__talosctl_debug "_describe did not find completions."
|
||||
__talosctl_debug "Checking if we should do file completion."
|
||||
if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
|
||||
__talosctl_debug "deactivating file completion"
|
||||
|
||||
# We must return an error code here to let zsh know that there were no
|
||||
# completions found by _describe; this is what will trigger other
|
||||
# matching algorithms to attempt to find completions.
|
||||
# For example zsh can match letters in the middle of words.
|
||||
return 1
|
||||
else
|
||||
# Perform file completion
|
||||
__talosctl_debug "Activating file completion"
|
||||
|
||||
# We must return the result of this command, so it must be the
|
||||
# last command, or else we must store its result to return it.
|
||||
_arguments '*:filename:_files'" ${flagPrefix}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# don't run the completion function when being source-ed or eval-ed
|
||||
if [ "$funcstack[1]" = "_talosctl" ]; then
|
||||
_talosctl
|
||||
fi
|
||||
compdef _talosctl talosctl
|
1
zsh.d/plugins/zsh-z
Submodule
1
zsh.d/plugins/zsh-z
Submodule
Submodule zsh.d/plugins/zsh-z added at afaf2965b4
@ -135,7 +135,7 @@ prompt_mypure_set_aws() {
|
||||
if [[ "$AWS_PROFILE" =~ "$_aws_prod_profile" ]]; then
|
||||
prompt_mypure_aws_prod=1
|
||||
fi
|
||||
prompt_mypure_aws="/$AWS_PROFILE/"
|
||||
prompt_mypure_aws=" $AWS_PROFILE"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -540,7 +540,8 @@ prompt_mypure_async_callback() {
|
||||
if (( code == 0 )); then
|
||||
unset prompt_mypure_git_dirty
|
||||
else
|
||||
typeset -g prompt_mypure_git_dirty="*"
|
||||
# typeset -g prompt_mypure_git_dirty="*"
|
||||
typeset -g prompt_mypure_git_dirty=" ∆"
|
||||
fi
|
||||
|
||||
[[ $prev_dirty != $prompt_mypure_git_dirty ]] && do_render=1
|
||||
|
@ -1,17 +1,5 @@
|
||||
function prompt_minimal_setup {
|
||||
# Setup PROMPT
|
||||
if `fancyTerm`; then
|
||||
# We are on xterminal
|
||||
W="%n@%m:%."
|
||||
I="%m:%."
|
||||
L="%B%. %#%b "
|
||||
PS1="%{]2;$W%}%{]1;$I%}$L"
|
||||
unset W I L
|
||||
|
||||
else
|
||||
# We are not on xterminal
|
||||
PS1="%B%. %#%b "
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_minimal_setup
|
||||
|
@ -1,18 +0,0 @@
|
||||
function prompt_niceOld_setup {
|
||||
if `fancyTerm`; then
|
||||
W="::: %n at %m in %. :::"
|
||||
I="%m::%."
|
||||
L="%B%K{blue}%F{white}@%m::%2~ %f%k
|
||||
%F{yellow}%#%f%b "
|
||||
PS1="%{]2;$W%}%{]1;$I%}$L"
|
||||
unset W I L
|
||||
|
||||
else
|
||||
# We are not on xterminal
|
||||
PS1="%B%K{blue}%F{white}[%l] %n@%m:%~ %f%k%F{yellow}%#%f%b "
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_niceOld_setup
|
||||
|
||||
# vim: set ts=4 sw=4 tw=0 ft=zsh :
|
@ -1,20 +0,0 @@
|
||||
|
||||
function prompt_nice_setup {
|
||||
if `fancyTerm`; then
|
||||
title="::: %n at %m in %. :::"
|
||||
icon="%m::%."
|
||||
prompt_='$FX[bold]$FX[italic]$BG[062]@%m::%2~$FX[reset]
|
||||
$FX[bold]$(repo_char)$FG[220]%#$FX[reset] '
|
||||
|
||||
PS1="%{]2;$title%}%{]1;$icon%}$prompt_"
|
||||
unset title icon prompt_
|
||||
|
||||
else
|
||||
# We are not on xterminal
|
||||
PS1='%B%K{blue}%F{white}[%l] $(repo_char)%n@%m:%~ %f%k%F{yellow}%#%f%b '
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_nice_setup
|
||||
|
||||
# vim: set ts=4 sw=4 tw=0 ft=zsh :
|
@ -1,17 +1,5 @@
|
||||
function prompt_plain_setup {
|
||||
# Setup PROMPT
|
||||
if `fancyTerm`; then
|
||||
# We are on xterminal
|
||||
W="%n@%m:%."
|
||||
I="%m:%."
|
||||
L="%B[%l] %~ %#%b "
|
||||
PS1="%{]2;$W%}%{]1;$I%}$L"
|
||||
unset W I L
|
||||
|
||||
else
|
||||
# We are not on xterminal
|
||||
PS1="%B[%l] %n@%m:%~ %#%b "
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_plain_setup
|
||||
|
@ -1,17 +1,5 @@
|
||||
function prompt_server_setup {
|
||||
# Setup PROMPT
|
||||
if `fancyTerm`; then
|
||||
# We are on xterminal
|
||||
W="%n@%m:%."
|
||||
I="%m:%."
|
||||
L="%T %B@%m %4(~:...:)%3~ %#%b "
|
||||
PS1="%{]2;$W%}%{]1;$I%}$L"
|
||||
unset W I L
|
||||
|
||||
else
|
||||
# We are not on xterminal
|
||||
PS1="%T %B%n@%m:%~ %#%b "
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_server_setup
|
||||
|
@ -1,19 +0,0 @@
|
||||
function prompt_minimal_setup {
|
||||
# Setup PROMPT
|
||||
if `fancyTerm`; then
|
||||
# We are on xterminal
|
||||
W="%n@%m:%."
|
||||
I="%m:%."
|
||||
L="%B%3(~:...:)%2~ %#%b "
|
||||
PS1="%{]2;$W%}%{]1;$I%}$L"
|
||||
unset W I L
|
||||
|
||||
else
|
||||
# We are not on xterminal
|
||||
PS1="%B%. %#%b "
|
||||
fi
|
||||
}
|
||||
|
||||
prompt_minimal_setup
|
||||
|
||||
# vim: set ts=4 sw=4 tw=0 ft=zsh :
|
Submodule zsh.d/prompts/pure updated: b122bbfca5...92b8e90579
0
zsh.d/prompts/testfile
Normal file
0
zsh.d/prompts/testfile
Normal file
672
zsh.d/zshfunctions/async
Normal file
672
zsh.d/zshfunctions/async
Normal file
@ -0,0 +1,672 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
#
|
||||
# zsh-async
|
||||
#
|
||||
# version: v1.8.5
|
||||
# author: Mathias Fredriksson
|
||||
# url: https://github.com/mafredri/zsh-async
|
||||
#
|
||||
|
||||
typeset -g ASYNC_VERSION=1.8.5
|
||||
# Produce debug output from zsh-async when set to 1.
|
||||
typeset -g ASYNC_DEBUG=${ASYNC_DEBUG:-0}
|
||||
|
||||
# Execute commands that can manipulate the environment inside the async worker. Return output via callback.
|
||||
_async_eval() {
|
||||
local ASYNC_JOB_NAME
|
||||
# Rename job to _async_eval and redirect all eval output to cat running
|
||||
# in _async_job. Here, stdout and stderr are not separated for
|
||||
# simplicity, this could be improved in the future.
|
||||
{
|
||||
eval "$@"
|
||||
} &> >(ASYNC_JOB_NAME=[async/eval] _async_job 'command -p cat')
|
||||
}
|
||||
|
||||
# Wrapper for jobs executed by the async worker, gives output in parseable format with execution time
|
||||
_async_job() {
|
||||
# Disable xtrace as it would mangle the output.
|
||||
setopt localoptions noxtrace
|
||||
|
||||
# Store start time for job.
|
||||
float -F duration=$EPOCHREALTIME
|
||||
|
||||
# Run the command and capture both stdout (`eval`) and stderr (`cat`) in
|
||||
# separate subshells. When the command is complete, we grab write lock
|
||||
# (mutex token) and output everything except stderr inside the command
|
||||
# block, after the command block has completed, the stdin for `cat` is
|
||||
# closed, causing stderr to be appended with a $'\0' at the end to mark the
|
||||
# end of output from this job.
|
||||
local jobname=${ASYNC_JOB_NAME:-$1} out
|
||||
out="$(
|
||||
local stdout stderr ret tok
|
||||
{
|
||||
stdout=$(eval "$@")
|
||||
ret=$?
|
||||
duration=$(( EPOCHREALTIME - duration )) # Calculate duration.
|
||||
|
||||
print -r -n - $'\0'${(q)jobname} $ret ${(q)stdout} $duration
|
||||
} 2> >(stderr=$(command -p cat) && print -r -n - " "${(q)stderr}$'\0')
|
||||
)"
|
||||
if [[ $out != $'\0'*$'\0' ]]; then
|
||||
# Corrupted output (aborted job?), skipping.
|
||||
return
|
||||
fi
|
||||
|
||||
# Grab mutex lock, stalls until token is available.
|
||||
read -r -k 1 -p tok || return 1
|
||||
|
||||
# Return output (<job_name> <return_code> <stdout> <duration> <stderr>).
|
||||
print -r -n - "$out"
|
||||
|
||||
# Unlock mutex by inserting a token.
|
||||
print -n -p $tok
|
||||
}
|
||||
|
||||
# The background worker manages all tasks and runs them without interfering with other processes
|
||||
_async_worker() {
|
||||
# Reset all options to defaults inside async worker.
|
||||
emulate -R zsh
|
||||
|
||||
# Make sure monitor is unset to avoid printing the
|
||||
# pids of child processes.
|
||||
unsetopt monitor
|
||||
|
||||
# Redirect stderr to `/dev/null` in case unforseen errors produced by the
|
||||
# worker. For example: `fork failed: resource temporarily unavailable`.
|
||||
# Some older versions of zsh might also print malloc errors (know to happen
|
||||
# on at least zsh 5.0.2 and 5.0.8) likely due to kill signals.
|
||||
exec 2>/dev/null
|
||||
|
||||
# When a zpty is deleted (using -d) all the zpty instances created before
|
||||
# the one being deleted receive a SIGHUP, unless we catch it, the async
|
||||
# worker would simply exit (stop working) even though visible in the list
|
||||
# of zpty's (zpty -L). This has been fixed around the time of Zsh 5.4
|
||||
# (not released).
|
||||
if ! is-at-least 5.4.1; then
|
||||
TRAPHUP() {
|
||||
return 0 # Return 0, indicating signal was handled.
|
||||
}
|
||||
fi
|
||||
|
||||
local -A storage
|
||||
local unique=0
|
||||
local notify_parent=0
|
||||
local parent_pid=0
|
||||
local coproc_pid=0
|
||||
local processing=0
|
||||
|
||||
local -a zsh_hooks zsh_hook_functions
|
||||
zsh_hooks=(chpwd periodic precmd preexec zshexit zshaddhistory)
|
||||
zsh_hook_functions=(${^zsh_hooks}_functions)
|
||||
unfunction $zsh_hooks &>/dev/null # Deactivate all zsh hooks inside the worker.
|
||||
unset $zsh_hook_functions # And hooks with registered functions.
|
||||
unset zsh_hooks zsh_hook_functions # Cleanup.
|
||||
|
||||
close_idle_coproc() {
|
||||
local -a pids
|
||||
pids=(${${(v)jobstates##*:*:}%\=*})
|
||||
|
||||
# If coproc (cat) is the only child running, we close it to avoid
|
||||
# leaving it running indefinitely and cluttering the process tree.
|
||||
if (( ! processing )) && [[ $#pids = 1 ]] && [[ $coproc_pid = $pids[1] ]]; then
|
||||
coproc :
|
||||
coproc_pid=0
|
||||
fi
|
||||
}
|
||||
|
||||
child_exit() {
|
||||
close_idle_coproc
|
||||
|
||||
# On older version of zsh (pre 5.2) we notify the parent through a
|
||||
# SIGWINCH signal because `zpty` did not return a file descriptor (fd)
|
||||
# prior to that.
|
||||
if (( notify_parent )); then
|
||||
# We use SIGWINCH for compatibility with older versions of zsh
|
||||
# (pre 5.1.1) where other signals (INFO, ALRM, USR1, etc.) could
|
||||
# cause a deadlock in the shell under certain circumstances.
|
||||
kill -WINCH $parent_pid
|
||||
fi
|
||||
}
|
||||
|
||||
# Register a SIGCHLD trap to handle the completion of child processes.
|
||||
trap child_exit CHLD
|
||||
|
||||
# Process option parameters passed to worker.
|
||||
while getopts "np:uz" opt; do
|
||||
case $opt in
|
||||
n) notify_parent=1;;
|
||||
p) parent_pid=$OPTARG;;
|
||||
u) unique=1;;
|
||||
z) notify_parent=0;; # Uses ZLE watcher instead.
|
||||
esac
|
||||
done
|
||||
|
||||
# Terminate all running jobs, note that this function does not
|
||||
# reinstall the child trap.
|
||||
terminate_jobs() {
|
||||
trap - CHLD # Ignore child exits during kill.
|
||||
coproc : # Quit coproc.
|
||||
coproc_pid=0 # Reset pid.
|
||||
|
||||
if is-at-least 5.4.1; then
|
||||
trap '' HUP # Catch the HUP sent to this process.
|
||||
kill -HUP -$$ # Send to entire process group.
|
||||
trap - HUP # Disable HUP trap.
|
||||
else
|
||||
# We already handle HUP for Zsh < 5.4.1.
|
||||
kill -HUP -$$ # Send to entire process group.
|
||||
fi
|
||||
}
|
||||
|
||||
killjobs() {
|
||||
local tok
|
||||
local -a pids
|
||||
pids=(${${(v)jobstates##*:*:}%\=*})
|
||||
|
||||
# No need to send SIGHUP if no jobs are running.
|
||||
(( $#pids == 0 )) && continue
|
||||
(( $#pids == 1 )) && [[ $coproc_pid = $pids[1] ]] && continue
|
||||
|
||||
# Grab lock to prevent half-written output in case a child
|
||||
# process is in the middle of writing to stdin during kill.
|
||||
(( coproc_pid )) && read -r -k 1 -p tok
|
||||
|
||||
terminate_jobs
|
||||
trap child_exit CHLD # Reinstall child trap.
|
||||
}
|
||||
|
||||
local request do_eval=0
|
||||
local -a cmd
|
||||
while :; do
|
||||
# Wait for jobs sent by async_job.
|
||||
read -r -d $'\0' request || {
|
||||
# Unknown error occurred while reading from stdin, the zpty
|
||||
# worker is likely in a broken state, so we shut down.
|
||||
terminate_jobs
|
||||
|
||||
# Stdin is broken and in case this was an unintended
|
||||
# crash, we try to report it as a last hurrah.
|
||||
print -r -n $'\0'"'[async]'" $(( 127 + 3 )) "''" 0 "'$0:$LINENO: zpty fd died, exiting'"$'\0'
|
||||
|
||||
# We use `return` to abort here because using `exit` may
|
||||
# result in an infinite loop that never exits and, as a
|
||||
# result, high CPU utilization.
|
||||
return $(( 127 + 1 ))
|
||||
}
|
||||
|
||||
# We need to clean the input here because sometimes when a zpty
|
||||
# has died and been respawned, messages will be prefixed with a
|
||||
# carraige return (\r, or \C-M).
|
||||
request=${request#$'\C-M'}
|
||||
|
||||
# Check for non-job commands sent to worker
|
||||
case $request in
|
||||
_killjobs) killjobs; continue;;
|
||||
_async_eval*) do_eval=1;;
|
||||
esac
|
||||
|
||||
# Parse the request using shell parsing (z) to allow commands
|
||||
# to be parsed from single strings and multi-args alike.
|
||||
cmd=("${(z)request}")
|
||||
|
||||
# Name of the job (first argument).
|
||||
local job=$cmd[1]
|
||||
|
||||
# Check if a worker should perform unique jobs, unless
|
||||
# this is an eval since they run synchronously.
|
||||
if (( !do_eval )) && (( unique )); then
|
||||
# Check if a previous job is still running, if yes,
|
||||
# skip this job and let the previous one finish.
|
||||
for pid in ${${(v)jobstates##*:*:}%\=*}; do
|
||||
if [[ ${storage[$job]} == $pid ]]; then
|
||||
continue 2
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Guard against closing coproc from trap before command has started.
|
||||
processing=1
|
||||
|
||||
# Because we close the coproc after the last job has completed, we must
|
||||
# recreate it when there are no other jobs running.
|
||||
if (( ! coproc_pid )); then
|
||||
# Use coproc as a mutex for synchronized output between children.
|
||||
coproc command -p cat
|
||||
coproc_pid="$!"
|
||||
# Insert token into coproc
|
||||
print -n -p "t"
|
||||
fi
|
||||
|
||||
if (( do_eval )); then
|
||||
shift cmd # Strip _async_eval from cmd.
|
||||
_async_eval $cmd
|
||||
else
|
||||
# Run job in background, completed jobs are printed to stdout.
|
||||
_async_job $cmd &
|
||||
# Store pid because zsh job manager is extremely unflexible (show jobname as non-unique '$job')...
|
||||
storage[$job]="$!"
|
||||
fi
|
||||
|
||||
processing=0 # Disable guard.
|
||||
|
||||
if (( do_eval )); then
|
||||
do_eval=0
|
||||
|
||||
# When there are no active jobs we can't rely on the CHLD trap to
|
||||
# manage the coproc lifetime.
|
||||
close_idle_coproc
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
#
|
||||
# Get results from finished jobs and pass it to the to callback function. This is the only way to reliably return the
|
||||
# job name, return code, output and execution time and with minimal effort.
|
||||
#
|
||||
# If the async process buffer becomes corrupt, the callback will be invoked with the first argument being `[async]` (job
|
||||
# name), non-zero return code and fifth argument describing the error (stderr).
|
||||
#
|
||||
# usage:
|
||||
# async_process_results <worker_name> <callback_function>
|
||||
#
|
||||
# callback_function is called with the following parameters:
|
||||
# $1 = job name, e.g. the function passed to async_job
|
||||
# $2 = return code
|
||||
# $3 = resulting stdout from execution
|
||||
# $4 = execution time, floating point e.g. 2.05 seconds
|
||||
# $5 = resulting stderr from execution
|
||||
# $6 = has next result in buffer (0 = buffer empty, 1 = yes)
|
||||
#
|
||||
async_process_results() {
|
||||
setopt localoptions unset noshwordsplit noksharrays noposixidentifiers noposixstrings
|
||||
|
||||
local worker=$1
|
||||
local callback=$2
|
||||
local caller=$3
|
||||
local -a items
|
||||
local null=$'\0' data
|
||||
integer -l len pos num_processed has_next
|
||||
|
||||
typeset -gA ASYNC_PROCESS_BUFFER
|
||||
|
||||
# Read output from zpty and parse it if available.
|
||||
while zpty -r -t $worker data 2>/dev/null; do
|
||||
ASYNC_PROCESS_BUFFER[$worker]+=$data
|
||||
len=${#ASYNC_PROCESS_BUFFER[$worker]}
|
||||
pos=${ASYNC_PROCESS_BUFFER[$worker][(i)$null]} # Get index of NULL-character (delimiter).
|
||||
|
||||
# Keep going until we find a NULL-character.
|
||||
if (( ! len )) || (( pos > len )); then
|
||||
continue
|
||||
fi
|
||||
|
||||
while (( pos <= len )); do
|
||||
# Take the content from the beginning, until the NULL-character and
|
||||
# perform shell parsing (z) and unquoting (Q) as an array (@).
|
||||
items=("${(@Q)${(z)ASYNC_PROCESS_BUFFER[$worker][1,$pos-1]}}")
|
||||
|
||||
# Remove the extracted items from the buffer.
|
||||
ASYNC_PROCESS_BUFFER[$worker]=${ASYNC_PROCESS_BUFFER[$worker][$pos+1,$len]}
|
||||
|
||||
len=${#ASYNC_PROCESS_BUFFER[$worker]}
|
||||
if (( len > 1 )); then
|
||||
pos=${ASYNC_PROCESS_BUFFER[$worker][(i)$null]} # Get index of NULL-character (delimiter).
|
||||
fi
|
||||
|
||||
has_next=$(( len != 0 ))
|
||||
if (( $#items == 5 )); then
|
||||
items+=($has_next)
|
||||
$callback "${(@)items}" # Send all parsed items to the callback.
|
||||
(( num_processed++ ))
|
||||
elif [[ -z $items ]]; then
|
||||
# Empty items occur between results due to double-null ($'\0\0')
|
||||
# caused by commands being both pre and suffixed with null.
|
||||
else
|
||||
# In case of corrupt data, invoke callback with *async* as job
|
||||
# name, non-zero exit status and an error message on stderr.
|
||||
$callback "[async]" 1 "" 0 "$0:$LINENO: error: bad format, got ${#items} items (${(q)items})" $has_next
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
(( num_processed )) && return 0
|
||||
|
||||
# Avoid printing exit value when `setopt printexitvalue` is active.`
|
||||
[[ $caller = trap || $caller = watcher ]] && return 0
|
||||
|
||||
# No results were processed
|
||||
return 1
|
||||
}
|
||||
|
||||
# Watch worker for output
|
||||
_async_zle_watcher() {
|
||||
setopt localoptions noshwordsplit
|
||||
typeset -gA ASYNC_PTYS ASYNC_CALLBACKS
|
||||
local worker=$ASYNC_PTYS[$1]
|
||||
local callback=$ASYNC_CALLBACKS[$worker]
|
||||
|
||||
if [[ -n $2 ]]; then
|
||||
# from man zshzle(1):
|
||||
# `hup' for a disconnect, `nval' for a closed or otherwise
|
||||
# invalid descriptor, or `err' for any other condition.
|
||||
# Systems that support only the `select' system call always use
|
||||
# `err'.
|
||||
|
||||
# this has the side effect to unregister the broken file descriptor
|
||||
async_stop_worker $worker
|
||||
|
||||
if [[ -n $callback ]]; then
|
||||
$callback '[async]' 2 "" 0 "$0:$LINENO: error: fd for $worker failed: zle -F $1 returned error $2" 0
|
||||
fi
|
||||
return
|
||||
fi;
|
||||
|
||||
if [[ -n $callback ]]; then
|
||||
async_process_results $worker $callback watcher
|
||||
fi
|
||||
}
|
||||
|
||||
_async_send_job() {
|
||||
setopt localoptions noshwordsplit noksharrays noposixidentifiers noposixstrings
|
||||
|
||||
local caller=$1
|
||||
local worker=$2
|
||||
shift 2
|
||||
|
||||
zpty -t $worker &>/dev/null || {
|
||||
typeset -gA ASYNC_CALLBACKS
|
||||
local callback=$ASYNC_CALLBACKS[$worker]
|
||||
|
||||
if [[ -n $callback ]]; then
|
||||
$callback '[async]' 3 "" 0 "$0:$LINENO: error: no such worker: $worker" 0
|
||||
else
|
||||
print -u2 "$caller: no such async worker: $worker"
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
zpty -w $worker "$@"$'\0'
|
||||
}
|
||||
|
||||
#
|
||||
# Start a new asynchronous job on specified worker, assumes the worker is running.
|
||||
#
|
||||
# Note if you are using a function for the job, it must have been defined before the worker was
|
||||
# started or you will get a `command not found` error.
|
||||
#
|
||||
# usage:
|
||||
# async_job <worker_name> <my_function> [<function_params>]
|
||||
#
|
||||
async_job() {
|
||||
setopt localoptions noshwordsplit noksharrays noposixidentifiers noposixstrings
|
||||
|
||||
local worker=$1; shift
|
||||
|
||||
local -a cmd
|
||||
cmd=("$@")
|
||||
if (( $#cmd > 1 )); then
|
||||
cmd=(${(q)cmd}) # Quote special characters in multi argument commands.
|
||||
fi
|
||||
|
||||
_async_send_job $0 $worker "$cmd"
|
||||
}
|
||||
|
||||
#
|
||||
# Evaluate a command (like async_job) inside the async worker, then worker environment can be manipulated. For example,
|
||||
# issuing a cd command will change the PWD of the worker which will then be inherited by all future async jobs.
|
||||
#
|
||||
# Output will be returned via callback, job name will be [async/eval].
|
||||
#
|
||||
# usage:
|
||||
# async_worker_eval <worker_name> <my_function> [<function_params>]
|
||||
#
|
||||
async_worker_eval() {
|
||||
setopt localoptions noshwordsplit noksharrays noposixidentifiers noposixstrings
|
||||
|
||||
local worker=$1; shift
|
||||
|
||||
local -a cmd
|
||||
cmd=("$@")
|
||||
if (( $#cmd > 1 )); then
|
||||
cmd=(${(q)cmd}) # Quote special characters in multi argument commands.
|
||||
fi
|
||||
|
||||
# Quote the cmd in case RC_EXPAND_PARAM is set.
|
||||
_async_send_job $0 $worker "_async_eval $cmd"
|
||||
}
|
||||
|
||||
# This function traps notification signals and calls all registered callbacks
|
||||
_async_notify_trap() {
|
||||
setopt localoptions noshwordsplit
|
||||
|
||||
local k
|
||||
for k in ${(k)ASYNC_CALLBACKS}; do
|
||||
async_process_results $k ${ASYNC_CALLBACKS[$k]} trap
|
||||
done
|
||||
}
|
||||
|
||||
#
|
||||
# Register a callback for completed jobs. As soon as a job is finnished, async_process_results will be called with the
|
||||
# specified callback function. This requires that a worker is initialized with the -n (notify) option.
|
||||
#
|
||||
# usage:
|
||||
# async_register_callback <worker_name> <callback_function>
|
||||
#
|
||||
async_register_callback() {
|
||||
setopt localoptions noshwordsplit nolocaltraps
|
||||
|
||||
typeset -gA ASYNC_PTYS ASYNC_CALLBACKS
|
||||
local worker=$1; shift
|
||||
|
||||
ASYNC_CALLBACKS[$worker]="$*"
|
||||
|
||||
# Enable trap when the ZLE watcher is unavailable, allows
|
||||
# workers to notify (via -n) when a job is done.
|
||||
if [[ ! -o interactive ]] || [[ ! -o zle ]]; then
|
||||
trap '_async_notify_trap' WINCH
|
||||
elif [[ -o interactive ]] && [[ -o zle ]]; then
|
||||
local fd w
|
||||
for fd w in ${(@kv)ASYNC_PTYS}; do
|
||||
if [[ $w == $worker ]]; then
|
||||
zle -F $fd _async_zle_watcher # Register the ZLE handler.
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Unregister the callback for a specific worker.
|
||||
#
|
||||
# usage:
|
||||
# async_unregister_callback <worker_name>
|
||||
#
|
||||
async_unregister_callback() {
|
||||
typeset -gA ASYNC_CALLBACKS
|
||||
|
||||
unset "ASYNC_CALLBACKS[$1]"
|
||||
}
|
||||
|
||||
#
|
||||
# Flush all current jobs running on a worker. This will terminate any and all running processes under the worker, use
|
||||
# with caution.
|
||||
#
|
||||
# usage:
|
||||
# async_flush_jobs <worker_name>
|
||||
#
|
||||
async_flush_jobs() {
|
||||
setopt localoptions noshwordsplit
|
||||
|
||||
local worker=$1; shift
|
||||
|
||||
# Check if the worker exists
|
||||
zpty -t $worker &>/dev/null || return 1
|
||||
|
||||
# Send kill command to worker
|
||||
async_job $worker "_killjobs"
|
||||
|
||||
# Clear the zpty buffer.
|
||||
local junk
|
||||
if zpty -r -t $worker junk '*'; then
|
||||
(( ASYNC_DEBUG )) && print -n "async_flush_jobs $worker: ${(V)junk}"
|
||||
while zpty -r -t $worker junk '*'; do
|
||||
(( ASYNC_DEBUG )) && print -n "${(V)junk}"
|
||||
done
|
||||
(( ASYNC_DEBUG )) && print
|
||||
fi
|
||||
|
||||
# Finally, clear the process buffer in case of partially parsed responses.
|
||||
typeset -gA ASYNC_PROCESS_BUFFER
|
||||
unset "ASYNC_PROCESS_BUFFER[$worker]"
|
||||
}
|
||||
|
||||
#
|
||||
# Start a new async worker with optional parameters, a worker can be told to only run unique tasks and to notify a
|
||||
# process when tasks are complete.
|
||||
#
|
||||
# usage:
|
||||
# async_start_worker <worker_name> [-u] [-n] [-p <pid>]
|
||||
#
|
||||
# opts:
|
||||
# -u unique (only unique job names can run)
|
||||
# -n notify through SIGWINCH signal
|
||||
# -p pid to notify (defaults to current pid)
|
||||
#
|
||||
async_start_worker() {
|
||||
setopt localoptions noshwordsplit noclobber
|
||||
|
||||
local worker=$1; shift
|
||||
local -a args
|
||||
args=("$@")
|
||||
zpty -t $worker &>/dev/null && return
|
||||
|
||||
typeset -gA ASYNC_PTYS
|
||||
typeset -h REPLY
|
||||
typeset has_xtrace=0
|
||||
|
||||
if [[ -o interactive ]] && [[ -o zle ]]; then
|
||||
# Inform the worker to ignore the notify flag and that we're
|
||||
# using a ZLE watcher instead.
|
||||
args+=(-z)
|
||||
|
||||
if (( ! ASYNC_ZPTY_RETURNS_FD )); then
|
||||
# When zpty doesn't return a file descriptor (on older versions of zsh)
|
||||
# we try to guess it anyway.
|
||||
integer -l zptyfd
|
||||
exec {zptyfd}>&1 # Open a new file descriptor (above 10).
|
||||
exec {zptyfd}>&- # Close it so it's free to be used by zpty.
|
||||
fi
|
||||
fi
|
||||
|
||||
# Workaround for stderr in the main shell sometimes (incorrectly) being
|
||||
# reassigned to /dev/null by the reassignment done inside the async
|
||||
# worker.
|
||||
# See https://github.com/mafredri/zsh-async/issues/35.
|
||||
integer errfd=-1
|
||||
|
||||
# Redirect of errfd is broken on zsh 5.0.2.
|
||||
if is-at-least 5.0.8; then
|
||||
exec {errfd}>&2
|
||||
fi
|
||||
|
||||
# Make sure async worker is started without xtrace
|
||||
# (the trace output interferes with the worker).
|
||||
[[ -o xtrace ]] && {
|
||||
has_xtrace=1
|
||||
unsetopt xtrace
|
||||
}
|
||||
|
||||
if (( errfd != -1 )); then
|
||||
zpty -b $worker _async_worker -p $$ $args 2>&$errfd
|
||||
else
|
||||
zpty -b $worker _async_worker -p $$ $args
|
||||
fi
|
||||
local ret=$?
|
||||
|
||||
# Re-enable it if it was enabled, for debugging.
|
||||
(( has_xtrace )) && setopt xtrace
|
||||
(( errfd != -1 )) && exec {errfd}>& -
|
||||
|
||||
if (( ret )); then
|
||||
async_stop_worker $worker
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! is-at-least 5.0.8; then
|
||||
# For ZSH versions older than 5.0.8 we delay a bit to give
|
||||
# time for the worker to start before issuing commands,
|
||||
# otherwise it will not be ready to receive them.
|
||||
sleep 0.001
|
||||
fi
|
||||
|
||||
if [[ -o interactive ]] && [[ -o zle ]]; then
|
||||
if (( ! ASYNC_ZPTY_RETURNS_FD )); then
|
||||
REPLY=$zptyfd # Use the guessed value for the file desciptor.
|
||||
fi
|
||||
|
||||
ASYNC_PTYS[$REPLY]=$worker # Map the file desciptor to the worker.
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Stop one or multiple workers that are running, all unfetched and incomplete work will be lost.
|
||||
#
|
||||
# usage:
|
||||
# async_stop_worker <worker_name_1> [<worker_name_2>]
|
||||
#
|
||||
async_stop_worker() {
|
||||
setopt localoptions noshwordsplit
|
||||
|
||||
local ret=0 worker k v
|
||||
for worker in $@; do
|
||||
# Find and unregister the zle handler for the worker
|
||||
for k v in ${(@kv)ASYNC_PTYS}; do
|
||||
if [[ $v == $worker ]]; then
|
||||
zle -F $k
|
||||
unset "ASYNC_PTYS[$k]"
|
||||
fi
|
||||
done
|
||||
async_unregister_callback $worker
|
||||
zpty -d $worker 2>/dev/null || ret=$?
|
||||
|
||||
# Clear any partial buffers.
|
||||
typeset -gA ASYNC_PROCESS_BUFFER
|
||||
unset "ASYNC_PROCESS_BUFFER[$worker]"
|
||||
done
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
#
|
||||
# Initialize the required modules for zsh-async. To be called before using the zsh-async library.
|
||||
#
|
||||
# usage:
|
||||
# async_init
|
||||
#
|
||||
async_init() {
|
||||
(( ASYNC_INIT_DONE )) && return
|
||||
typeset -g ASYNC_INIT_DONE=1
|
||||
|
||||
zmodload zsh/zpty
|
||||
zmodload zsh/datetime
|
||||
|
||||
# Load is-at-least for reliable version check.
|
||||
autoload -Uz is-at-least
|
||||
|
||||
# Check if zsh/zpty returns a file descriptor or not,
|
||||
# shell must also be interactive with zle enabled.
|
||||
typeset -g ASYNC_ZPTY_RETURNS_FD=0
|
||||
[[ -o interactive ]] && [[ -o zle ]] && {
|
||||
typeset -h REPLY
|
||||
zpty _async_test :
|
||||
(( REPLY )) && ASYNC_ZPTY_RETURNS_FD=1
|
||||
zpty -d _async_test
|
||||
}
|
||||
}
|
||||
|
||||
async() {
|
||||
async_init
|
||||
}
|
||||
|
||||
async "$@"
|
@ -1,11 +0,0 @@
|
||||
if [[ -z "$1" ]]
|
||||
then
|
||||
unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE
|
||||
echo AWS profile cleared.
|
||||
return
|
||||
fi
|
||||
#saml2aws login -a $1 -p $1
|
||||
#eval $(saml2aws script -a $1 -p $1 --skip-prompt)
|
||||
export AWS_DEFAULT_PROFILE=$1
|
||||
export AWS_PROFILE=$1
|
||||
export AWS_EB_PROFILE=$1
|
Binary file not shown.
68
zsh.d/zshfunctions/awsprofile
Normal file
68
zsh.d/zshfunctions/awsprofile
Normal file
@ -0,0 +1,68 @@
|
||||
profile=$1
|
||||
[ $# -gt 0 ] && shift
|
||||
region=${1:-""}
|
||||
|
||||
|
||||
declare -A symRegions
|
||||
symRegions[ire1]='eu-west-1'
|
||||
symRegions[fra1]='eu-central-1'
|
||||
symRegions[ohio1]='us-east-2'
|
||||
|
||||
lookup_region=${symRegions[$region]}
|
||||
|
||||
[ -z $lookup_region ] || region=${lookup_region}
|
||||
|
||||
if [ ! -f ~/.aws/config ]; then
|
||||
echo "no aws config file found, bailing out..."
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ $profile ]; then # We got a profile pattern, look for a match
|
||||
# look for an exact match
|
||||
grep -qE "\[profile $profile\]" ~/.aws/config
|
||||
|
||||
if [ $? -eq 0 ]; then # We have an exact match
|
||||
match=$profile
|
||||
else # Look for regex match
|
||||
match=$(grep -E "\[profile .*$profile.*" ~/.aws/config | sed -E 's/\[profile (.+)\]/\1/') # Array of matching profiles
|
||||
match_no=$(echo $match|wc -l) # Number of profiles matching
|
||||
|
||||
if [ $match_no -gt 1 ]; then # more than one match
|
||||
print -P "$FX[bold]multiple profile match:"
|
||||
print -P "$FG[003]"
|
||||
echo $match
|
||||
print -P "$FX[reset]"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $match ]; then # Single match, setting profile
|
||||
export AWS_CLI_AUTO_PROMPT=off
|
||||
|
||||
# Set default profile and profile
|
||||
export AWS_DEFAULT_PROFILE=$match
|
||||
export AWS_PROFILE=${AWS_DEFAULT_PROFILE}
|
||||
|
||||
# Get default region and set region to argument or default region
|
||||
export AWS_DEFAULT_REGION=$(aws configure get region)
|
||||
export AWS_REGION=${region:-$AWS_DEFAULT_REGION}
|
||||
|
||||
print -P "$FX[bold]activating profile $FG[075]$match$FX[reset]$FX[bold] on region $FG[075]$AWS_REGION$FX[reset]"
|
||||
export AWS_CLI_AUTO_PROMPT=on
|
||||
return
|
||||
else
|
||||
print -P "$FX[bold]$FG[009]no match for $profile$FX[reset]"
|
||||
return
|
||||
fi
|
||||
|
||||
elif [ $AWS_PROFILE ]; then # no profile passed, clean up current one, logout
|
||||
unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_DEFAULT_REGION AWS_REGION
|
||||
print -P "$FX[bold]profile cleared$FX[reset]."
|
||||
return
|
||||
fi
|
||||
|
||||
print -P "$FX[bold]available profiles"
|
||||
print -P "$FG[075]"
|
||||
grep profile ~/.aws/config | sed -E 's/\[profile (.+)\]/\1/'
|
||||
print -P "$FX[reset]"
|
||||
# vim: set ts=2 sw=2 tw=0 ft=sh :
|
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
hdu -s *
|
Binary file not shown.
72
zsh.d/zshfunctions/gitfetch
Normal file
72
zsh.d/zshfunctions/gitfetch
Normal file
@ -0,0 +1,72 @@
|
||||
local _gitdir
|
||||
local last_fetch
|
||||
local diff
|
||||
|
||||
# exec 3>&1 4>&2
|
||||
# trap 'exec 2>&4 1>&3' 0 1 2 3
|
||||
# exec 1>>~/tmp/gitfetch.log 2>&1
|
||||
|
||||
cd $1
|
||||
|
||||
|
||||
gitdir=$(git rev-parse --git-dir 2> /dev/null) || return 0
|
||||
last_fetch=$(zstat +mtime $gitdir/FETCH_HEAD 2> /dev/null || echo 0)
|
||||
let "diff = $(strftime %s) - $last_fetch"
|
||||
if [ $diff -gt ${GIT_FETCH_INTERVAL:-30} ]; then
|
||||
setopt localoptions noshwordsplit
|
||||
|
||||
# Sets `GIT_TERMINAL_PROMPT=0` to disable authentication prompt for Git fetch (Git 2.3+).
|
||||
export GIT_TERMINAL_PROMPT=0
|
||||
# Set SSH `BachMode` to disable all interactive SSH password prompting.
|
||||
export GIT_SSH_COMMAND="${GIT_SSH_COMMAND:-"ssh"} -o BatchMode=yes"
|
||||
|
||||
local ref
|
||||
ref=$(command git symbolic-ref -q HEAD)
|
||||
local -a remote
|
||||
remote=($(command git for-each-ref --format='%(upstream:remotename) %(refname)' $ref))
|
||||
|
||||
if [[ -z $remote[1] ]]; then
|
||||
# No remote specified for this branch, skip fetch.
|
||||
return 97
|
||||
fi
|
||||
|
||||
# Default return code, which indicates Git fetch failure.
|
||||
local fail_code=99
|
||||
|
||||
# Guard against all forms of password prompts. By setting the shell into
|
||||
# MONITOR mode we can notice when a child process prompts for user input
|
||||
# because it will be suspended. Since we are inside an async worker, we
|
||||
# have no way of transmitting the password and the only option is to
|
||||
# kill it. If we don't do it this way, the process will corrupt with the
|
||||
# async worker.
|
||||
setopt localtraps monitor
|
||||
|
||||
# Make sure local HUP trap is unset to allow for signal propagation when
|
||||
# the async worker is flushed.
|
||||
trap - HUP
|
||||
|
||||
trap '
|
||||
# Unset trap to prevent infinite loop
|
||||
trap - CHLD
|
||||
if [[ $jobstates = suspended* ]]; then
|
||||
# Set fail code to password prompt and kill the fetch.
|
||||
fail_code=98
|
||||
kill %%
|
||||
fi
|
||||
' CHLD
|
||||
|
||||
# Only fetch information for the current branch and avoid
|
||||
# fetching tags or submodules to speed up the process.
|
||||
command git -c gc.auto=0 fetch \
|
||||
--quiet \
|
||||
--no-tags \
|
||||
--recurse-submodules=yes \
|
||||
$remote &>/dev/null &
|
||||
wait $! || return $fail_code
|
||||
|
||||
unsetopt monitor
|
||||
fi
|
||||
|
||||
return 0
|
||||
|
||||
# vim: set ts=2 sw=2 tw=0 ft=sh :
|
58
zsh.d/zshfunctions/status
Normal file
58
zsh.d/zshfunctions/status
Normal file
@ -0,0 +1,58 @@
|
||||
local cpu_type
|
||||
|
||||
echo
|
||||
|
||||
if [ $KERNEL = "Darwin" ]; then
|
||||
cpu_type=$(sysctl -n machdep.cpu.brand_string)
|
||||
elif [ $KERNEL = "Linux" ]; then
|
||||
cpu_type=$(cat /proc/cpuinfo|grep "model name"|cut -d: -f2|uniq)
|
||||
fi
|
||||
|
||||
print -P "$FX[bold]Kernel:$FX[reset] $KERNEL"
|
||||
print -P "$FX[bold]CPU type: $FX[reset]$cpu_type"
|
||||
print -P "$FX[bold]Library:$FX[reset] $LIBRARY"
|
||||
|
||||
echo
|
||||
|
||||
if [ $HOMEBREW_PREFIX ]; then
|
||||
print -P "$FX[bold]Homebrew enabled: $FG[002]yes$FX[reset]"
|
||||
print -P "$FX[bold]Homebrew prefix: $FG[002]$HOMEBREW_PREFIX$FX[reset]"
|
||||
else
|
||||
print -P "$FX[bold]Homebrew enabled: $FG[001]no$FX[reset]"
|
||||
fi
|
||||
|
||||
print -nP "\n$FX[bold]iTerm2 integration: "
|
||||
if [ -e $HOME/.iterm2_shell_integration.zsh ]; then
|
||||
print -P "$FG[002]present$FX[reset]"
|
||||
else
|
||||
print -P "$FG[001]absent$FX[reset]"
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
for plugin in thefuck pyenv kubectl aws; do
|
||||
print -nP "$FX[bold]$plugin: "
|
||||
if type $plugin > /dev/null; then
|
||||
print -P "$FG[002]installed$FX[reset]"
|
||||
else
|
||||
print -P "$FG[001]absent$FX[reset]"
|
||||
fi
|
||||
done
|
||||
|
||||
print -nP "$FX[bold]zsh z: "
|
||||
if [ -e $LIBRARY/plugins/zsh-z/zsh-z.plugin.zsh ]; then
|
||||
print -P "$FG[002]present$FX[reset]"
|
||||
else
|
||||
print -P "$FG[001]absent$FX[reset]"
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
print -nP "$FX[bold]oh-my-posh: "
|
||||
if type oh-my-posh > /dev/null; then
|
||||
print -P "$FG[002]installed$FX[reset] $FX[bold]- theme: $FG[002]$POSH_THEME$FX[reset]"
|
||||
else
|
||||
print -P "$FG[001]absent$FX[reset]"
|
||||
fi
|
||||
|
||||
# vim: set ts=2 sw=2 tw=0 ft=sh :
|
@ -1,5 +1,43 @@
|
||||
if [ -r "$1" ]; then
|
||||
openssl x509 -in $1 -noout -text | less
|
||||
else
|
||||
echo "x509 <certfile>"
|
||||
usage() {
|
||||
echo "x509 <certfile>"
|
||||
echo "x509 -r <hostname:port>"
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
usage
|
||||
return 0
|
||||
fi
|
||||
|
||||
help=0
|
||||
remote=0
|
||||
|
||||
while getopts ":hr:" arg; do
|
||||
case $arg in
|
||||
r)
|
||||
remote=1
|
||||
host=$OPTARG
|
||||
hostname=$(echo $host|cut -d: -f1)
|
||||
;;
|
||||
h|*) help=1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $help -eq 1 ]; then
|
||||
usage
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ $remote -eq 0 ]; then
|
||||
if [ -f $* ]; then
|
||||
openssl x509 -in $* -noout -text
|
||||
else
|
||||
echo "$* not found"
|
||||
usage
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
openssl s_client -connect $host -servername $hostname < /dev/null | openssl x509 -noout -text
|
||||
fi
|
||||
|
||||
# vim: set ts=2 sw=2 tw=0 ft=sh :
|
||||
|
Binary file not shown.
36
zshrc
36
zshrc
@ -7,6 +7,11 @@
|
||||
# Global Order: zshenv, zprofile, zshrc, zlogin
|
||||
#
|
||||
|
||||
# Load zprof if we need to profile startup time
|
||||
# at the bottom of ~/.zshrc add `zprof >! zsh_profile` to save
|
||||
# profiling data at startup
|
||||
# zmodload zsh/zprof
|
||||
|
||||
# Determine zsh conf file position. On Debian/Ubuntu is /etc/zsh, on other should be /etc
|
||||
#
|
||||
[ -d /etc/zsh ] && BASE="/etc/zsh" || BASE="/etc"
|
||||
@ -15,34 +20,29 @@
|
||||
[ -d ~/.zsh ] && BASE=~/.zsh
|
||||
|
||||
function loadRC {
|
||||
if [ -d $1/zshfunctions ]; then
|
||||
fpath=($1/zshfunctions $fpath)
|
||||
fi
|
||||
[ -d $1/zshfunctions ] && fpath=($1/zshfunctions $fpath)
|
||||
[ -d $1/completions ] && fpath=($1/completions $fpath)
|
||||
|
||||
if [ -d $1/completions ]; then
|
||||
fpath=($1/completions $fpath)
|
||||
fi
|
||||
|
||||
# # Add local customization file
|
||||
# if [ -w $1 ]; then
|
||||
# [ -f $1/99-local.zsh ] || echo "# Local customizations" > $1/99-local.zsh
|
||||
# fi
|
||||
|
||||
# Process all .zsh files
|
||||
for zshFile in $1/[0-9]*.zsh; do
|
||||
. $zshFile
|
||||
done
|
||||
for zshFile in $1/[0-9]*.zsh; do
|
||||
source $zshFile
|
||||
done
|
||||
}
|
||||
|
||||
# Default PATH
|
||||
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
|
||||
|
||||
local KERNEL=`uname -s`
|
||||
local LIBRARY=${BASE}/zsh.d
|
||||
local KERNLIB=${LIBRARY}/${KERNEL}
|
||||
|
||||
loadRC ${LIBRARY}
|
||||
loadRC ${KERNLIB}
|
||||
loadRC ${LIBRARY}
|
||||
|
||||
# Add home bin to PATH
|
||||
PATH="$PATH:$HOME/bin"
|
||||
|
||||
# Add local customization file
|
||||
if [ -w $LIBRARY ]; then
|
||||
[ -f $LIBRARY/99-local.zsh ] || echo "# Local customizations" > $LIBRARY/99-local.zsh
|
||||
[ -f $LIBRARY/99-local.zsh ] || echo "# Local customizations" > $LIBRARY/99-local.zsh
|
||||
fi
|
||||
|
||||
|
Reference in New Issue
Block a user