mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-23 02:35:38 +01:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
02b070e225
10 changed files with 177 additions and 8 deletions
|
|
@ -11,6 +11,12 @@ To use it, add colorize to the plugins array of your zshrc file:
|
|||
plugins=(... colorize)
|
||||
```
|
||||
|
||||
## Styles
|
||||
|
||||
Pygments offers multiple styles. By default, the `default` style is used, but you can choose another theme by setting the `ZSH_COLORIZE_STYLE` environment variable:
|
||||
|
||||
`ZSH_COLORIZE_STYLE="colorful"`
|
||||
|
||||
## Usage
|
||||
|
||||
* `ccat <file> [files]`: colorize the contents of the file (or files, if more than one are provided).
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# easier alias to use the plugin
|
||||
alias ccat='colorize_via_pygmentize'
|
||||
alias cless='colorize_via_pygmentize_less'
|
||||
alias cless='colorize_via_pygmentize_less'
|
||||
|
||||
colorize_via_pygmentize() {
|
||||
if ! (( $+commands[pygmentize] )); then
|
||||
|
|
@ -8,36 +8,44 @@ colorize_via_pygmentize() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
# If the environment varianle ZSH_COLORIZE_STYLE
|
||||
# is set, use that theme instead. Otherwise,
|
||||
# use the default.
|
||||
if [ -z $ZSH_COLORIZE_STYLE ]; then
|
||||
ZSH_COLORIZE_STYLE="default"
|
||||
fi
|
||||
|
||||
# pygmentize stdin if no arguments passed
|
||||
if [ $# -eq 0 ]; then
|
||||
pygmentize -g
|
||||
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g
|
||||
return $?
|
||||
fi
|
||||
|
||||
# guess lexer from file extension, or
|
||||
# guess it from file contents if unsuccessful
|
||||
|
||||
local FNAME lexer
|
||||
for FNAME in "$@"
|
||||
do
|
||||
lexer=$(pygmentize -N "$FNAME")
|
||||
if [[ $lexer != text ]]; then
|
||||
pygmentize -l "$lexer" "$FNAME"
|
||||
pygmentize -O style="$ZSH_COLORIZE_STYLE" -l "$lexer" "$FNAME"
|
||||
else
|
||||
pygmentize -g "$FNAME"
|
||||
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g "$FNAME"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
colorize_via_pygmentize_less() (
|
||||
colorize_via_pygmentize_less() (
|
||||
# this function is a subshell so tmp_files can be shared to cleanup function
|
||||
declare -a tmp_files
|
||||
|
||||
|
||||
cleanup () {
|
||||
[[ ${#tmp_files} -gt 0 ]] && rm -f "${tmp_files[@]}"
|
||||
exit
|
||||
}
|
||||
trap 'cleanup' EXIT HUP TERM INT
|
||||
|
||||
|
||||
while (( $# != 0 )); do #TODO: filter out less opts
|
||||
tmp_file="$(mktemp -t "tmp.colorize.XXXX.$(sed 's/\//./g' <<< "$1")")"
|
||||
tmp_files+=("$tmp_file")
|
||||
|
|
|
|||
51
plugins/dnote/README.md
Normal file
51
plugins/dnote/README.md
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
# Dnote Plugin
|
||||
|
||||
This plugin adds auto-completion for [Dnote](https://dnote.io) project.
|
||||
|
||||
To use it, add `dnote` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(dnote)
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
At the basic level, this plugin completes all Dnote commands.
|
||||
|
||||
```zsh
|
||||
$ dnote a(press <TAB> here)
|
||||
```
|
||||
|
||||
would result in:
|
||||
|
||||
```zsh
|
||||
$ dnote add
|
||||
```
|
||||
|
||||
For some commands, this plugin dynamically suggests matching book names.
|
||||
|
||||
For instance, if you have three books that begin with 'j': 'javascript', 'job', 'js',
|
||||
|
||||
```zsh
|
||||
$ dnote view j(press <TAB> here)
|
||||
```
|
||||
|
||||
would result in:
|
||||
|
||||
```zsh
|
||||
$ dnote v j
|
||||
javascript job js
|
||||
```
|
||||
|
||||
As another example,
|
||||
|
||||
```zsh
|
||||
$ dnote edit ja(press <TAB> here)
|
||||
```
|
||||
|
||||
would result in:
|
||||
|
||||
|
||||
```zsh
|
||||
$ dnote v javascript
|
||||
``````
|
||||
39
plugins/dnote/_dnote
Normal file
39
plugins/dnote/_dnote
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#compdef dnote
|
||||
|
||||
local -a _1st_arguments
|
||||
|
||||
_1st_arguments=(
|
||||
'add:add a new note'
|
||||
'view:list books, notes, or view a content'
|
||||
'edit:edit a note or a book'
|
||||
'remove:remove a note or a book'
|
||||
'find:find notes by keywords'
|
||||
'sync:sync data with the server'
|
||||
'login:login to the dnote server'
|
||||
'logout:logout from the dnote server'
|
||||
'version:print the current version'
|
||||
'help:get help about any command'
|
||||
)
|
||||
|
||||
get_booknames() {
|
||||
local names=$(dnote view --name-only)
|
||||
local -a ret
|
||||
|
||||
while read -r line; do
|
||||
ret+=("${line}")
|
||||
done <<< "$names"
|
||||
|
||||
echo "$ret"
|
||||
}
|
||||
|
||||
if (( CURRENT == 2 )); then
|
||||
_describe -t commands "dnote subcommand" _1st_arguments
|
||||
return
|
||||
elif (( CURRENT == 3 )); then
|
||||
case "$words[2]" in
|
||||
v|view|a|add)
|
||||
_alternative \
|
||||
"names:book names:($(get_booknames))"
|
||||
esac
|
||||
fi
|
||||
|
||||
7
plugins/gatsby/README.md
Normal file
7
plugins/gatsby/README.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# gatsby autocomplete plugin
|
||||
|
||||
* Adds autocomplete options for all gatsby commands.
|
||||
|
||||
## Requirements
|
||||
|
||||
In order to make this work, you will need to have gatsby set up in your path.
|
||||
24
plugins/gatsby/_gatsby
Normal file
24
plugins/gatsby/_gatsby
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#compdef gatsby
|
||||
#autoload
|
||||
|
||||
# in order to make this work, you will need to have gatsby
|
||||
# https://www.gatsbyjs.org/
|
||||
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
'develop:Start development server. Watches files, rebuilds, and hot reloads if something changes'
|
||||
'build:Build a Gatsby project.'
|
||||
'serve:Serve previously built Gatsby site.'
|
||||
'info:Get environment information for debugging and issue reporting'
|
||||
'clean:Wipe the local gatsby environment including built assets and cache'
|
||||
'repl:Get a node repl with context of Gatsby environment, see (add docs link here)'
|
||||
'new: [rootPath] [starter] Create new Gatsby project.'
|
||||
'telemetry:Enable or disable Gatsby anonymous analytics collection.'
|
||||
)
|
||||
|
||||
_arguments -C '*:: :->subcmds' && return 0
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "gatsby subcommand" _1st_arguments
|
||||
return
|
||||
fi
|
||||
|
|
@ -199,6 +199,7 @@ alias grbd='git rebase develop'
|
|||
alias grbi='git rebase -i'
|
||||
alias grbm='git rebase master'
|
||||
alias grbs='git rebase --skip'
|
||||
alias grev='git revert'
|
||||
alias grh='git reset'
|
||||
alias grhh='git reset --hard'
|
||||
alias groh='git reset origin/$(git_current_branch) --hard'
|
||||
|
|
|
|||
|
|
@ -90,3 +90,18 @@ plugins=(... kubectl)
|
|||
| keno | `kubectl edit node` | Edit nodes resource from the default editor |
|
||||
| kdno | `kubectl describe node` | Describe node resource in detail |
|
||||
| kdelno | `kubectl delete node` | Delete the node |
|
||||
| | | **Persistent Volume Claim management** |
|
||||
| kgpvc | `kubectl get pvc` | List all PVCs |
|
||||
| kgpvcw | `kgpvc --watch` | After listing/getting the requested object, watch for changes |
|
||||
| kepvc | `kubectl edit pvc` | Edit pvcs from the default editor |
|
||||
| kdpvc | `kubectl describe pvc` | Descirbe all pvcs |
|
||||
| kdelpvc | `kubectl delete pvc` | Delete all pvcs matching passed arguments |
|
||||
| | | |
|
||||
| kgss | `kubectl get statefulset` | List the statefulsets in ps format |
|
||||
| kgssw | `kgss --watch` | After getting the list of statefulsets, watch for changes |
|
||||
| kgsswide| `kgss -o wide` | After getting the statefulsets, output in plain-text format with any additional information |
|
||||
| kess | `kubectl edit statefulset` | Edit statefulset resource from the default editor |
|
||||
| kdss | `kubectl describe statefulset` | Describe statefulset resource in detail |
|
||||
| kdelss | `kubectl delete statefulset` | Delete the statefulset |
|
||||
| ksss | `kubectl scale statefulset` | Scale a statefulset |
|
||||
| krsss | `kubectl rollout status statefulset`| Check the rollout status of a deployment |
|
||||
|
|
|
|||
|
|
@ -96,6 +96,16 @@ alias kgrs='kubectl get rs'
|
|||
alias krh='kubectl rollout history'
|
||||
alias kru='kubectl rollout undo'
|
||||
|
||||
# Statefulset management.
|
||||
alias kgss='kubectl get statefulset'
|
||||
alias kgssw='kgss --watch'
|
||||
alias kgsswide='kgss -o wide'
|
||||
alias kess='kubectl edit statefulset'
|
||||
alias kdss='kubectl describe statefulset'
|
||||
alias kdelss='kubectl delete statefulset'
|
||||
alias ksss='kubectl scale statefulset'
|
||||
alias krsss='kubectl rollout status statefulset'
|
||||
|
||||
# Port forwarding
|
||||
alias kpf="kubectl port-forward"
|
||||
|
||||
|
|
@ -115,3 +125,11 @@ alias kgno='kubectl get nodes'
|
|||
alias keno='kubectl edit node'
|
||||
alias kdno='kubectl describe node'
|
||||
alias kdelno='kubectl delete node'
|
||||
|
||||
# PVC management.
|
||||
alias kgpvc='kubectl get pvc'
|
||||
alias kgpvcw='kgpvc --watch'
|
||||
alias kepvc='kubectl edit pvc'
|
||||
alias kdpvc='kubectl describe pvc'
|
||||
alias kdelpvc='kubectl delete pvc'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
PROMPT=$'
|
||||
%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%I:%M:%S]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\
|
||||
%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%H:%M:%S]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\
|
||||
%{$fg[blue]%}->%{$fg_bold[blue]%} %#%{$reset_color%} '
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}["
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue