mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-19 02:02:32 +01:00
Merge branch 'master' into docker-patch-1
This commit is contained in:
commit
4579956901
372 changed files with 8440 additions and 6115 deletions
|
|
@ -1,9 +1,15 @@
|
|||
# Do nothing if op is not installed
|
||||
(( ${+commands[op]} )) || return
|
||||
|
||||
# Load op completion
|
||||
eval "$(op completion zsh)"
|
||||
compdef _op op
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `op`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_op" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _op
|
||||
_comps[op]=_op
|
||||
fi
|
||||
|
||||
op completion zsh >| "$ZSH_CACHE_DIR/completions/_op" &|
|
||||
|
||||
# Load opswd function
|
||||
autoload -Uz opswd
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ function opswd() {
|
|||
|
||||
local password
|
||||
# Copy the password to the clipboard
|
||||
if ! password=$(op item get "$service" --fields password 2>/dev/null); then
|
||||
if ! password=$(op item get "$service" --reveal --fields password 2>/dev/null); then
|
||||
echo "error: could not obtain password for $service"
|
||||
return 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
# adb autocomplete plugin
|
||||
|
||||
* Adds autocomplete options for all adb commands.
|
||||
* Add autocomplete for `adb -s`
|
||||
|
||||
## Requirements
|
||||
|
||||
In order to make this work, you will need to have the Android adb tools set up in your path.
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
#compdef adb
|
||||
#autoload
|
||||
|
||||
# in order to make this work, you will need to have the android adb tools
|
||||
|
||||
# adb zsh completion, based on homebrew completion
|
||||
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
'bugreport:return all information from the device that should be included in a bug report.'
|
||||
'connect:connect to a device via TCP/IP Port 5555 is default.'
|
||||
'devices:list all connected devices'
|
||||
'disconnect:disconnect from a TCP/IP device. Port 5555 is default.'
|
||||
'emu:run emulator console command'
|
||||
'forward:forward socket connections'
|
||||
'get-devpath:print the device path'
|
||||
'get-serialno:print the serial number of the device'
|
||||
'get-state:print the current state of the device: offline | bootloader | device'
|
||||
'help:show the help message'
|
||||
'install:push this package file to the device and install it'
|
||||
'jdwp:list PIDs of processes hosting a JDWP transport'
|
||||
'keygen:generate adb public/private key'
|
||||
'kill-server:kill the server if it is running'
|
||||
'logcat:view device log'
|
||||
'pull:copy file/dir from device'
|
||||
'push:copy file/dir to device'
|
||||
'reboot:reboots the device, optionally into the bootloader or recovery program'
|
||||
'reboot-bootloader:reboots the device into the bootloader'
|
||||
'remount:remounts the partitions on the device read-write'
|
||||
'root:restarts the adbd daemon with root permissions'
|
||||
'sideload:push a ZIP to device and install it'
|
||||
'shell:run remote shell interactively'
|
||||
'sync:copy host->device only if changed (-l means list but dont copy)'
|
||||
'start-server:ensure that there is a server running'
|
||||
'tcpip:restart host adb in tcpip mode'
|
||||
'uninstall:remove this app package from the device'
|
||||
'usb:restart the adbd daemon listing on USB'
|
||||
'version:show version num'
|
||||
'wait-for-device:block until device is online'
|
||||
)
|
||||
|
||||
local expl
|
||||
local -a pkgs installed_pkgs
|
||||
|
||||
_arguments \
|
||||
'-s[devices]:specify device:->specify_device' \
|
||||
'*:: :->subcmds' && return 0
|
||||
|
||||
case "$state" in
|
||||
specify_device)
|
||||
_values -C 'devices' ${$(adb devices -l|awk 'NR>1&& $1 \
|
||||
{sub(/ +/," ",$0); \
|
||||
gsub(":","\\:",$1); \
|
||||
for(i=1;i<=NF;i++) {
|
||||
if($i ~ /model:/) { split($i,m,":") } \
|
||||
else if($i ~ /product:/) { split($i,p,":") } } \
|
||||
printf "%s[%s(%s)] ",$1, p[2], m[2]}'):-""}
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "adb subcommand" _1st_arguments
|
||||
return
|
||||
fi
|
||||
|
||||
_files
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
# The Silver Searcher
|
||||
|
||||
This plugin provides completion support for [`ag`](https://github.com/ggreer/the_silver_searcher).
|
||||
|
||||
To use it, add ag to the plugins array in your zshrc file.
|
||||
|
||||
```zsh
|
||||
plugins=(... ag)
|
||||
```
|
||||
|
||||
## INSTALLATION NOTES
|
||||
|
||||
Besides oh-my-zsh, `ag` needs to be installed by following these steps: https://github.com/ggreer/the_silver_searcher#installing.
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
#compdef ag
|
||||
#autoload
|
||||
|
||||
typeset -A opt_args
|
||||
|
||||
# Took the liberty of not listing every option… specially aliases and -D
|
||||
_ag () {
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
'--ackmate:Print results in AckMate-parseable format'
|
||||
{'-A','--after'}':[LINES] Print lines after match (Default: 2)'
|
||||
{'-B','--before'}':[LINES] Print lines before match (Default: 2)'
|
||||
'--break:Print newlines between matches in different files'
|
||||
'--nobreak:Do not print newlines between matches in different files'
|
||||
{'-c','--count'}':Only print the number of matches in each file'
|
||||
'--color:Print color codes in results (Default: On)'
|
||||
'--nocolor:Do not print color codes in results'
|
||||
'--color-line-number:Color codes for line numbers (Default: 1;33)'
|
||||
'--color-match:Color codes for result match numbers (Default: 30;43)'
|
||||
'--color-path:Color codes for path names (Default: 1;32)'
|
||||
'--column:Print column numbers in results'
|
||||
{'-H','--heading'}':Print file names (On unless searching a single file)'
|
||||
'--noheading:Do not print file names (On unless searching a single file)'
|
||||
'--line-numbers:Print line numbers even for streams'
|
||||
{'-C','--context'}':[LINES] Print lines before and after matches (Default: 2)'
|
||||
'-g:[PATTERN] Print filenames matching PATTERN'
|
||||
{'-l','--files-with-matches'}':Only print filenames that contain matches'
|
||||
{'-L','--files-without-matches'}':Only print filenames that do not contain matches'
|
||||
'--no-numbers:Do not print line numbers'
|
||||
{'-o','--only-matching'}':Prints only the matching part of the lines'
|
||||
'--print-long-lines:Print matches on very long lines (Default: 2k characters)'
|
||||
'--passthrough:When searching a stream, print all lines even if they do not match'
|
||||
'--silent:Suppress all log messages, including errors'
|
||||
'--stats:Print stats (files scanned, time taken, etc.)'
|
||||
'--vimgrep:Print results like vim :vimgrep /pattern/g would'
|
||||
{'-0','--null'}':Separate filenames with null (for "xargs -0")'
|
||||
|
||||
{'-a','--all-types'}':Search all files (does not include hidden files / .gitignore)'
|
||||
'--depth:[NUM] Search up to NUM directories deep (Default: 25)'
|
||||
{'-f','--follow'}':Follow symlinks'
|
||||
{'-G','--file-search-regex'}':[PATTERN] Limit search to filenames matching PATTERN'
|
||||
'--hidden:Search hidden files (obeys .*ignore files)'
|
||||
{'-i','--ignore-case'}':Match case insensitively'
|
||||
'--ignore:[PATTERN] Ignore files/directories matching PATTERN'
|
||||
{'-m','--max-count'}':[NUM] Skip the rest of a file after NUM matches (Default: 10k)'
|
||||
{'-p','--path-to-agignore'}':[PATH] Use .agignore file at PATH'
|
||||
{'-Q','--literal'}':Do not parse PATTERN as a regular expression'
|
||||
{'-s','--case-sensitive'}':Match case'
|
||||
{'-S','--smart-case'}':Insensitive match unless PATTERN has uppercase (Default: On)'
|
||||
'--search-binary:Search binary files for matches'
|
||||
{'-t','--all-text'}':Search all text files (Hidden files not included)'
|
||||
{'-u','--unrestricted'}':Search all files (ignore .agignore and _all_)'
|
||||
{'-U','--skip-vcs-ignores'}':Ignore VCS files (stil obey .agignore)'
|
||||
{'-v','--invert-match'}':Invert match'
|
||||
{'-w','--word-regexp'}':Only match whole words'
|
||||
{'-z','--search-zip'}':Search contents of compressed (e.g., gzip) files'
|
||||
|
||||
'--list-file-types:list of supported file types'
|
||||
)
|
||||
|
||||
if [[ $words[-1] =~ "^-" ]]; then
|
||||
_describe -t commands "ag options" _1st_arguments && ret=0
|
||||
else
|
||||
_files && ret=0
|
||||
fi
|
||||
}
|
||||
9
plugins/alias-finder/.zunit.yml
Normal file
9
plugins/alias-finder/.zunit.yml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
tap: false
|
||||
directories:
|
||||
tests: tests
|
||||
output: tests/_output
|
||||
support: tests/_support
|
||||
time_limit: 0
|
||||
fail_fast: false
|
||||
allow_risky: false
|
||||
verbose: true
|
||||
|
|
@ -2,45 +2,67 @@
|
|||
|
||||
This plugin searches the defined aliases and outputs any that match the command inputted. This makes learning new aliases easier.
|
||||
|
||||
## Setup
|
||||
|
||||
To use it, add `alias-finder` to the `plugins` array of your zshrc file:
|
||||
```
|
||||
plugins=(... alias-finder)
|
||||
```
|
||||
|
||||
To enable it for every single command, set zstyle in your `~/.zshrc`.
|
||||
|
||||
```zsh
|
||||
# ~/.zshrc
|
||||
|
||||
zstyle ':omz:plugins:alias-finder' autoload yes # disabled by default
|
||||
zstyle ':omz:plugins:alias-finder' longer yes # disabled by default
|
||||
zstyle ':omz:plugins:alias-finder' exact yes # disabled by default
|
||||
zstyle ':omz:plugins:alias-finder' cheaper yes # disabled by default
|
||||
```
|
||||
|
||||
As you can see, options are also available with zstyle.
|
||||
|
||||
## Usage
|
||||
To see if there is an alias defined for the command, pass it as an argument to `alias-finder`. This can also run automatically before each command you input - add `ZSH_ALIAS_FINDER_AUTOMATIC=true` to your zshrc if you want this.
|
||||
|
||||
## Options
|
||||
When you execute a command alias finder will look at your defined aliases and suggest shorter aliases you could have used, for example:
|
||||
|
||||
- Use `--longer` or `-l` to allow the aliases to be longer than the input (match aliases if they contain the input).
|
||||
- Use `--exact` or `-e` to avoid matching aliases that are shorter than the input.
|
||||
Running the un-aliased `git status` command:
|
||||
```sh
|
||||
╭─tim@fox ~/repo/gitopolis ‹main›
|
||||
╰─$ git status
|
||||
|
||||
## Examples
|
||||
gst='git status' # <=== shorter suggestion from alias-finder
|
||||
|
||||
On branch main
|
||||
Your branch is up-to-date with 'origin/main'.
|
||||
nothing to commit, working tree clean
|
||||
```
|
||||
$ alias-finder "git pull"
|
||||
gl='git pull'
|
||||
g=git
|
||||
|
||||
Running a shorter `git st` alias from `.gitconfig` that it suggested :
|
||||
```sh
|
||||
╭─tim@fox ~/repo/gitopolis ‹main›
|
||||
╰─$ git st
|
||||
gs='git st' # <=== shorter suggestion from alias-finder
|
||||
## main...origin/main
|
||||
```
|
||||
|
||||
Running the shortest `gs` shell alias that it found:
|
||||
```sh
|
||||
╭─tim@fox ~/repo/gitopolis ‹main›
|
||||
╰─$ gs
|
||||
# <=== no suggestions alias-finder because this is the shortest
|
||||
## main...origin/main
|
||||
```
|
||||
$ alias-finder "web_search google oh my zsh"
|
||||
google='web_search google'
|
||||
```
|
||||
```
|
||||
$ alias-finder "git commit -v"
|
||||
gc="git commit -v"
|
||||
g=git
|
||||
```
|
||||
```
|
||||
$ alias-finder -e "git commit -v"
|
||||
gc='git commit -v'
|
||||
```
|
||||
```
|
||||
$ alias-finder -l "git commit -v"
|
||||
gc='git commit -v'
|
||||
'gc!'='git commit -v --amend'
|
||||
gca='git commit -v -a'
|
||||
'gca!'='git commit -v -a --amend'
|
||||
'gcan!'='git commit -v -a --no-edit --amend'
|
||||
'gcans!'='git commit -v -a -s --no-edit --amend'
|
||||
'gcn!'='git commit -v --no-edit --amend'
|
||||
```
|
||||
|
||||

|
||||
|
||||
|
||||
### Options
|
||||
|
||||
> In order to clarify, let's say `alias a=abc` has source 'abc' and destination 'a'.
|
||||
|
||||
- Use `--longer` or `-l` to include aliases where the source is longer than the input (in other words, the source could contain the whole input).
|
||||
- Use `--exact` or `-e` to avoid aliases where the source is shorter than the input (in other words, the source must be the same with the input).
|
||||
- Use `--cheaper` or `-c` to avoid aliases where the destination is longer than the input (in other words, the destination must be the shorter than the input).
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,44 +1,59 @@
|
|||
alias-finder() {
|
||||
local cmd="" exact="" longer="" wordStart="" wordEnd="" multiWordEnd=""
|
||||
for i in $@; do
|
||||
case $i in
|
||||
local cmd=" " exact="" longer="" cheaper="" wordEnd="'{0,1}$" finder="" filter=""
|
||||
|
||||
# build command and options
|
||||
for c in "$@"; do
|
||||
case $c in
|
||||
# TODO: Remove backward compatibility (other than zstyle form)
|
||||
# set options if exist
|
||||
-e|--exact) exact=true;;
|
||||
-l|--longer) longer=true;;
|
||||
*)
|
||||
if [[ -z $cmd ]]; then
|
||||
cmd=$i
|
||||
else
|
||||
cmd="$cmd $i"
|
||||
fi
|
||||
;;
|
||||
-c|--cheaper) cheaper=true;;
|
||||
# concatenate cmd
|
||||
*) cmd="$cmd$c " ;;
|
||||
esac
|
||||
done
|
||||
cmd=$(sed 's/[].\|$(){}?+*^[]/\\&/g' <<< $cmd) # adds escaping for grep
|
||||
if (( $(wc -l <<< $cmd) == 1 )); then
|
||||
while [[ $cmd != "" ]]; do
|
||||
if [[ $longer = true ]]; then
|
||||
wordStart="'{0,1}"
|
||||
else
|
||||
wordEnd="$"
|
||||
multiWordEnd="'$"
|
||||
fi
|
||||
if [[ $cmd == *" "* ]]; then
|
||||
local finder="'$cmd$multiWordEnd"
|
||||
else
|
||||
local finder=$wordStart$cmd$wordEnd
|
||||
fi
|
||||
alias | grep -E "=$finder"
|
||||
if [[ $exact = true || $longer = true ]]; then
|
||||
break
|
||||
else
|
||||
cmd=$(sed -E 's/ {0,1}[^ ]*$//' <<< $cmd) # removes last word
|
||||
fi
|
||||
done
|
||||
|
||||
zstyle -t ':omz:plugins:alias-finder' longer && longer=true
|
||||
zstyle -t ':omz:plugins:alias-finder' exact && exact=true
|
||||
zstyle -t ':omz:plugins:alias-finder' cheaper && cheaper=true
|
||||
|
||||
# format cmd for grep
|
||||
## - replace newlines with spaces
|
||||
## - trim both ends
|
||||
## - replace multiple spaces with one space
|
||||
## - add escaping character to special characters
|
||||
cmd=$(echo -n "$cmd" | tr '\n' ' ' | xargs | tr -s '[:space:]' | sed 's/[].\|$(){}?+*^[]/\\&/g')
|
||||
|
||||
if [[ $longer == true ]]; then
|
||||
wordEnd="" # remove wordEnd to find longer aliases
|
||||
fi
|
||||
|
||||
# find with alias and grep, removing last word each time until no more words
|
||||
while [[ $cmd != "" ]]; do
|
||||
finder="'{0,1}$cmd$wordEnd"
|
||||
|
||||
# make filter to find only shorter results than current cmd
|
||||
if [[ $cheaper == true ]]; then
|
||||
cmdLen=$(echo -n "$cmd" | wc -c)
|
||||
filter="^'{0,1}.{0,$((cmdLen - 1))}="
|
||||
fi
|
||||
|
||||
alias | grep -E "$filter" | grep -E "=$finder"
|
||||
|
||||
if [[ $exact == true ]]; then
|
||||
break # because exact case is only one
|
||||
elif [[ $longer = true ]]; then
|
||||
break # because above grep command already found every longer aliases during first cycle
|
||||
fi
|
||||
|
||||
cmd=$(sed -E 's/ {0,}[^ ]*$//' <<< "$cmd") # remove last word
|
||||
done
|
||||
}
|
||||
|
||||
preexec_alias-finder() {
|
||||
if [[ $ZSH_ALIAS_FINDER_AUTOMATIC = true ]]; then
|
||||
# TODO: Remove backward compatibility (other than zstyle form)
|
||||
zstyle -t ':omz:plugins:alias-finder' autoload && alias-finder $1 || if [[ $ZSH_ALIAS_FINDER_AUTOMATIC = true ]]; then
|
||||
alias-finder $1
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
0
plugins/alias-finder/tests/_output/.gitkeep
Normal file
0
plugins/alias-finder/tests/_output/.gitkeep
Normal file
0
plugins/alias-finder/tests/_support/.gitkeep
Normal file
0
plugins/alias-finder/tests/_support/.gitkeep
Normal file
2
plugins/alias-finder/tests/_support/bootstrap
Normal file
2
plugins/alias-finder/tests/_support/bootstrap
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env zsh
|
||||
# Write your bootstrap code here
|
||||
107
plugins/alias-finder/tests/test_run.sh
Normal file
107
plugins/alias-finder/tests/test_run.sh
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
#!/usr/bin/env zunit
|
||||
|
||||
@setup {
|
||||
load ../alias-finder.plugin.zsh
|
||||
|
||||
set_git_aliases() {
|
||||
unalias -a # all
|
||||
alias g="git"
|
||||
alias gc="git commit"
|
||||
alias gcv="git commit -v"
|
||||
alias gcvs="git commit -v -S"
|
||||
}
|
||||
}
|
||||
|
||||
@test 'find aliases that contain input' {
|
||||
set_git_aliases
|
||||
|
||||
run alias-finder "git"
|
||||
|
||||
assert "${#lines[@]}" equals 1
|
||||
assert "${lines[1]}" same_as "g=git"
|
||||
}
|
||||
|
||||
@test 'find aliases that contain input with whitespaces at ends' {
|
||||
set_git_aliases
|
||||
|
||||
run alias-finder " git "
|
||||
|
||||
assert "${#lines[@]}" equals 1
|
||||
assert "${lines[1]}" same_as "g=git"
|
||||
}
|
||||
|
||||
@test 'find aliases that contain multiple words' {
|
||||
set_git_aliases
|
||||
|
||||
run alias-finder "git commit -v"
|
||||
|
||||
assert "${#lines[@]}" equals 3
|
||||
assert "${lines[1]}" same_as "gcv='git commit -v'"
|
||||
assert "${lines[2]}" same_as "gc='git commit'"
|
||||
assert "${lines[3]}" same_as "g=git"
|
||||
}
|
||||
|
||||
@test 'find alias that is the same with input when --exact option is set' {
|
||||
set_git_aliases
|
||||
|
||||
run alias-finder -e "git"
|
||||
|
||||
assert "${#lines[@]}" equals 1
|
||||
assert "${lines[1]}" same_as "g=git"
|
||||
}
|
||||
|
||||
@test 'find alias that is the same with multiple words input when --exact option is set' {
|
||||
set_git_aliases
|
||||
|
||||
run alias-finder -e "git commit -v"
|
||||
|
||||
assert "${#lines[@]}" equals 1
|
||||
assert "${lines[1]}" same_as "gcv='git commit -v'"
|
||||
}
|
||||
|
||||
@test 'find alias that is the same with or longer than input when --longer option is set' {
|
||||
set_git_aliases
|
||||
|
||||
run alias-finder -l "git"
|
||||
|
||||
assert "${#lines[@]}" equals 4
|
||||
assert "${lines[1]}" same_as "g=git"
|
||||
assert "${lines[2]}" same_as "gc='git commit'"
|
||||
assert "${lines[3]}" same_as "gcv='git commit -v'"
|
||||
assert "${lines[4]}" same_as "gcvs='git commit -v -S'"
|
||||
}
|
||||
|
||||
@test 'find alias that is the same with or longer than multiple words input when --longer option is set' {
|
||||
set_git_aliases
|
||||
|
||||
run alias-finder -l "git commit -v"
|
||||
|
||||
assert "${#lines[@]}" equals 2
|
||||
assert "${lines[1]}" same_as "gcv='git commit -v'"
|
||||
assert "${lines[2]}" same_as "gcvs='git commit -v -S'"
|
||||
}
|
||||
|
||||
@test 'find aliases including expensive (longer) than input' {
|
||||
set_git_aliases
|
||||
alias expensiveCommands="git commit"
|
||||
|
||||
run alias-finder "git commit -v"
|
||||
|
||||
assert "${#lines[@]}" equals 4
|
||||
assert "${lines[1]}" same_as "gcv='git commit -v'"
|
||||
assert "${lines[2]}" same_as "expensiveCommands='git commit'"
|
||||
assert "${lines[3]}" same_as "gc='git commit'"
|
||||
assert "${lines[4]}" same_as "g=git"
|
||||
}
|
||||
|
||||
@test 'find aliases excluding expensive (longer) than input when --cheap option is set' {
|
||||
set_git_aliases
|
||||
alias expensiveCommands="git commit"
|
||||
|
||||
run alias-finder -c "git commit -v"
|
||||
|
||||
assert "${#lines[@]}" equals 3
|
||||
assert "${lines[1]}" same_as "gcv='git commit -v'"
|
||||
assert "${lines[2]}" same_as "gc='git commit'"
|
||||
assert "${lines[3]}" same_as "g=git"
|
||||
}
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
# Aliases cheatsheet
|
||||
|
||||
**Maintainer:** [@hqingyi](https://github.com/hqingyi)
|
||||
|
||||
With lots of 3rd-party amazing aliases installed, this plugin helps list the shortcuts
|
||||
that are currently available based on the plugins you have enabled.
|
||||
|
||||
|
|
@ -13,11 +11,13 @@ plugins=(aliases)
|
|||
|
||||
Requirements: Python needs to be installed.
|
||||
|
||||
**Maintainer:** [@hqingyi](https://github.com/hqingyi)
|
||||
|
||||
## Usage
|
||||
|
||||
- `als`: show all aliases by group
|
||||
|
||||
- `als -h/--help`: print help mesage
|
||||
- `als -h/--help`: print help message
|
||||
|
||||
- `als <keyword(s)>`: filter and highlight aliases by `<keyword>`
|
||||
|
||||
|
|
@ -25,4 +25,4 @@ Requirements: Python needs to be installed.
|
|||
|
||||
- `als --groups`: show only group names
|
||||
|
||||

|
||||

|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
# ansible plugin
|
||||
|
||||
## Introduction
|
||||
|
||||
The `ansible plugin` adds several aliases for useful [ansible](https://docs.ansible.com/ansible/latest/index.html) commands and [aliases](#aliases).
|
||||
|
||||
To use it, add `ansible` to the plugins array of your zshrc file:
|
||||
|
|
@ -21,7 +19,6 @@ plugins=(... ansible)
|
|||
| `acon` | command `ansible-console` |
|
||||
| `ainv` | command `ansible-inventory` |
|
||||
| `aplaybook` | command `ansible-playbook` |
|
||||
| `ainv` | command `ansible-inventory` |
|
||||
| `adoc` | command `ansible-doc` |
|
||||
| `agal` | command `ansible-galaxy` |
|
||||
| `apull` | command `ansible-pull` |
|
||||
|
|
@ -29,6 +26,6 @@ plugins=(... ansible)
|
|||
|
||||
## Maintainer
|
||||
|
||||
### [Deepankumar](https://github.com/deepan10)
|
||||
### [Deepankumar](https://github.com/deepan10)
|
||||
|
||||
[https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin](https://github.com/deepan10/oh-my-zsh/tree/features/ansible-plugin)
|
||||
|
|
|
|||
|
|
@ -179,8 +179,8 @@ fi
|
|||
# Check Arch Linux PGP Keyring before System Upgrade to prevent failure.
|
||||
function upgrade() {
|
||||
echo ":: Checking Arch Linux PGP Keyring..."
|
||||
local installedver="$(sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
||||
local currentver="$(sudo pacman -Si archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
||||
local installedver="$(LANG= sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
||||
local currentver="$(LANG= sudo pacman -Si archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
||||
if [ $installedver != $currentver ]; then
|
||||
echo " Arch Linux PGP Keyring is out of date."
|
||||
echo " Updating before full system upgrade."
|
||||
|
|
|
|||
9
plugins/arduino-cli/README.md
Normal file
9
plugins/arduino-cli/README.md
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# Arduino CLI plugin
|
||||
|
||||
This plugin adds completion for the [arduino-cli](https://github.com/arduino/arduino-cli) tool.
|
||||
|
||||
To use it, add `arduino-cli` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... arduino-cli)
|
||||
```
|
||||
14
plugins/arduino-cli/arduino-cli.plugin.zsh
Normal file
14
plugins/arduino-cli/arduino-cli.plugin.zsh
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
if (( ! $+commands[arduino-cli] )); then
|
||||
return
|
||||
fi
|
||||
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `arduino-cli`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_arduino-cli" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _arduino-cli
|
||||
_comps[arduino-cli]=_arduino-cli
|
||||
fi
|
||||
|
||||
# Generate and load arduino-cli completion
|
||||
arduino-cli completion zsh >! "$ZSH_CACHE_DIR/completions/_arduino-cli" &|
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
## asdf
|
||||
|
||||
**Maintainer:** [@RobLoach](https://github.com/RobLoach)
|
||||
|
||||
Adds integration with [asdf](https://github.com/asdf-vm/asdf), the extendable version manager, with support for Ruby, Node.js, Elixir, Erlang and more.
|
||||
|
||||
### Installation
|
||||
|
|
@ -28,3 +26,7 @@ asdf install nodejs latest
|
|||
asdf global nodejs latest
|
||||
asdf local nodejs latest
|
||||
```
|
||||
|
||||
### Maintainer
|
||||
|
||||
- [@RobLoach](https://github.com/RobLoach)
|
||||
|
|
|
|||
|
|
@ -2,26 +2,29 @@
|
|||
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
|
||||
ASDF_COMPLETIONS="$ASDF_DIR/completions"
|
||||
|
||||
# If not found, check for archlinux/AUR package (/opt/asdf-vm/)
|
||||
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/asdf.bash" ]] && [[ -f "/opt/asdf-vm/asdf.sh" ]]; then
|
||||
ASDF_DIR="/opt/asdf-vm"
|
||||
ASDF_COMPLETIONS="$ASDF_DIR"
|
||||
fi
|
||||
|
||||
# If not found, check for Homebrew package
|
||||
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/asdf.bash" ]] && (( $+commands[brew] )); then
|
||||
brew_prefix="$(brew --prefix asdf)"
|
||||
ASDF_DIR="${brew_prefix}/libexec"
|
||||
ASDF_COMPLETIONS="${brew_prefix}/etc/bash_completion.d"
|
||||
unset brew_prefix
|
||||
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/_asdf" ]]; then
|
||||
# If not found, check for archlinux/AUR package (/opt/asdf-vm/)
|
||||
if [[ -f "/opt/asdf-vm/asdf.sh" ]]; then
|
||||
ASDF_DIR="/opt/asdf-vm"
|
||||
ASDF_COMPLETIONS="$ASDF_DIR"
|
||||
# If not found, check for Homebrew package
|
||||
elif (( $+commands[brew] )); then
|
||||
_ASDF_PREFIX="$(brew --prefix asdf)"
|
||||
ASDF_DIR="${_ASDF_PREFIX}/libexec"
|
||||
ASDF_COMPLETIONS="${_ASDF_PREFIX}/share/zsh/site-functions"
|
||||
unset _ASDF_PREFIX
|
||||
else
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
# Load command
|
||||
if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
|
||||
. "$ASDF_DIR/asdf.sh"
|
||||
|
||||
source "$ASDF_DIR/asdf.sh"
|
||||
# Load completions
|
||||
if [[ -f "$ASDF_COMPLETIONS/asdf.bash" ]]; then
|
||||
. "$ASDF_COMPLETIONS/asdf.bash"
|
||||
if [[ -f "$ASDF_COMPLETIONS/_asdf" ]]; then
|
||||
fpath+=("$ASDF_COMPLETIONS")
|
||||
autoload -Uz _asdf
|
||||
compdef _asdf asdf # compdef is already loaded before loading plugins
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,18 +1,22 @@
|
|||
declare -a autojump_paths
|
||||
autojump_paths=(
|
||||
$HOME/.autojump/etc/profile.d/autojump.zsh # manual installation
|
||||
$HOME/.autojump/share/autojump/autojump.zsh # manual installation
|
||||
$HOME/.nix-profile/etc/profile.d/autojump.sh # NixOS installation
|
||||
/run/current-system/sw/share/autojump/autojump.zsh # NixOS installation
|
||||
/usr/share/autojump/autojump.zsh # Debian and Ubuntu package
|
||||
/etc/profile.d/autojump.zsh # manual installation
|
||||
/etc/profile.d/autojump.sh # Gentoo installation
|
||||
/usr/local/share/autojump/autojump.zsh # FreeBSD installation
|
||||
/usr/pkg/share/autojump/autojump.zsh # NetBSD installation
|
||||
/opt/local/etc/profile.d/autojump.sh # macOS with MacPorts
|
||||
/usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default)
|
||||
/opt/homebrew/etc/profile.d/autojump.sh # macOS with Homebrew (default on M1 macs)
|
||||
/etc/profiles/per-user/$USER/etc/profile.d/autojump.sh # macOS Nix, Home Manager and flakes
|
||||
$HOME/.autojump/etc/profile.d/autojump.zsh # manual installation
|
||||
$HOME/.autojump/share/autojump/autojump.zsh # manual installation
|
||||
$HOME/.nix-profile/etc/profile.d/autojump.sh # NixOS installation
|
||||
/run/current-system/sw/share/autojump/autojump.zsh # NixOS installation
|
||||
/etc/profiles/per-user/$USER/share/autojump/autojump.zsh # Home Manager, NixOS with user-scoped packages
|
||||
/usr/share/autojump/autojump.zsh # Debian and Ubuntu package
|
||||
$PREFIX/share/autojump/autojump.zsh # Termux package
|
||||
/etc/profile.d/autojump.zsh # manual installation
|
||||
/etc/profile.d/autojump.sh # Gentoo installation
|
||||
/usr/local/share/autojump/autojump.zsh # FreeBSD installation
|
||||
/usr/pkg/share/autojump/autojump.zsh # NetBSD installation
|
||||
/opt/local/etc/profile.d/autojump.sh # macOS with MacPorts
|
||||
/usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default)
|
||||
/opt/homebrew/etc/profile.d/autojump.sh # macOS with Homebrew (default on M1 macs)
|
||||
/opt/pkg/share/autojump/autojump.zsh # macOS with pkgsrc
|
||||
/etc/profiles/per-user/$USER/etc/profile.d/autojump.sh # macOS Nix, Home Manager and flakes
|
||||
/nix/var/nix/gcroots/current-system/sw/share/zsh/site-functions/autojump.zsh # macOS Nix, nix-darwin
|
||||
)
|
||||
|
||||
for file in $autojump_paths; do
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ plugins=(... aws)
|
|||
It also sets `$AWS_EB_PROFILE` to `<profile>` for the Elastic Beanstalk CLI. It sets `$AWS_PROFILE_REGION` for display in `aws_prompt_info`.
|
||||
Run `asp` without arguments to clear the profile.
|
||||
* `asp [<profile>] login`: If AWS SSO has been configured in your aws profile, it will run the `aws sso login` command following profile selection.
|
||||
* `asp [<profile>] login [<sso_session>]`: In addition to `asp [<profile>] login`, if SSO session has been configured in your aws profile, it will run the `aws sso login --sso-session <sso_session>` command following profile selection.
|
||||
* `asp [<profile>] logout`: If AWS SSO has been configured in your aws profile, it will run the `aws sso logout` command following profile selection.
|
||||
|
||||
* `asr [<region>]`: sets `$AWS_REGION` and `$AWS_DEFAULT_REGION` (legacy) to `<region>`.
|
||||
Run `asr` without arguments to clear the profile.
|
||||
|
|
@ -45,6 +47,11 @@ plugins=(... aws)
|
|||
Some themes might overwrite the value of RPROMPT instead of appending to it, so they'll need to be fixed to
|
||||
see the AWS profile/region prompt.
|
||||
|
||||
* Set `AWS_PROFILE_STATE_ENABLED=true` in your zshrc file if you want the aws profile to persist between shell sessions.
|
||||
This option might slow down your shell startup time.
|
||||
By default the state file path is `/tmp/.aws_current_profile`. This means that the state won't survive a reboot or otherwise GC.
|
||||
You can control the state file path using the `AWS_STATE_FILE` environment variable.
|
||||
|
||||
## Theme
|
||||
|
||||
The plugin creates an `aws_prompt_info` function that you can use in your theme, which displays
|
||||
|
|
|
|||
|
|
@ -6,10 +6,26 @@ function agr() {
|
|||
echo $AWS_REGION
|
||||
}
|
||||
|
||||
# Update state file if enabled
|
||||
function _aws_update_state() {
|
||||
if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
|
||||
test -d $(dirname ${AWS_STATE_FILE}) || exit 1
|
||||
echo "${AWS_PROFILE} ${AWS_REGION}" > "${AWS_STATE_FILE}"
|
||||
fi
|
||||
}
|
||||
|
||||
function _aws_clear_state() {
|
||||
if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
|
||||
test -d $(dirname ${AWS_STATE_FILE}) || exit 1
|
||||
echo -n > "${AWS_STATE_FILE}"
|
||||
fi
|
||||
}
|
||||
|
||||
# AWS profile selection
|
||||
function asp() {
|
||||
if [[ -z "$1" ]]; then
|
||||
unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_EB_PROFILE AWS_PROFILE_REGION
|
||||
_aws_clear_state
|
||||
echo AWS profile cleared.
|
||||
return
|
||||
fi
|
||||
|
|
@ -28,8 +44,16 @@ function asp() {
|
|||
|
||||
export AWS_PROFILE_REGION=$(aws configure get region)
|
||||
|
||||
_aws_update_state
|
||||
|
||||
if [[ "$2" == "login" ]]; then
|
||||
aws sso login
|
||||
if [[ -n "$3" ]]; then
|
||||
aws sso login --sso-session $3
|
||||
else
|
||||
aws sso login
|
||||
fi
|
||||
elif [[ "$2" == "logout" ]]; then
|
||||
aws sso logout
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -37,6 +61,7 @@ function asp() {
|
|||
function asr() {
|
||||
if [[ -z "$1" ]]; then
|
||||
unset AWS_DEFAULT_REGION AWS_REGION
|
||||
_aws_update_state
|
||||
echo AWS region cleared.
|
||||
return
|
||||
fi
|
||||
|
|
@ -50,6 +75,7 @@ function asr() {
|
|||
|
||||
export AWS_REGION=$1
|
||||
export AWS_DEFAULT_REGION=$1
|
||||
_aws_update_state
|
||||
}
|
||||
|
||||
# AWS profile switch
|
||||
|
|
@ -196,8 +222,17 @@ function aws_change_access_key() {
|
|||
}
|
||||
|
||||
function aws_regions() {
|
||||
local region
|
||||
if [[ $AWS_DEFAULT_REGION ]];then
|
||||
region="$AWS_DEFAULT_REGION"
|
||||
elif [[ $AWS_REGION ]];then
|
||||
region="$AWS_REGION"
|
||||
else
|
||||
region="us-west-1"
|
||||
fi
|
||||
|
||||
if [[ $AWS_DEFAULT_PROFILE || $AWS_PROFILE ]];then
|
||||
aws ec2 describe-regions |grep RegionName | awk -F ':' '{gsub(/"/, "", $2);gsub(/,/, "", $2);gsub(/ /, "", $2); print $2}'
|
||||
aws ec2 describe-regions --region $region |grep RegionName | awk -F ':' '{gsub(/"/, "", $2);gsub(/,/, "", $2);gsub(/ /, "", $2); print $2}'
|
||||
else
|
||||
echo "You must specify a AWS profile."
|
||||
fi
|
||||
|
|
@ -240,6 +275,22 @@ if [[ "$SHOW_AWS_PROMPT" != false && "$RPROMPT" != *'$(aws_prompt_info)'* ]]; th
|
|||
RPROMPT='$(aws_prompt_info)'"$RPROMPT"
|
||||
fi
|
||||
|
||||
if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
|
||||
AWS_STATE_FILE="${AWS_STATE_FILE:-/tmp/.aws_current_profile}"
|
||||
test -s "${AWS_STATE_FILE}" || return
|
||||
|
||||
aws_state=($(cat $AWS_STATE_FILE))
|
||||
|
||||
export AWS_DEFAULT_PROFILE="${aws_state[1]}"
|
||||
export AWS_PROFILE="$AWS_DEFAULT_PROFILE"
|
||||
export AWS_EB_PROFILE="$AWS_DEFAULT_PROFILE"
|
||||
|
||||
test -z "${aws_state[2]}" && AWS_REGION=$(aws configure get region)
|
||||
|
||||
export AWS_REGION=${AWS_REGION:-$aws_state[2]}
|
||||
export AWS_DEFAULT_REGION="$AWS_REGION"
|
||||
fi
|
||||
|
||||
# Load awscli completions
|
||||
|
||||
# AWS CLI v2 comes with its own autocompletion. Check if that is there, otherwise fall back
|
||||
|
|
|
|||
|
|
@ -12,6 +12,13 @@ Then, add the `battery_pct_prompt` function to your custom theme. For example:
|
|||
RPROMPT='$(battery_pct_prompt) ...'
|
||||
```
|
||||
|
||||
Also, you set the `BATTERY_CHARGING` variable to your favor.
|
||||
For example:
|
||||
|
||||
```zsh
|
||||
BATTERY_CHARGING="⚡️"
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
- On Linux, you must have the `acpi` or `acpitool` commands installed on your operating system.
|
||||
|
|
|
|||
|
|
@ -13,6 +13,10 @@
|
|||
# Author: Avneet Singh (kalsi-avneet) #
|
||||
# Modified to add support for Android #
|
||||
###########################################
|
||||
# Author: Not Pua (im-notpua) #
|
||||
# Modified to add support for OpenBSD #
|
||||
###########################################
|
||||
|
||||
|
||||
if [[ "$OSTYPE" = darwin* ]]; then
|
||||
function battery_is_charging() {
|
||||
|
|
@ -54,7 +58,7 @@ if [[ "$OSTYPE" = darwin* ]]; then
|
|||
fi
|
||||
echo "%{$fg[$color]%}[${battery_pct}%%]%{$reset_color%}"
|
||||
else
|
||||
echo "∞"
|
||||
echo "${BATTERY_CHARGING-⚡️}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -139,6 +143,46 @@ elif [[ "$OSTYPE" = linux-android ]] && (( ${+commands[termux-battery-status]} )
|
|||
echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}"
|
||||
fi
|
||||
}
|
||||
elif [[ "$OSTYPE" = openbsd* ]]; then
|
||||
function battery_is_charging() {
|
||||
[[ $(apm -b) -eq 3 ]]
|
||||
}
|
||||
function battery_pct() {
|
||||
apm -l
|
||||
}
|
||||
function battery_pct_remaining() {
|
||||
if ! battery_is_charging; then
|
||||
battery_pct
|
||||
else
|
||||
echo "External Power"
|
||||
fi
|
||||
}
|
||||
function battery_time_remaining() {
|
||||
local remaining_time
|
||||
remaining_time=$(apm -m)
|
||||
if [[ $remaining_time -ge 0 ]]; then
|
||||
((hour = $remaining_time / 60 ))
|
||||
((minute = $remaining_time % 60 ))
|
||||
printf %02d:%02d $hour $minute
|
||||
fi
|
||||
}
|
||||
function battery_pct_prompt() {
|
||||
local battery_pct color
|
||||
battery_pct=$(battery_pct_remaining)
|
||||
if battery_is_charging; then
|
||||
echo "∞"
|
||||
else
|
||||
if [[ $battery_pct -gt 50 ]]; then
|
||||
color='green'
|
||||
elif [[ $battery_pct -gt 20 ]]; then
|
||||
color='yellow'
|
||||
else
|
||||
color='red'
|
||||
fi
|
||||
echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}"
|
||||
fi
|
||||
}
|
||||
|
||||
elif [[ "$OSTYPE" = linux* ]]; then
|
||||
function battery_is_charging() {
|
||||
if (( $+commands[acpitool] )); then
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
# Bazel plugin
|
||||
|
||||
This plugin adds completion for [bazel](https://bazel.build), an open-source build and
|
||||
test tool that scalably supports multi-language and multi-platform projects.
|
||||
This plugin adds completion and aliases for [bazel](https://bazel.build), an open-source build and test tool that scalably supports multi-language and multi-platform projects.
|
||||
|
||||
To use it, add `bazel` to the plugins array in your zshrc file:
|
||||
|
||||
|
|
@ -12,3 +11,12 @@ plugins=(... bazel)
|
|||
The plugin has a copy of [the completion script from the git repository][1].
|
||||
|
||||
[1]: https://github.com/bazelbuild/bazel/blob/master/scripts/zsh_completion/_bazel
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
| ------- | -------------------------------------- | ------------------------------------------------------ |
|
||||
| bzb | `bazel build` | The `bazel build` command |
|
||||
| bzt | `bazel test` | The `bazel test` command |
|
||||
| bzr | `bazel run` | The `bazel run` command |
|
||||
| bzq | `bazel query` | The `bazel query` command |
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#compdef bazel
|
||||
#compdef bazel bazelisk
|
||||
|
||||
# Copyright 2015 The Bazel Authors. All rights reserved.
|
||||
#
|
||||
|
|
|
|||
5
plugins/bazel/bazel.plugin.zsh
Normal file
5
plugins/bazel/bazel.plugin.zsh
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Aliases for bazel
|
||||
alias bzb='bazel build'
|
||||
alias bzt='bazel test'
|
||||
alias bzr='bazel run'
|
||||
alias bzq='bazel query'
|
||||
|
|
@ -47,7 +47,7 @@ case $state in
|
|||
"random[Generate random intervals in a genome.]" \
|
||||
"reldist[Calculate the distribution of relative distances b/w two files.]" \
|
||||
"sample[Sample random records from file using reservoir sampling.]" \
|
||||
"shuffle[Randomly redistrubute intervals in a genome.]" \
|
||||
"shuffle[Randomly redistribute intervals in a genome.]" \
|
||||
"slop[Adjust the size of intervals.]" \
|
||||
"sort[Order the intervals in a file.]" \
|
||||
"subtract[Remove intervals based on overlaps b/w two files.]" \
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
# bgnotify zsh plugin
|
||||
|
||||
cross-platform background notifications for long running commands! Supports OSX and Ubuntu linux.
|
||||
cross-platform background notifications for long running commands! Supports OSX and Linux.
|
||||
|
||||
Standalone homepage: [t413/zsh-background-notify](https://github.com/t413/zsh-background-notify)
|
||||
|
||||
----------------------------------
|
||||
---
|
||||
|
||||
## How to use!
|
||||
## How to use
|
||||
|
||||
Just add bgnotify to your plugins list in your `.zshrc`
|
||||
|
||||
- On OS X you'll need [terminal-notifier](https://github.com/alloy/terminal-notifier)
|
||||
* `brew install terminal-notifier` (or `gem install terminal-notifier`)
|
||||
- On ubuntu you're already all set!
|
||||
- On windows you can use [notifu](https://www.paralint.com/projects/notifu/) or the Cygwin Ports libnotify package
|
||||
- On Linux, make sure you have `notify-send` or `kdialog` installed. If you're using Ubuntu you should already be all set!
|
||||
- On Windows you can use [notifu](https://www.paralint.com/projects/notifu/) or the Cygwin Ports libnotify package
|
||||
|
||||
|
||||
## Screenshots
|
||||
|
|
@ -35,20 +35,30 @@ Just add bgnotify to your plugins list in your `.zshrc`
|
|||
|
||||
One can configure a few things:
|
||||
|
||||
- `bgnotify_bell` enabled or disables the terminal bell (default true)
|
||||
- `bgnotify_threshold` sets the notification threshold time (default 6 seconds)
|
||||
- `function bgnotify_formatted` lets you change the notification
|
||||
- `function bgnotify_formatted` lets you change the notification. You can for instance customize the message and pass in an icon.
|
||||
- `bgnotify_extraargs` appends extra args to notifier (e.g. `-e` for notify-send to create a transient notification)
|
||||
|
||||
Use these by adding a function definition before the your call to source. Example:
|
||||
|
||||
~~~ sh
|
||||
```sh
|
||||
bgnotify_bell=false ## disable terminal bell
|
||||
bgnotify_threshold=4 ## set your own notification threshold
|
||||
|
||||
function bgnotify_formatted {
|
||||
## $1=exit_status, $2=command, $3=elapsed_time
|
||||
[ $1 -eq 0 ] && title="Holy Smokes Batman!" || title="Holy Graf Zeppelin!"
|
||||
bgnotify "$title -- after $3 s" "$2";
|
||||
|
||||
# Humanly readable elapsed time
|
||||
local elapsed="$(( $3 % 60 ))s"
|
||||
(( $3 < 60 )) || elapsed="$((( $3 % 3600) / 60 ))m $elapsed"
|
||||
(( $3 < 3600 )) || elapsed="$(( $3 / 3600 ))h $elapsed"
|
||||
|
||||
[ $1 -eq 0 ] && title="Holy Smokes Batman" || title="Holy Graf Zeppelin"
|
||||
[ $1 -eq 0 ] && icon="$HOME/icons/success.png" || icon="$HOME/icons/fail.png"
|
||||
bgnotify "$title - took ${elapsed}" "$2" "$icon"
|
||||
}
|
||||
|
||||
plugins=(git bgnotify) ## add to plugins list
|
||||
source $ZSH/oh-my-zsh.sh ## existing source call
|
||||
~~~
|
||||
```
|
||||
|
|
|
|||
|
|
@ -21,13 +21,12 @@ function bgnotify_end {
|
|||
local elapsed=$(( EPOCHSECONDS - bgnotify_timestamp ))
|
||||
|
||||
# check time elapsed
|
||||
[[ $bgnotify_timestamp -gt 0 ]] || return
|
||||
[[ $elapsed -ge $bgnotify_threshold ]] || return
|
||||
[[ $bgnotify_timestamp -gt 0 ]] || return 0
|
||||
[[ $elapsed -ge $bgnotify_threshold ]] || return 0
|
||||
|
||||
# check if Terminal app is not active
|
||||
[[ $(bgnotify_appid) != "$bgnotify_termid" ]] || return
|
||||
[[ $(bgnotify_appid) != "$bgnotify_termid" ]] || return 0
|
||||
|
||||
printf '\a' # beep sound
|
||||
bgnotify_formatted "$exit_status" "$bgnotify_lastcmd" "$elapsed"
|
||||
} always {
|
||||
bgnotify_timestamp=0
|
||||
|
|
@ -52,53 +51,89 @@ function bgnotify_formatted {
|
|||
(( $3 < 60 )) || elapsed="$((( $3 % 3600) / 60 ))m $elapsed"
|
||||
(( $3 < 3600 )) || elapsed="$(( $3 / 3600 ))h $elapsed"
|
||||
|
||||
if [[ $1 -eq 0 ]]; then
|
||||
bgnotify "#win (took $elapsed)" "$2"
|
||||
[[ $bgnotify_bell = true ]] && printf '\a' # beep sound
|
||||
if [[ $exit_status -eq 0 ]]; then
|
||||
bgnotify "#win (took $elapsed)" "$cmd"
|
||||
else
|
||||
bgnotify "#fail (took $elapsed)" "$2"
|
||||
bgnotify "#fail (took $elapsed)" "$cmd"
|
||||
fi
|
||||
}
|
||||
|
||||
# for macOS, output is "app ID, window ID" (com.googlecode.iterm2, 116)
|
||||
function bgnotify_appid {
|
||||
if (( ${+commands[osascript]} )); then
|
||||
osascript -e 'tell application (path to frontmost application as text) to get the {id, id of front window}' 2>/dev/null
|
||||
elif (( ${+commands[xprop]} )); then
|
||||
osascript -e "tell application id \"$(bgnotify_programid)\" to get the {id, frontmost, id of front window, visible of front window}" 2>/dev/null
|
||||
elif [[ -n $WAYLAND_DISPLAY ]] && (( ${+commands[swaymsg]} )); then # wayland+sway
|
||||
local app_id=$(bgnotify_find_sway_appid)
|
||||
[[ -n "$app_id" ]] && echo "$app_id" || echo $EPOCHSECONDS
|
||||
elif [[ -z $WAYLAND_DISPLAY ]] && [[ -n $DISPLAY ]] && (( ${+commands[xprop]} )); then
|
||||
xprop -root _NET_ACTIVE_WINDOW 2>/dev/null | cut -d' ' -f5
|
||||
else
|
||||
echo $EPOCHSECONDS
|
||||
fi
|
||||
}
|
||||
|
||||
function bgnotify {
|
||||
# $1: title, $2: message
|
||||
if (( ${+commands[terminal-notifier]} )); then # macOS
|
||||
local term_id="${bgnotify_termid%%,*}" # remove window id
|
||||
if [[ -z "$term_id" ]]; then
|
||||
case "$TERM_PROGRAM" in
|
||||
iTerm.app) term_id='com.googlecode.iterm2' ;;
|
||||
Apple_Terminal) term_id='com.apple.terminal' ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [[ -z "$term_id" ]]; then
|
||||
terminal-notifier -message "$2" -title "$1" &>/dev/null
|
||||
else
|
||||
terminal-notifier -message "$2" -title "$1" -activate "$term_id" -sender "$term_id" &>/dev/null
|
||||
fi
|
||||
function bgnotify_find_sway_appid {
|
||||
# output is "app_id,container_id", for example "Alacritty,1694"
|
||||
# see example swaymsg output: https://github.com/ohmyzsh/ohmyzsh/files/13463939/output.json
|
||||
if (( ${+commands[jq]} )); then
|
||||
swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true) | {app_id, id} | join(",")'
|
||||
else
|
||||
swaymsg -t get_tree | awk '
|
||||
BEGIN { Id = ""; Appid = ""; FocusNesting = -1; Nesting = 0 }
|
||||
{
|
||||
# Enter a block
|
||||
if ($0 ~ /.*{$/) Nesting++
|
||||
|
||||
# Exit a block. If Nesting is now less than FocusNesting, we have the data we are looking for
|
||||
if ($0 ~ /^[[:blank:]]*}.*/) { Nesting--; if (FocusNesting > 0 && Nesting < FocusNesting) exit 0 }
|
||||
|
||||
# Save the Id, it is potentially what we are looking for
|
||||
if ($0 ~ /^[[:blank:]]*"id": [0-9]*,?$/) { sub(/^[[:blank:]]*"id": /, ""); sub(/,$/, ""); Id = $0 }
|
||||
|
||||
# Save the Appid, it is potentially what we are looking for
|
||||
if ($0 ~ /^[[:blank:]]*"app_id": ".*",?$/) { sub(/^[[:blank:]]*"app_id": "/, ""); sub(/",$/, ""); Appid = $0 }
|
||||
|
||||
# Window is focused, this nesting block contains the Id and Appid we want!
|
||||
if ($0 ~ /^[[:blank:]]*"focused": true,?$/) { FocusNesting = Nesting }
|
||||
}
|
||||
END {
|
||||
if (Appid != "" && Id != "" && FocusNesting != -1) print Appid "," Id
|
||||
else print ""
|
||||
}'
|
||||
fi
|
||||
}
|
||||
|
||||
function bgnotify_programid {
|
||||
case "$TERM_PROGRAM" in
|
||||
iTerm.app) echo 'com.googlecode.iterm2' ;;
|
||||
Apple_Terminal) echo 'com.apple.terminal' ;;
|
||||
esac
|
||||
}
|
||||
|
||||
function bgnotify {
|
||||
local title="$1"
|
||||
local message="$2"
|
||||
local icon="$3"
|
||||
if (( ${+commands[terminal-notifier]} )); then # macOS
|
||||
local term_id=$(bgnotify_programid)
|
||||
terminal-notifier -message "$message" -title "$title" ${=icon:+-appIcon "$icon"} ${=term_id:+-activate "$term_id"} ${=bgnotify_extraargs:-} &>/dev/null
|
||||
elif (( ${+commands[growlnotify]} )); then # macOS growl
|
||||
growlnotify -m "$1" "$2"
|
||||
elif (( ${+commands[notify-send]} )); then # GNOME
|
||||
notify-send "$1" "$2"
|
||||
growlnotify -m "$title" "$message" ${=bgnotify_extraargs:-}
|
||||
elif (( ${+commands[notify-send]} )); then
|
||||
notify-send "$title" "$message" ${=icon:+--icon "$icon"} ${=bgnotify_extraargs:-}
|
||||
elif (( ${+commands[kdialog]} )); then # KDE
|
||||
kdialog --title "$1" --passivepopup "$2" 5
|
||||
kdialog --title "$title" --passivepopup "$message" 5 ${=bgnotify_extraargs:-}
|
||||
elif (( ${+commands[notifu]} )); then # cygwin
|
||||
notifu /m "$2" /p "$1"
|
||||
notifu /m "$message" /p "$title" ${=icon:+/i "$icon"} ${=bgnotify_extraargs:-}
|
||||
fi
|
||||
}
|
||||
|
||||
## Defaults
|
||||
|
||||
# enable terminal bell on notify by default
|
||||
bgnotify_bell=${bgnotify_bell:-true}
|
||||
|
||||
# notify if command took longer than 5s by default
|
||||
bgnotify_threshold=${bgnotify_threshold:-5}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ index 2fd5f2cd..9d89a464 100644
|
|||
PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
|
||||
-PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
|
||||
+PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(branch_prompt_info)'
|
||||
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
||||
```
|
||||
|
|
|
|||
|
|
@ -10,32 +10,53 @@ plugins=(... brew)
|
|||
|
||||
## Shellenv
|
||||
|
||||
If `brew` is not found in the PATH, this plugin will attempt to find it in common
|
||||
locations, and execute `brew shellenv` to set the environment appropriately.
|
||||
This plugin will also export `HOMEBREW_PREFIX="$(brew --prefix)"` if not previously
|
||||
defined for convenience.
|
||||
If `brew` is not found in the PATH, this plugin will attempt to find it in common locations, and execute
|
||||
`brew shellenv` to set the environment appropriately. This plugin will also export
|
||||
`HOMEBREW_PREFIX="$(brew --prefix)"` if not previously defined for convenience.
|
||||
|
||||
In case you installed `brew` in a non-common location, you can still set `BREW_LOCATION` variable pointing to
|
||||
the `brew` binary before sourcing `oh-my-zsh.sh` and it'll set up the environment.
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
| -------- | --------------------------------------- | ------------------------------------------------------------------- |
|
||||
| `bcubc` | `brew upgrade --cask && brew cleanup` | Update outdated casks, then run cleanup. |
|
||||
| `bcubo` | `brew update && brew outdated --cask` | Update Homebrew data, then list outdated casks. |
|
||||
| `brewp` | `brew pin` | Pin a specified formula so that it's not upgraded. |
|
||||
| `brews` | `brew list -1` | List installed formulae or the installed files for a given formula. |
|
||||
| `brewsp` | `brew list --pinned` | List pinned formulae, or show the version of a given formula. |
|
||||
| `bubc` | `brew upgrade && brew cleanup` | Upgrade outdated formulae and casks, then run cleanup. |
|
||||
| `bugbc` | `brew upgrade --greedy && brew cleanup` | Upgrade outdated formulae and casks (greedy), then run cleanup. |
|
||||
| `bubo` | `brew update && brew outdated` | Update Homebrew data, then list outdated formulae and casks. |
|
||||
| `bubu` | `bubo && bubc` | Do the last two operations above. |
|
||||
| `bfu` | `brew upgrade --formula` | Upgrade only formulas (not casks). |
|
||||
| `buz` | `brew uninstall --zap` | Remove all files associated with a cask. |
|
||||
| Alias | Command | Description |
|
||||
| -------- | --------------------------------------- | --------------------------------------------------------------------- |
|
||||
| `ba` | `brew autoremove` | Uninstall unnecessary formulae. |
|
||||
| `bci` | `brew info --cask` | Display information about the given cask. |
|
||||
| `bcin` | `brew install --cask` | Install the given cask. |
|
||||
| `bcl` | `brew list --cask` | List installed casks. |
|
||||
| `bcn` | `brew cleanup` | Run cleanup. |
|
||||
| `bco` | `brew outdated --cask` | Report all outdated casks. |
|
||||
| `bcrin` | `brew reinstall --cask` | Reinstall the given cask. |
|
||||
| `bcubc` | `brew upgrade --cask && brew cleanup` | Upgrade outdated casks, then run cleanup. |
|
||||
| `bcubo` | `brew update && brew outdated --cask` | Update Homebrew data, then list outdated casks. |
|
||||
| `bcup` | `brew upgrade --cask` | Upgrade all outdated casks. |
|
||||
| `bfu` | `brew upgrade --formula` | Upgrade only formulae (not casks). |
|
||||
| `bi` | `brew install` | Install a formula. |
|
||||
| `bl` | `brew list` | List all installed formulae. |
|
||||
| `bo` | `brew outdated` | List installed formulae that have an updated version available. |
|
||||
| `brewp` | `brew pin` | Pin a specified formula so that it's not upgraded. |
|
||||
| `brews` | `brew list -1` | List installed formulae or the installed files for a given formula. |
|
||||
| `brewsp` | `brew list --pinned` | List pinned formulae, or show the version of a given formula. |
|
||||
| `bsl` | `brew services list` | List all running services. |
|
||||
| `bsoff` | `brew services stop` | Stop the service and unregister it from launching at login (or boot). |
|
||||
| `bsoffa` | `bsoff --all` | Stop all started services. |
|
||||
| `bson` | `brew services start` | Start the service and register it to launch at login (or boot). |
|
||||
| `bsona` | `bson --all` | Start all stopped services. |
|
||||
| `bsr` | `brew services run` | Run the service without registering to launch at login (or boot). |
|
||||
| `bsra` | `bsr --all` | Run all stopped services. |
|
||||
| `bu` | `brew update` | Update brew and all installed formulae. |
|
||||
| `bubo` | `brew update && brew outdated` | Update Homebrew data, then list outdated formulae and casks. |
|
||||
| `bubu` | `bubo && bup` | Do the last two operations above. |
|
||||
| `bugbc` | `brew upgrade --greedy && brew cleanup` | Upgrade outdated formulae and casks (greedy), then run cleanup. |
|
||||
| `bup` | `brew upgrade` | Upgrade outdated, unpinned brews. |
|
||||
| `buz` | `brew uninstall --zap` | Remove all files associated with a cask. |
|
||||
|
||||
## Completion
|
||||
|
||||
This plugin configures paths with Homebrew's completion functions automatically, so you don't need to do it manually. See: https://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh.
|
||||
This plugin configures paths with Homebrew's completion functions automatically, so you don't need to do it
|
||||
manually. See: https://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh.
|
||||
|
||||
With the release of Homebrew 1.0, they decided to bundle the zsh completion as part of the
|
||||
brew installation, so we no longer ship it with the brew plugin; now it only has brew
|
||||
aliases. If you find that brew completion no longer works, make sure you have your Homebrew
|
||||
installation fully up to date.
|
||||
With the release of Homebrew 1.0, they decided to bundle the zsh completion as part of the brew installation,
|
||||
so we no longer ship it with the brew plugin; now it only has brew aliases. If you find that brew completion
|
||||
no longer works, make sure you have your Homebrew installation fully up to date.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
if (( ! $+commands[brew] )); then
|
||||
if [[ -x /opt/homebrew/bin/brew ]]; then
|
||||
if [[ -n "$BREW_LOCATION" ]]; then
|
||||
if [[ ! -x "$BREW_LOCATION" ]]; then
|
||||
echo "[oh-my-zsh] $BREW_LOCATION is not executable"
|
||||
return
|
||||
fi
|
||||
elif [[ -x /opt/homebrew/bin/brew ]]; then
|
||||
BREW_LOCATION="/opt/homebrew/bin/brew"
|
||||
elif [[ -x /usr/local/bin/brew ]]; then
|
||||
BREW_LOCATION="/usr/local/bin/brew"
|
||||
|
|
@ -19,7 +24,7 @@ if (( ! $+commands[brew] )); then
|
|||
fi
|
||||
|
||||
if [[ -z "$HOMEBREW_PREFIX" ]]; then
|
||||
# Maintain compatability with potential custom user profiles, where we had
|
||||
# Maintain compatibility with potential custom user profiles, where we had
|
||||
# previously relied on always sourcing shellenv. OMZ plugins should not rely
|
||||
# on this to be defined due to out of order processing.
|
||||
export HOMEBREW_PREFIX="$(brew --prefix)"
|
||||
|
|
@ -29,17 +34,35 @@ if [[ -d "$HOMEBREW_PREFIX/share/zsh/site-functions" ]]; then
|
|||
fpath+=("$HOMEBREW_PREFIX/share/zsh/site-functions")
|
||||
fi
|
||||
|
||||
alias ba='brew autoremove'
|
||||
alias bci='brew info --cask'
|
||||
alias bcin='brew install --cask'
|
||||
alias bcl='brew list --cask'
|
||||
alias bcn='brew cleanup'
|
||||
alias bco='brew outdated --cask'
|
||||
alias bcrin='brew reinstall --cask'
|
||||
alias bcubc='brew upgrade --cask && brew cleanup'
|
||||
alias bcubo='brew update && brew outdated --cask'
|
||||
alias bcubc='brew upgrade --cask && brew cleanup'
|
||||
alias bcup='brew upgrade --cask'
|
||||
alias bfu='brew upgrade --formula'
|
||||
alias bi='brew install'
|
||||
alias bl='brew list'
|
||||
alias bo='brew outdated'
|
||||
alias brewp='brew pin'
|
||||
alias brewsp='brew list --pinned'
|
||||
alias bubc='brew upgrade && brew cleanup'
|
||||
alias bugbc='brew upgrade --greedy && brew cleanup'
|
||||
alias bsl='brew services list'
|
||||
alias bsoff='brew services stop'
|
||||
alias bsoffa='bsoff --all'
|
||||
alias bson='brew services start'
|
||||
alias bsona='bson --all'
|
||||
alias bsr='brew services run'
|
||||
alias bsra='bsr --all'
|
||||
alias bu='brew update'
|
||||
alias bubo='brew update && brew outdated'
|
||||
alias bubu='bubo && bubc'
|
||||
alias bubu='bubo && bup'
|
||||
alias bubug='bubo && bugbc'
|
||||
alias bfu='brew upgrade --formula'
|
||||
alias bugbc='brew upgrade --greedy && brew cleanup'
|
||||
alias bup='brew upgrade'
|
||||
alias buz='brew uninstall --zap'
|
||||
|
||||
function brews() {
|
||||
|
|
|
|||
9
plugins/buf/README.md
Normal file
9
plugins/buf/README.md
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# Buf plugin
|
||||
|
||||
This plugin adds completion for [Buf CLI](https://github.com/bufbuild/buf), a tool working with Protocol Buffers.
|
||||
|
||||
To use it, add `buf` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... buf)
|
||||
```
|
||||
14
plugins/buf/buf.plugin.zsh
Normal file
14
plugins/buf/buf.plugin.zsh
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# Autocompletion for the Buf CLI (buf).
|
||||
if (( !$+commands[buf] )); then
|
||||
return
|
||||
fi
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `buf`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_buf" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _buf
|
||||
_comps[buf]=_buf
|
||||
fi
|
||||
|
||||
# Generate and load buf completion
|
||||
buf completion zsh >! "$ZSH_CACHE_DIR/completions/_buf" &|
|
||||
20
plugins/bun/README.md
Normal file
20
plugins/bun/README.md
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# Bun Plugin
|
||||
|
||||
This plugin sets up completion for [Bun](https://bun.sh).
|
||||
|
||||
To use it, add `bun` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... bun)
|
||||
```
|
||||
|
||||
This plugin does not add any aliases.
|
||||
|
||||
## Cache
|
||||
|
||||
This plugin caches the completion script and is automatically updated when the
|
||||
plugin is loaded, which is usually when you start up a new terminal emulator.
|
||||
|
||||
The cache is stored at:
|
||||
|
||||
- `$ZSH_CACHE_DIR/completions/_bun_` completions script
|
||||
14
plugins/bun/bun.plugin.zsh
Normal file
14
plugins/bun/bun.plugin.zsh
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# If Bun is not found, don't do the rest of the script
|
||||
if (( ! $+commands[bun] )); then
|
||||
return
|
||||
fi
|
||||
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `bun`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_bun" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _bun
|
||||
_comps[bun]=_bun
|
||||
fi
|
||||
|
||||
SHELL=zsh bun completions >| "$ZSH_CACHE_DIR/completions/_bun" &|
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#compdef bundle
|
||||
#compdef bundle bundler
|
||||
|
||||
local curcontext="$curcontext" state line _gems _opts ret=1
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# catimg
|
||||
|
||||
Plugin for displaying images on the terminal using the the `catimg.sh` script provided by [posva](https://github.com/posva/catimg)
|
||||
Plugin for displaying images on the terminal using the `catimg.sh` script provided by
|
||||
[posva](https://github.com/posva/catimg)
|
||||
|
||||
To use it, add `catimg` to the plugins array in your zshrc file:
|
||||
|
||||
|
|
@ -10,7 +11,7 @@ plugins=(... catimg)
|
|||
|
||||
## Requirements
|
||||
|
||||
- `convert` (ImageMagick)
|
||||
- `magick convert` (ImageMagick)
|
||||
|
||||
## Functions
|
||||
|
||||
|
|
|
|||
|
|
@ -9,9 +9,11 @@
|
|||
|
||||
|
||||
function catimg() {
|
||||
if [[ -x `which convert` ]]; then
|
||||
zsh $ZSH/plugins/catimg/catimg.sh $@
|
||||
if (( $+commands[magick] )); then
|
||||
CONVERT_CMD="magick" zsh $ZSH/plugins/catimg/catimg.sh $@
|
||||
elif (( $+commands[convert] )); then
|
||||
CONVERT_CMD="convert" zsh $ZSH/plugins/catimg/catimg.sh $@
|
||||
else
|
||||
echo "catimg need convert (ImageMagick) to work)"
|
||||
echo "catimg need magick/convert (ImageMagick) to work)"
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@
|
|||
# GitHub: https://github.com/posva/catimg #
|
||||
################################################################################
|
||||
|
||||
# this should come from outside, either `magick` or `convert`
|
||||
# from imagemagick v7 and ahead `convert` is deprecated
|
||||
: ${CONVERT_CMD:=convert}
|
||||
|
||||
function help() {
|
||||
echo "Usage catimg [-h] [-w width] [-c char] img"
|
||||
echo "By default char is \" \" and w is the terminal width"
|
||||
|
|
@ -43,23 +47,23 @@ if [ ! "$WIDTH" ]; then
|
|||
else
|
||||
COLS=$(expr $WIDTH "/" $(echo -n "$CHAR" | wc -c))
|
||||
fi
|
||||
WIDTH=$(convert "$IMG" -print "%w\n" /dev/null)
|
||||
WIDTH=$($CONVERT_CMD "$IMG" -print "%w\n" /dev/null)
|
||||
if [ "$WIDTH" -gt "$COLS" ]; then
|
||||
WIDTH=$COLS
|
||||
fi
|
||||
|
||||
REMAP=""
|
||||
if convert "$IMG" -resize $COLS\> +dither -remap $COLOR_FILE /dev/null ; then
|
||||
if $CONVERT_CMD "$IMG" -resize $COLS\> +dither -remap $COLOR_FILE /dev/null ; then
|
||||
REMAP="-remap $COLOR_FILE"
|
||||
else
|
||||
echo "The version of convert is too old, don't expect good results :(" >&2
|
||||
#convert "$IMG" -colors 256 PNG8:tmp.png
|
||||
#IMG="tmp.png"
|
||||
# $CONVERT_CMD "$IMG" -colors 256 PNG8:tmp.png
|
||||
# IMG="tmp.png"
|
||||
fi
|
||||
|
||||
# Display the image
|
||||
I=0
|
||||
convert "$IMG" -resize $COLS\> +dither `echo $REMAP` txt:- 2>/dev/null |
|
||||
$CONVERT_CMD "$IMG" -resize $COLS\> +dither `echo $REMAP` txt:- 2>/dev/null |
|
||||
sed -e 's/.*none.*/NO NO NO/g' -e '1d;s/^.*(\(.*\)[,)].*$/\1/g;y/,/ /' |
|
||||
while read R G B f; do
|
||||
if [ ! "$R" = "NO" ]; then
|
||||
|
|
|
|||
11
plugins/chezmoi/README.md
Normal file
11
plugins/chezmoi/README.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# chezmoi Plugin
|
||||
|
||||
## Introduction
|
||||
|
||||
This `chezmoi` plugin sets up completion for [chezmoi](https://chezmoi.io).
|
||||
|
||||
To use it, add `chezmoi` to the plugins array of your zshrc file:
|
||||
|
||||
```bash
|
||||
plugins=(... chezmoi)
|
||||
```
|
||||
14
plugins/chezmoi/chezmoi.plugin.zsh
Normal file
14
plugins/chezmoi/chezmoi.plugin.zsh
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# COMPLETION FUNCTION
|
||||
if (( ! $+commands[chezmoi] )); then
|
||||
return
|
||||
fi
|
||||
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `chezmoi`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_chezmoi" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _chezmoi
|
||||
_comps[chezmoi]=_chezmoi
|
||||
fi
|
||||
|
||||
chezmoi completion zsh >| "$ZSH_CACHE_DIR/completions/_chezmoi" &|
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
_source-from-omz-settings() {
|
||||
local _chruby_path _chruby_auto
|
||||
|
||||
|
||||
zstyle -s :omz:plugins:chruby path _chruby_path || return 1
|
||||
zstyle -s :omz:plugins:chruby auto _chruby_auto || return 1
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ _source-from-homebrew() {
|
|||
if [[ -h /usr/local/opt/chruby ]];then
|
||||
_brew_prefix="/usr/local/opt/chruby"
|
||||
else
|
||||
# ok , it is not default prefix
|
||||
# ok , it is not default prefix
|
||||
# this call to brew is expensive ( about 400 ms ), so at least let's make it only once
|
||||
_brew_prefix=$(brew --prefix chruby)
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# chucknorris
|
||||
|
||||
Chuck Norris fortunes plugin for Oh My Zsh. Perfectly suitable as MOTD.
|
||||
Fortunes plugin for Chuck Norris for Oh My Zsh. Perfectly suitable as MOTD.
|
||||
|
||||
To use it add `chucknorris` to the plugins array in you zshrc file.
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ Alternatively, seek out the [online documentation][3]. And don't forget, there a
|
|||
|
||||
## Contributors
|
||||
|
||||
Contributed to `oh_my_zsh` by [benwilcock][2].
|
||||
Contributed to `oh_my_zsh` by [benwilcock][2].
|
||||
|
||||
[1]: https://docs.cloudfoundry.org/cf-cli/install-go-cli.html
|
||||
[2]: https://github.com/benwilcock
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ Also provides the following aliases:
|
|||
* **cfc:** Copies the compiled JS to your clipboard. Very useful when you want
|
||||
to run the code in a JS console.
|
||||
|
||||
* **cfp:** Compiles from your currently copied clipboard. Useful when you want
|
||||
* **cfp:** Compiles from your currently copied clipboard. Useful when you want
|
||||
to compile large/multi-line snippets
|
||||
|
||||
* **cfpc:** Paste coffeescript from clipboard, compile to JS, then copy the
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ function colored() {
|
|||
# Prefer `less` whenever available, since we specifically configured
|
||||
# environment for it.
|
||||
environment+=( PAGER="${commands[less]:-$PAGER}" )
|
||||
environment+=( GROFF_NO_SGR=1 )
|
||||
|
||||
# See ./nroff script.
|
||||
if [[ "$OSTYPE" = solaris* ]]; then
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ colorize_cat() {
|
|||
ZSH_COLORIZE_STYLE="emacs"
|
||||
fi
|
||||
|
||||
# Use stdin if no arguments have been passed.
|
||||
if [ $# -eq 0 ]; then
|
||||
# Use stdin if stdin is not attached to a terminal.
|
||||
if [ ! -t 0 ]; then
|
||||
if [[ "$ZSH_COLORIZE_TOOL" == "pygmentize" ]]; then
|
||||
pygmentize -O style="$ZSH_COLORIZE_STYLE" -g
|
||||
else
|
||||
chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}"
|
||||
chroma --style="$ZSH_COLORIZE_STYLE" --formatter="${ZSH_COLORIZE_CHROMA_FORMATTER:-terminal}" "$@"
|
||||
fi
|
||||
return $?
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -30,5 +30,6 @@ It works out of the box with the command-not-found packages for:
|
|||
- [NixOS](https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/command-not-found)
|
||||
- [Termux](https://github.com/termux/command-not-found)
|
||||
- [SUSE](https://www.unix.com/man-page/suse/1/command-not-found/)
|
||||
- [Gentoo](https://github.com/AndrewAmmerlaan/command-not-found-gentoo/tree/main)
|
||||
|
||||
You can add support for other platforms by submitting a Pull Request.
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@
|
|||
for file (
|
||||
# Arch Linux. Must have pkgfile installed: https://wiki.archlinux.org/index.php/Pkgfile#Command_not_found
|
||||
/usr/share/doc/pkgfile/command-not-found.zsh
|
||||
# macOS (M1 and classic Homebrew): https://github.com/Homebrew/homebrew-command-not-found
|
||||
# Homebrew: https://github.com/Homebrew/homebrew-command-not-found
|
||||
/opt/homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh
|
||||
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh
|
||||
/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh
|
||||
); do
|
||||
if [[ -r "$file" ]]; then
|
||||
source "$file"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
if (( ${+commands[compleat]} )); then
|
||||
local prefix="${commands[compleat]:h:h}"
|
||||
local setup="${prefix}/share/compleat-1.0/compleat_setup"
|
||||
local setup="${prefix}/share/compleat-1.0/compleat_setup"
|
||||
|
||||
if [[ -f "$setup" ]]; then
|
||||
if ! bashcompinit >/dev/null 2>&1; then
|
||||
|
|
@ -15,6 +15,6 @@ if (( ${+commands[compleat]} )); then
|
|||
bashcompinit -i
|
||||
fi
|
||||
|
||||
source "$setup"
|
||||
source "$setup"
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
44
plugins/conda-env/README.md
Normal file
44
plugins/conda-env/README.md
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
# conda-env
|
||||
|
||||
The plugin displays information of the created virtual container of conda and allows background theming.
|
||||
|
||||
To use it, add `conda-env` to the plugins array of your zshrc file:
|
||||
```
|
||||
plugins=(... conda-env)
|
||||
```
|
||||
|
||||
The plugin creates a `conda_prompt_info` function that you can use in your theme, which displays the
|
||||
basename of the current `$CONDA_DEFAULT_ENV`.
|
||||
|
||||
You can use this prompt function in your themes, by adding it to the `PROMPT` or `RPROMPT` variables. See [Example](#example) for more information.
|
||||
|
||||
## Settings
|
||||
|
||||
It uses two variables to control how the information is shown:
|
||||
|
||||
- `ZSH_THEME_CONDA_PREFIX`: sets the prefix of the CONDA_DEFAULT_ENV.
|
||||
Defaults to `[`.
|
||||
|
||||
- `ZSH_THEME_CONDA_SUFFIX`: sets the suffix of the CONDA_DEFAULT_ENV.
|
||||
Defaults to `]`.
|
||||
|
||||
## Example
|
||||
|
||||
```sh
|
||||
ZSH_THEME_CONDA_PREFIX='conda:%F{green}'
|
||||
ZSH_THEME_CONDA_SUFFIX='%f'
|
||||
RPROMPT='$(conda_prompt_info)'
|
||||
```
|
||||
|
||||
## `CONDA_CHANGEPS1`
|
||||
|
||||
This plugin also automatically sets the `CONDA_CHANGEPS1` variable to `false` to avoid conda changing the prompt
|
||||
automatically. This has the same effect as running `conda config --set changeps1 false`.
|
||||
|
||||
You can override this behavior by adding `unset CONDA_CHANGEPS1` in your `.zshrc` file, after Oh My Zsh has been
|
||||
sourced.
|
||||
|
||||
References:
|
||||
|
||||
- https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#determining-your-current-environment
|
||||
- https://conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#precedence
|
||||
9
plugins/conda-env/conda-env.plugin.zsh
Normal file
9
plugins/conda-env/conda-env.plugin.zsh
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
function conda_prompt_info(){
|
||||
[[ -n ${CONDA_DEFAULT_ENV} ]] || return
|
||||
echo "${ZSH_THEME_CONDA_PREFIX=[}${CONDA_DEFAULT_ENV:t:gs/%/%%}${ZSH_THEME_CONDA_SUFFIX=]}"
|
||||
}
|
||||
|
||||
# Has the same effect as `conda config --set changeps1 false`
|
||||
# - https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#determining-your-current-environment
|
||||
# - https://conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#precedence
|
||||
export CONDA_CHANGEPS1=false
|
||||
37
plugins/conda/README.md
Normal file
37
plugins/conda/README.md
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
# conda plugin
|
||||
|
||||
The conda plugin provides [aliases](#aliases) for `conda`, usually installed via [anaconda](https://www.anaconda.com/) or [miniconda](https://docs.conda.io/en/latest/miniconda.html).
|
||||
|
||||
To use it, add `conda` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... conda)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
| :------- | :-------------------------------------- | :------------------------------------------------------------------------------ |
|
||||
| `cna` | `conda activate` | Activate the specified conda environment |
|
||||
| `cnab` | `conda activate base` | Activate the base conda environment |
|
||||
| `cncf` | `conda env create -f` | Create a new conda environment from a YAML file |
|
||||
| `cncn` | `conda create -y -n` | Create a new conda environment with the given name |
|
||||
| `cnconf` | `conda config` | View or modify conda configuration |
|
||||
| `cncp` | `conda create -y -p` | Create a new conda environment with the given prefix |
|
||||
| `cncr` | `conda create -n` | Create new virtual environment with given name |
|
||||
| `cncss` | `conda config --show-source` | Show the locations of conda configuration sources |
|
||||
| `cnde` | `conda deactivate` | Deactivate the current conda environment |
|
||||
| `cnel` | `conda env list` | List all available conda environments |
|
||||
| `cni` | `conda install` | Install given package |
|
||||
| `cniy` | `conda install -y` | Install given package without confirmation |
|
||||
| `cnl` | `conda list` | List installed packages in the current environment |
|
||||
| `cnle` | `conda list --export` | Export the list of installed packages in the current environment |
|
||||
| `cnles` | `conda list --explicit > spec-file.txt` | Export the list of installed packages in the current environment to a spec file |
|
||||
| `cnr` | `conda remove` | Remove given package |
|
||||
| `cnrn` | `conda remove -y -all -n` | Remove all packages in the specified environment |
|
||||
| `cnrp` | `conda remove -y -all -p` | Remove all packages in the specified prefix |
|
||||
| `cnry` | `conda remove -y` | Remove given package without confirmation |
|
||||
| `cnsr` | `conda search` | Search conda repositories for package |
|
||||
| `cnu` | `conda update` | Update conda package manager |
|
||||
| `cnua` | `conda update --all` | Update all installed packages |
|
||||
| `cnuc` | `conda update conda` | Update conda package manager |
|
||||
23
plugins/conda/conda.plugin.zsh
Normal file
23
plugins/conda/conda.plugin.zsh
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
alias cna='conda activate'
|
||||
alias cnab='conda activate base'
|
||||
alias cncf='conda env create -f'
|
||||
alias cncn='conda create -y -n'
|
||||
alias cnconf='conda config'
|
||||
alias cncp='conda create -y -p'
|
||||
alias cncr='conda create -n'
|
||||
alias cncss='conda config --show-source'
|
||||
alias cnde='conda deactivate'
|
||||
alias cnel='conda env list'
|
||||
alias cni='conda install'
|
||||
alias cniy='conda install -y'
|
||||
alias cnl='conda list'
|
||||
alias cnle='conda list --export'
|
||||
alias cnles='conda list --explicit > spec-file.txt'
|
||||
alias cnr='conda remove'
|
||||
alias cnrn='conda remove -y -all -n'
|
||||
alias cnrp='conda remove -y -all -p'
|
||||
alias cnry='conda remove -y'
|
||||
alias cnsr='conda search'
|
||||
alias cnu='conda update'
|
||||
alias cnua='conda update --all'
|
||||
alias cnuc='conda update conda'
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
# copy the active line from the command line buffer
|
||||
# copy the active line from the command line buffer
|
||||
# onto the system clipboard
|
||||
|
||||
copybuffer () {
|
||||
if which clipcopy &>/dev/null; then
|
||||
if builtin which clipcopy &>/dev/null; then
|
||||
printf "%s" "$BUFFER" | clipcopy
|
||||
else
|
||||
zle -M "clipcopy not found. Please make sure you have Oh My Zsh installed correctly."
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ dash
|
|||
|
||||
- Query for something in dash app: `dash query`
|
||||
```
|
||||
dash golang
|
||||
dash golang
|
||||
```
|
||||
|
||||
- You can optionally provide a keyword: `dash [keyword:]query`
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
# dbt plugin
|
||||
|
||||
## Introduction
|
||||
|
||||
The `dbt plugin` adds several aliases for useful [dbt](https://docs.getdbt.com/) commands and
|
||||
[aliases](#aliases).
|
||||
|
||||
To use it, add `dbt` to the plugins array of your zshrc file:
|
||||
|
||||
```
|
||||
```zsh
|
||||
plugins=(... dbt)
|
||||
```
|
||||
|
||||
|
|
@ -26,4 +24,4 @@ plugins=(... dbt)
|
|||
|
||||
## Maintainer
|
||||
|
||||
### [msempere](https://github.com/msempere)
|
||||
- [msempere](https://github.com/msempere)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,12 @@ plugins=(... debian)
|
|||
- `$apt_pref`: use aptitude or apt if installed, fallback is apt-get.
|
||||
- `$apt_upgr`: use upgrade or safe-upgrade (for aptitude).
|
||||
|
||||
Set `$apt_pref` and `$apt_upgr` to whatever command you want (before sourcing Oh My Zsh) to override this behavior.
|
||||
Set **both** `$apt_pref` and `$apt_upgr` to whatever command you want (before sourcing Oh My Zsh) to override this behavior, e.g.:
|
||||
|
||||
```sh
|
||||
apt_pref='apt'
|
||||
apt_upgr='full-upgrade'
|
||||
```
|
||||
|
||||
## Common Aliases
|
||||
|
||||
|
|
|
|||
|
|
@ -37,13 +37,13 @@ Say you opened these directories on the terminal:
|
|||
3 ~
|
||||
```
|
||||
|
||||
By pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd>, the current working directory or `$CWD` will be from `oh-my-zsh` to `Hacktoberfest`. Press it again and it will be at `Projects`.
|
||||
By pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd>, the current working directory or `$PWD` will be from `oh-my-zsh` to `Hacktoberfest`. Press it again and it will be at `Projects`.
|
||||
|
||||
And by pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd>, the `$CWD` will be from `Projects` to `Hacktoberfest`. Press it again and it will be at `oh-my-zsh`.
|
||||
And by pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd>, the `$PWD` will be from `Projects` to `Hacktoberfest`. Press it again and it will be at `oh-my-zsh`.
|
||||
|
||||
Here's a example history table with the same accessed directories like above:
|
||||
|
||||
| Current `$CWD` | Key press | New `$CWD` |
|
||||
| Current `$PWD` | Key press | New `$PWD` |
|
||||
| --------------- | ----------------------------------------------------- | --------------- |
|
||||
| `oh-my-zsh` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> | `Hacktoberfest` |
|
||||
| `Hacktoberfest` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> | `Projects` |
|
||||
|
|
@ -53,7 +53,7 @@ Here's a example history table with the same accessed directories like above:
|
|||
| `Hacktoberfest` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> | `oh-my-zsh` |
|
||||
| `oh-my-zsh` | <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> | `~` |
|
||||
|
||||
Note the last traversal, when pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> on a last known `$CWD`, it will change back to the first known `$CWD`, which in the example is `~`.
|
||||
Note the last traversal, when pressing <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> on a last known `$PWD`, it will change back to the first known `$PWD`, which in the example is `~`.
|
||||
|
||||
Here's an asciinema cast demonstrating the example above:
|
||||
|
||||
|
|
@ -61,18 +61,22 @@ Here's an asciinema cast demonstrating the example above:
|
|||
|
||||
## Functions
|
||||
|
||||
| Function | Description |
|
||||
| -------------------- | --------------------------------------------------------------------------------------------------------- |
|
||||
| `insert-cycledleft` | Change `$CWD` to the previous known stack, binded on <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> |
|
||||
| `insert-cycledright` | Change `$CWD` to the next known stack, binded on <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> |
|
||||
| Function | Description |
|
||||
| -------------------- | ------------------------------------------------------------------------------------------------------------------- |
|
||||
| `insert-cycledleft` | Change `$PWD` to the previous known stack, bound to <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> |
|
||||
| `insert-cycledright` | Change `$PWD` to the next known stack, bound to <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Right</kbd> |
|
||||
| `insert-cycledup` | Change `$PWD` to the parent folder, bound to <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Up</kbd> |
|
||||
| `insert-cycleddown` | Change `$PWD` to the first alphabetical child folder, bound to <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>Down</kbd> |
|
||||
|
||||
## Rebinding keys
|
||||
|
||||
You can bind these functions to other key sequences, as long as you know the bindkey sequence. For example, these commands bind to <kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>Left</kbd> / <kbd>Right</kbd> in `xterm-256color`:
|
||||
You can bind these functions to other key sequences, as long as you know the bindkey sequence. For example, these commands bind to <kbd>Alt</kbd> + <kbd>Shift</kbd> + <kbd>key</kbd> in `xterm-256color`:
|
||||
|
||||
```zsh
|
||||
bindkey '^[[1;4D' insert-cycledleft
|
||||
bindkey '^[[1;4C' insert-cycledright
|
||||
bindkey "\e[1;4A" insert-cycledup
|
||||
bindkey "\e[1;4B" insert-cycleddown
|
||||
```
|
||||
|
||||
You can get the bindkey sequence by pressing <kbd>Ctrl</kbd> + <kbd>V</kbd>, then pressing the keyboard shortcut you want to use.
|
||||
|
|
|
|||
|
|
@ -8,7 +8,16 @@
|
|||
# pushd +N: start counting from left of `dirs' output
|
||||
# pushd -N: start counting from right of `dirs' output
|
||||
|
||||
# Either switch to a directory from dirstack, using +N or -N syntax
|
||||
# or switch to a directory by path, using `switch-to-dir -- <path>`
|
||||
switch-to-dir () {
|
||||
# If $1 is --, then treat $2 as a directory path
|
||||
if [[ $1 == -- ]]; then
|
||||
# We use `-q` because we don't want chpwd to run, we'll do it manually
|
||||
[[ -d "$2" ]] && builtin pushd -q "$2" &>/dev/null
|
||||
return $?
|
||||
fi
|
||||
|
||||
setopt localoptions nopushdminus
|
||||
[[ ${#dirstack} -eq 0 ]] && return 1
|
||||
|
||||
|
|
@ -22,10 +31,10 @@ switch-to-dir () {
|
|||
}
|
||||
|
||||
insert-cycledleft () {
|
||||
switch-to-dir +1 || return
|
||||
switch-to-dir +1 || return $?
|
||||
|
||||
local fn
|
||||
for fn (chpwd $chpwd_functions precmd $precmd_functions); do
|
||||
for fn in chpwd $chpwd_functions precmd $precmd_functions; do
|
||||
(( $+functions[$fn] )) && $fn
|
||||
done
|
||||
zle reset-prompt
|
||||
|
|
@ -33,22 +42,46 @@ insert-cycledleft () {
|
|||
zle -N insert-cycledleft
|
||||
|
||||
insert-cycledright () {
|
||||
switch-to-dir -0 || return
|
||||
switch-to-dir -0 || return $?
|
||||
|
||||
local fn
|
||||
for fn (chpwd $chpwd_functions precmd $precmd_functions); do
|
||||
for fn in chpwd $chpwd_functions precmd $precmd_functions; do
|
||||
(( $+functions[$fn] )) && $fn
|
||||
done
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N insert-cycledright
|
||||
|
||||
insert-cycledup () {
|
||||
switch-to-dir -- .. || return $?
|
||||
|
||||
local fn
|
||||
for fn in chpwd $chpwd_functions precmd $precmd_functions; do
|
||||
(( $+functions[$fn] )) && $fn
|
||||
done
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N insert-cycledup
|
||||
|
||||
insert-cycleddown () {
|
||||
switch-to-dir -- "$(find . -mindepth 1 -maxdepth 1 -type d | sort -n | head -n 1)" || return $?
|
||||
|
||||
local fn
|
||||
for fn in chpwd $chpwd_functions precmd $precmd_functions; do
|
||||
(( $+functions[$fn] )) && $fn
|
||||
done
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N insert-cycleddown
|
||||
|
||||
# These sequences work for xterm, Apple Terminal.app, and probably others.
|
||||
# Not for rxvt-unicode, but it doesn't seem differentiate Ctrl-Shift-Arrow
|
||||
# from plain Shift-Arrow, at least by default.
|
||||
#
|
||||
# iTerm2 does not have these key combinations defined by default; you will need
|
||||
# to add them under "Keys" in your profile if you want to use this. You can do
|
||||
# this conveniently by loading the "xterm with Numeric Keypad" preset.
|
||||
bindkey "\e[1;6D" insert-cycledleft
|
||||
bindkey "\e[1;6C" insert-cycledright
|
||||
bindkey "\e[1;6D" insert-cycledleft # Ctrl+Shift+Left
|
||||
bindkey "\e[1;6C" insert-cycledright # Ctrl+Shift+Right
|
||||
bindkey "\e[1;6A" insert-cycledup # Ctrl+Shift+Up
|
||||
bindkey "\e[1;6B" insert-cycleddown # Ctrl+Shift+Down
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ _direnv_hook() {
|
|||
trap - SIGINT;
|
||||
}
|
||||
typeset -ag precmd_functions;
|
||||
if [[ -z ${precmd_functions[(r)_direnv_hook]} ]]; then
|
||||
if [[ -z "${precmd_functions[(r)_direnv_hook]+1}" ]]; then
|
||||
precmd_functions=( _direnv_hook ${precmd_functions[@]} )
|
||||
fi
|
||||
typeset -ag chpwd_functions;
|
||||
if [[ -z ${chpwd_functions[(r)_direnv_hook]} ]]; then
|
||||
if [[ -z "${chpwd_functions[(r)_direnv_hook]+1}" ]]; then
|
||||
chpwd_functions=( _direnv_hook ${chpwd_functions[@]} )
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ To use it, add `dnf` to the plugins array in your zshrc file:
|
|||
plugins=(... dnf)
|
||||
```
|
||||
|
||||
Classic `dnf` is getting superseded by `dnf5`; this plugin detects the presence
|
||||
of `dnf5` and uses it as drop-in alternative to the slower `dnf`.
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|
|
|
|||
|
|
@ -1,15 +1,19 @@
|
|||
## Aliases
|
||||
local dnfprog="dnf"
|
||||
|
||||
alias dnfl="dnf list" # List packages
|
||||
alias dnfli="dnf list installed" # List installed packages
|
||||
alias dnfgl="dnf grouplist" # List package groups
|
||||
alias dnfmc="dnf makecache" # Generate metadata cache
|
||||
alias dnfp="dnf info" # Show package information
|
||||
alias dnfs="dnf search" # Search package
|
||||
# Prefer dnf5 if installed
|
||||
command -v dnf5 > /dev/null && dnfprog=dnf5
|
||||
|
||||
alias dnfu="sudo dnf upgrade" # Upgrade package
|
||||
alias dnfi="sudo dnf install" # Install package
|
||||
alias dnfgi="sudo dnf groupinstall" # Install package group
|
||||
alias dnfr="sudo dnf remove" # Remove package
|
||||
alias dnfgr="sudo dnf groupremove" # Remove package group
|
||||
alias dnfc="sudo dnf clean all" # Clean cache
|
||||
alias dnfl="${dnfprog} list" # List packages
|
||||
alias dnfli="${dnfprog} list installed" # List installed packages
|
||||
alias dnfgl="${dnfprog} grouplist" # List package groups
|
||||
alias dnfmc="${dnfprog} makecache" # Generate metadata cache
|
||||
alias dnfp="${dnfprog} info" # Show package information
|
||||
alias dnfs="${dnfprog} search" # Search package
|
||||
|
||||
alias dnfu="sudo ${dnfprog} upgrade" # Upgrade package
|
||||
alias dnfi="sudo ${dnfprog} install" # Install package
|
||||
alias dnfgi="sudo ${dnfprog} groupinstall" # Install package group
|
||||
alias dnfr="sudo ${dnfprog} remove" # Remove package
|
||||
alias dnfgr="sudo ${dnfprog} groupremove" # Remove package group
|
||||
alias dnfc="sudo ${dnfprog} clean all" # Clean cache
|
||||
|
|
|
|||
|
|
@ -11,23 +11,24 @@ plugins=(... docker-compose)
|
|||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-----------|--------------------------------|----------------------------------------------------------------------------------|
|
||||
| dco | `docker-compose` | Docker-compose main command |
|
||||
| dcb | `docker-compose build` | Build containers |
|
||||
| dce | `docker-compose exec` | Execute command inside a container |
|
||||
| dcps | `docker-compose ps` | List containers |
|
||||
| dcrestart | `docker-compose restart` | Restart container |
|
||||
| dcrm | `docker-compose rm` | Remove container |
|
||||
| dcr | `docker-compose run` | Run a command in container |
|
||||
| dcstop | `docker-compose stop` | Stop a container |
|
||||
| dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service |
|
||||
| dcupb | `docker-compose up --build` | Same as `dcup`, but build images before starting containers |
|
||||
| dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon |
|
||||
| dcupdb | `docker-compose up -d --build` | Same as `dcup`, but build images before starting containers and starts as daemon |
|
||||
| dcdn | `docker-compose down` | Stop and remove containers |
|
||||
| dcl | `docker-compose logs` | Show logs of container |
|
||||
| dclf | `docker-compose logs -f` | Show logs and follow output |
|
||||
| dcpull | `docker-compose pull` | Pull image of a service |
|
||||
| dcstart | `docker-compose start` | Start a container |
|
||||
| dck | `docker-compose kill` | Kills containers |
|
||||
| Alias | Command | Description |
|
||||
|-----------|----------------------------------|----------------------------------------------------------------------------------|
|
||||
| dco | `docker-compose` | Docker-compose main command |
|
||||
| dcb | `docker-compose build` | Build containers |
|
||||
| dce | `docker-compose exec` | Execute command inside a container |
|
||||
| dcps | `docker-compose ps` | List containers |
|
||||
| dcrestart | `docker-compose restart` | Restart container |
|
||||
| dcrm | `docker-compose rm` | Remove container |
|
||||
| dcr | `docker-compose run` | Run a command in container |
|
||||
| dcstop | `docker-compose stop` | Stop a container |
|
||||
| dcup | `docker-compose up` | Build, (re)create, start, and attach to containers for a service |
|
||||
| dcupb | `docker-compose up --build` | Same as `dcup`, but build images before starting containers |
|
||||
| dcupd | `docker-compose up -d` | Same as `dcup`, but starts as daemon |
|
||||
| dcupdb | `docker-compose up -d --build` | Same as `dcup`, but build images before starting containers and starts as daemon |
|
||||
| dcdn | `docker-compose down` | Stop and remove containers |
|
||||
| dcl | `docker-compose logs` | Show logs of container |
|
||||
| dclf | `docker-compose logs -f` | Show logs and follow output |
|
||||
| dclF | `docker-compose logs -f --tail0` | Just follow recent logs |
|
||||
| dcpull | `docker-compose pull` | Pull image of a service |
|
||||
| dcstart | `docker-compose start` | Start a container |
|
||||
| dck | `docker-compose kill` | Kills containers |
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ __docker-compose_subcommand() {
|
|||
'--resolve-image-digests[Pin image tags to digests.]' \
|
||||
'--services[Print the service names, one per line.]' \
|
||||
'--volumes[Print the volume names, one per line.]' \
|
||||
'--hash[Print the service config hash, one per line. Set "service1,service2" for a list of specified services.]' \ && ret=0
|
||||
'--hash[Print the service config hash, one per line. Set "service1,service2" for a list of specified services.]' && ret=0
|
||||
;;
|
||||
(create)
|
||||
_arguments \
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
# support Compose v2 as docker CLI plugin
|
||||
(( ${+commands[docker-compose]} )) && dccmd='docker-compose' || dccmd='docker compose'
|
||||
# Support Compose v2 as docker CLI plugin
|
||||
#
|
||||
# This tests that the (old) docker-compose command is in $PATH and that
|
||||
# it resolves to an existing executable file if it's a symlink.
|
||||
[[ -x "${commands[docker-compose]:A}" ]] && dccmd='docker-compose' || dccmd='docker compose'
|
||||
|
||||
alias dco="$dccmd"
|
||||
alias dcb="$dccmd build"
|
||||
|
|
@ -16,6 +19,7 @@ alias dcupdb="$dccmd up -d --build"
|
|||
alias dcdn="$dccmd down"
|
||||
alias dcl="$dccmd logs"
|
||||
alias dclf="$dccmd logs -f"
|
||||
alias dclF="$dccmd logs -f --tail 0"
|
||||
alias dcpull="$dccmd pull"
|
||||
alias dcstart="$dccmd start"
|
||||
alias dck="$dccmd kill"
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
# docker-machine plugin for oh my zsh
|
||||
|
||||
### Usage
|
||||
|
||||
#### docker-vm
|
||||
Will create a docker-machine with the name "dev" (required only once)
|
||||
To create a second machine call "docker-vm foobar" or pass any other name
|
||||
|
||||
#### docker-up
|
||||
This will start your "dev" docker-machine (if necessary) and set it as the active one
|
||||
To start a named machine use "docker-up foobar"
|
||||
|
||||
#### docker-switch dev
|
||||
Use this to activate a running docker-machine (or to switch between multiple machines)
|
||||
You need to call either this or docker-up when opening a new terminal
|
||||
|
||||
#### docker-stop
|
||||
This will stop your "dev" docker-machine
|
||||
To stop a named machine use "docker-stop foobar"
|
||||
|
|
@ -1,359 +0,0 @@
|
|||
#compdef docker-machine
|
||||
# Description
|
||||
# -----------
|
||||
# zsh completion for docker-machine
|
||||
# https://github.com/leonhartX/docker-machine-zsh-completion
|
||||
# -------------------------------------------------------------------------
|
||||
# Version
|
||||
# -------
|
||||
# 0.1.1
|
||||
# -------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
# * Ke Xu <leonhartx.k@gmail.com>
|
||||
# -------------------------------------------------------------------------
|
||||
# Inspiration
|
||||
# -----------
|
||||
# * @sdurrheimer docker-compose-zsh-completion https://github.com/sdurrheimer/docker-compose-zsh-completion
|
||||
# * @ilkka _docker-machine
|
||||
|
||||
|
||||
__docker-machine_get_hosts() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
local state
|
||||
declare -a hosts
|
||||
state=$1; shift
|
||||
if [[ $state != all ]]; then
|
||||
hosts=(${(f)"$(_call_program commands docker-machine ls -q --filter state=$state)"})
|
||||
else
|
||||
hosts=(${(f)"$(_call_program commands docker-machine ls -q)"})
|
||||
fi
|
||||
_describe 'host' hosts "$@" && ret=0
|
||||
return ret
|
||||
}
|
||||
|
||||
__docker-machine_hosts_with_state() {
|
||||
declare -a hosts
|
||||
hosts=(${(f)"$(_call_program commands docker-machine ls -f '{{.Name}}\:{{.DriverName}}\({{.State}}\)\ {{.URL}}')"})
|
||||
_describe 'host' hosts
|
||||
}
|
||||
|
||||
__docker-machine_hosts_all() {
|
||||
__docker-machine_get_hosts all "$@"
|
||||
}
|
||||
|
||||
__docker-machine_hosts_running() {
|
||||
__docker-machine_get_hosts Running "$@"
|
||||
}
|
||||
|
||||
__docker-machine_get_swarm() {
|
||||
declare -a swarms
|
||||
swarms=(${(f)"$(_call_program commands docker-machine ls -f {{.Swarm}} | awk '{print $1}')"})
|
||||
_describe 'swarm' swarms
|
||||
}
|
||||
|
||||
__docker-machine_hosts_and_files() {
|
||||
_alternative "hosts:host:__docker-machine_hosts_all -qS ':'" 'files:files:_path_files'
|
||||
}
|
||||
|
||||
__docker-machine_filters() {
|
||||
[[ $PREFIX = -* ]] && return 1
|
||||
integer ret=1
|
||||
|
||||
if compset -P '*='; then
|
||||
case "${${words[-1]%=*}#*=}" in
|
||||
(driver)
|
||||
_describe -t driver-filter-opts "driver filter" opts_driver && ret=0
|
||||
;;
|
||||
(swarm)
|
||||
__docker-machine_get_swarm && ret=0
|
||||
;;
|
||||
(state)
|
||||
opts_state=('Running' 'Paused' 'Saved' 'Stopped' 'Stopping' 'Starting' 'Error')
|
||||
_describe -t state-filter-opts "state filter" opts_state && ret=0
|
||||
;;
|
||||
(name)
|
||||
__docker-machine_hosts_all && ret=0
|
||||
;;
|
||||
(label)
|
||||
_message 'label' && ret=0
|
||||
;;
|
||||
*)
|
||||
_message 'value' && ret=0
|
||||
;;
|
||||
esac
|
||||
else
|
||||
opts=('driver' 'swarm' 'state' 'name' 'label')
|
||||
_describe -t filter-opts "filter" opts -qS "=" && ret=0
|
||||
fi
|
||||
return ret
|
||||
}
|
||||
|
||||
__get_swarm_discovery() {
|
||||
declare -a masters services
|
||||
local service
|
||||
services=()
|
||||
masters=($(docker-machine ls -f {{.Swarm}} |grep '(master)' |awk '{print $1}'))
|
||||
for master in $masters; do
|
||||
service=${${${(f)"$(_call_program commands docker-machine inspect -f '{{.HostOptions.SwarmOptions.Discovery}}:{{.Name}}' $master)"}/:/\\:}}
|
||||
services=($services $service)
|
||||
done
|
||||
_describe -t services "swarm service" services && ret=0
|
||||
return ret
|
||||
}
|
||||
|
||||
__get_create_argument() {
|
||||
typeset -g docker_machine_driver
|
||||
if [[ CURRENT -le 2 ]]; then
|
||||
docker_machine_driver="none"
|
||||
elif [[ CURRENT > 2 && $words[CURRENT-2] = '-d' || $words[CURRENT-2] = '--driver' ]]; then
|
||||
docker_machine_driver=$words[CURRENT-1]
|
||||
elif [[ $words[CURRENT-1] =~ '^(-d|--driver)=' ]]; then
|
||||
docker_machine_driver=${${words[CURRENT-1]}/*=/}
|
||||
fi
|
||||
local driver_opt_cmd
|
||||
local -a opts_provider opts_common opts_read_argument
|
||||
opts_read_argument=(
|
||||
": :->argument"
|
||||
)
|
||||
opts_common=(
|
||||
$opts_help \
|
||||
'(--driver -d)'{--driver=,-d=}'[Driver to create machine with]:dirver:->driver-option' \
|
||||
'--engine-install-url=[Custom URL to use for engine installation]:url' \
|
||||
'*--engine-opt=[Specify arbitrary flags to include with the created engine in the form flag=value]:flag' \
|
||||
'*--engine-insecure-registry=[Specify insecure registries to allow with the created engine]:registry' \
|
||||
'*--engine-registry-mirror=[Specify registry mirrors to use]:mirror' \
|
||||
'*--engine-label=[Specify labels for the created engine]:label' \
|
||||
'--engine-storage-driver=[Specify a storage driver to use with the engine]:storage-driver:->storage-driver-option' \
|
||||
'*--engine-env=[Specify environment variables to set in the engine]:environment' \
|
||||
'--swarm[Configure Machine with Swarm]' \
|
||||
'--swarm-image=[Specify Docker image to use for Swarm]:image' \
|
||||
'--swarm-master[Configure Machine to be a Swarm master]' \
|
||||
'--swarm-discovery=[Discovery service to use with Swarm]:service:->swarm-service' \
|
||||
'--swarm-strategy=[Define a default scheduling strategy for Swarm]:strategy:(spread binpack random)' \
|
||||
'*--swarm-opt=[Define arbitrary flags for swarm]:flag' \
|
||||
'*--swarm-join-opt=[Define arbitrary flags for Swarm join]:flag' \
|
||||
'--swarm-host=[ip/socket to listen on for Swarm master]:host' \
|
||||
'--swarm-addr=[addr to advertise for Swarm (default: detect and use the machine IP)]:address' \
|
||||
'--swarm-experimental[Enable Swarm experimental features]' \
|
||||
'*--tls-san=[Support extra SANs for TLS certs]:option'
|
||||
)
|
||||
driver_opt_cmd="docker-machine create -d $docker_machine_driver | grep $docker_machine_driver | sed -e 's/\(--.*\)\ *\[\1[^]]*\]/*\1/g' -e 's/\(\[[^]]*\)/\\\\\\1\\\\/g' -e 's/\".*\"\(.*\)/\1/g' | awk '{printf \"%s[\", \$1; for(i=2;i<=NF;i++) {printf \"%s \", \$i}; print \"]\"}'"
|
||||
if [[ $docker_machine_driver != "none" ]]; then
|
||||
opts_provider=(${(f)"$(_call_program commands $driver_opt_cmd)"})
|
||||
_arguments \
|
||||
$opts_provider \
|
||||
$opts_read_argument \
|
||||
$opts_common && ret=0
|
||||
else
|
||||
_arguments $opts_common && ret=0
|
||||
fi
|
||||
case $state in
|
||||
(driver-option)
|
||||
_describe -t driver-option "driver" opts_driver && ret=0
|
||||
;;
|
||||
(storage-driver-option)
|
||||
_describe -t storage-driver-option "storage driver" opts_storage_driver && ret=0
|
||||
;;
|
||||
(swarm-service)
|
||||
__get_swarm_discovery && ret=0
|
||||
;;
|
||||
(argument)
|
||||
ret=0
|
||||
;;
|
||||
esac
|
||||
return ret
|
||||
}
|
||||
|
||||
|
||||
__docker-machine_subcommand() {
|
||||
local -a opts_help
|
||||
opts_help=("(- :)--help[Print usage]")
|
||||
local -a opts_only_host opts_driver opts_storage_driver opts_state
|
||||
opts_only_host=(
|
||||
"$opts_help"
|
||||
"*:host:__docker-machine_hosts_all"
|
||||
)
|
||||
opts_driver=('amazonec2' 'azure' 'digitalocean' 'exoscale' 'generic' 'google' 'hyperv' 'none' 'openstack' 'rackspace' 'softlayer' 'virtualbox' 'vmwarefusion' 'vmwarevcloudair' 'vmwarevsphere')
|
||||
opts_storage_driver=('overlay' 'aufs' 'btrfs' 'devicemapper' 'vfs' 'zfs')
|
||||
integer ret=1
|
||||
|
||||
case "$words[1]" in
|
||||
(active)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(--timeout -t)'{--timeout=,-t=}'[Timeout in seconds, default to 10s]:seconds' && ret=0
|
||||
;;
|
||||
(config)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'--swarm[Display the Swarm config instead of the Docker daemon]' \
|
||||
"*:host:__docker-machine_hosts_all" && ret=0
|
||||
;;
|
||||
(create)
|
||||
__get_create_argument
|
||||
;;
|
||||
(env)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'--swarm[Display the Swarm config instead of the Docker daemon]' \
|
||||
'--shell=[Force environment to be configured for a specified shell: \[fish, cmd, powershell\], default is auto-detect]:shell' \
|
||||
'(--unset -u)'{--unset,-u}'[Unset variables instead of setting them]' \
|
||||
'--no-proxy[Add machine IP to NO_PROXY environment variable]' \
|
||||
'*:host:__docker-machine_hosts_running' && ret=0
|
||||
;;
|
||||
(help)
|
||||
_arguments ':subcommand:__docker-machine_commands' && ret=0
|
||||
;;
|
||||
(inspect)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(--format -f)'{--format=,-f=}'[Format the output using the given go template]:template' \
|
||||
'*:host:__docker-machine_hosts_all' && ret=0
|
||||
;;
|
||||
(ip)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'*:host:__docker-machine_hosts_running' && ret=0
|
||||
;;
|
||||
(kill)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'*:host:__docker-machine_hosts_with_state' && ret=0
|
||||
;;
|
||||
(ls)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(--quiet -q)'{--quiet,-q}'[Enable quiet mode]' \
|
||||
'*--filter=[Filter output based on conditions provided]:filter:->filter-options' \
|
||||
'(--timeout -t)'{--timeout=,-t=}'[Timeout in seconds, default to 10s]:seconds' \
|
||||
'(--format -f)'{--format=,-f=}'[Pretty-print machines using a Go template]:template' && ret=0
|
||||
case $state in
|
||||
(filter-options)
|
||||
__docker-machine_filters && ret=0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
(provision)
|
||||
_arguments $opts_only_host && ret=0
|
||||
;;
|
||||
(regenerate-certs)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(--force -f)'{--force,-f}'[Force rebuild and do not prompt]' \
|
||||
'*:host:__docker-machine_hosts_all' && ret=0
|
||||
;;
|
||||
(restart)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'*:host:__docker-machine_hosts_with_state' && ret=0
|
||||
;;
|
||||
(rm)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(--force -f)'{--force,-f}'[Remove local configuration even if machine cannot be removed, also implies an automatic yes (`-y`)]' \
|
||||
'-y[Assumes automatic yes to proceed with remove, without prompting further user confirmation]' \
|
||||
'*:host:__docker-machine_hosts_with_state' && ret=0
|
||||
;;
|
||||
(scp)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(--recursive -r)'{--recursive,-r}'[Copy files recursively (required to copy directories))]' \
|
||||
'*:files:__docker-machine_hosts_and_files' && ret=0
|
||||
;;
|
||||
(ssh)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'*:host:__docker-machine_hosts_running' && ret=0
|
||||
;;
|
||||
(start)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'*:host:__docker-machine_hosts_with_state' && ret=0
|
||||
;;
|
||||
(status)
|
||||
_arguments $opts_only_host && ret=0
|
||||
;;
|
||||
(stop)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'*:host:__docker-machine_hosts_with_state' && ret=0
|
||||
;;
|
||||
(upgrade)
|
||||
_arguments $opts_only_host && ret=0
|
||||
;;
|
||||
(url)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'*:host:__docker-machine_hosts_running' && ret=0
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
|
||||
__docker-machine_commands() {
|
||||
local cache_policy
|
||||
|
||||
zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
|
||||
if [[ -z "$cache_policy" ]]; then
|
||||
zstyle ":completion:${curcontext}:" cache-policy __docker-machine_caching_policy
|
||||
fi
|
||||
|
||||
if ( [[ ${+_docker_machine_subcommands} -eq 0 ]] || _cache_invalid docker_machine_subcommands) \
|
||||
&& ! _retrieve_cache docker_machine_subcommands;
|
||||
then
|
||||
local -a lines
|
||||
lines=(${(f)"$(_call_program commands docker-machine 2>&1)"})
|
||||
_docker_machine_subcommands=(${${${lines[$((${lines[(i)Commands:]} + 1)),${lines[(I) *]}]}## #}/$'\t'##/:})
|
||||
(( $#_docker_machine_subcommands > 0 )) && _store_cache docker_machine_subcommands _docker_machine_subcommands
|
||||
fi
|
||||
_describe -t docker-machine-commands "docker-machine command" _docker_machine_subcommands
|
||||
}
|
||||
|
||||
__docker-machine_caching_policy() {
|
||||
oldp=( "$1"(Nmh+1) )
|
||||
(( $#oldp ))
|
||||
}
|
||||
|
||||
_docker-machine() {
|
||||
if [[ $service != docker-machine ]]; then
|
||||
_call_function - _$service
|
||||
return
|
||||
fi
|
||||
|
||||
local curcontext="$curcontext" state line
|
||||
integer ret=1
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
"(- :)"{-h,--help}"[Show help]" \
|
||||
"(-D --debug)"{-D,--debug}"[Enable debug mode]" \
|
||||
'(-s --storage-path)'{-s,--storage-path}'[Configures storage path]:file:_files' \
|
||||
'--tls-ca-cert[CA to verify remotes against]:file:_files' \
|
||||
'--tls-ca-key[Private key to generate certificates]:file:_files' \
|
||||
'--tls-client-cert[Client cert to use for TLS]:file:_files' \
|
||||
'--tls-client-key[Private key used in client TLS auth]:file:_files' \
|
||||
'--github-api-token[Token to use for requests to the GitHub API]' \
|
||||
'--native-ssh[Use the native (Go-based) SSH implementation.]' \
|
||||
'--bugsnag-api-token[Bugsnag API token for crash reporting]' \
|
||||
'(- :)'{-v,--version}'[Print the version]' \
|
||||
"(-): :->command" \
|
||||
"(-)*:: :->option-or-argument" && ret=0
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
__docker-machine_commands && ret=0
|
||||
;;
|
||||
(option-or-argument)
|
||||
curcontext=${curcontext%:*:*}:docker-machine-$words[1]:
|
||||
__docker-machine_subcommand && ret=0
|
||||
ret=0
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_docker-machine "$@"
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
DEFAULT_MACHINE="default"
|
||||
|
||||
docker-up() {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
docker-machine start "${DEFAULT_MACHINE}"
|
||||
eval $(docker-machine env "${DEFAULT_MACHINE}")
|
||||
else
|
||||
docker-machine start $1
|
||||
eval $(docker-machine env $1)
|
||||
fi
|
||||
echo $DOCKER_HOST
|
||||
}
|
||||
docker-stop() {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
docker-machine stop "${DEFAULT_MACHINE}"
|
||||
else
|
||||
docker-machine stop $1
|
||||
fi
|
||||
}
|
||||
docker-switch() {
|
||||
eval $(docker-machine env $1)
|
||||
echo $DOCKER_HOST
|
||||
}
|
||||
docker-vm() {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
docker-machine create -d virtualbox --virtualbox-disk-size 20000 --virtualbox-memory 4096 --virtualbox-cpu-count 2 "${DEFAULT_MACHINE}"
|
||||
else
|
||||
docker-machine create -d virtualbox --virtualbox-disk-size 20000 --virtualbox-memory 4096 --virtualbox-cpu-count 2 $1
|
||||
fi
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ alias dib='docker image build'
|
|||
alias dii='docker image inspect'
|
||||
alias dils='docker image ls'
|
||||
alias dipu='docker image push'
|
||||
alias dipru='docker image prune -a'
|
||||
alias dirm='docker image rm'
|
||||
alias dit='docker image tag'
|
||||
alias dkil='docker kill'
|
||||
|
|
@ -18,6 +19,8 @@ alias dni='docker network inspect'
|
|||
alias dnls='docker network ls'
|
||||
alias dnrm='docker network rm'
|
||||
alias dpo='docker container port'
|
||||
alias dps='docker ps'
|
||||
alias dpsa='docker ps -a'
|
||||
alias dpu='docker pull'
|
||||
alias dpsh='docker push'
|
||||
alias dr='docker container run'
|
||||
|
|
@ -54,7 +57,7 @@ if (( ! $+commands[docker] )); then
|
|||
return
|
||||
fi
|
||||
|
||||
# Standarized $0 handling
|
||||
# Standardized $0 handling
|
||||
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
|
||||
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
||||
0="${${(M)0:#/*}:-$PWD/$0}"
|
||||
|
|
@ -75,6 +78,6 @@ fi
|
|||
! is-at-least 23.0.0 ${${(s:,:z)"$(command docker --version)"}[3]}; then
|
||||
command cp "${0:h}/completions/_docker" "$ZSH_CACHE_DIR/completions/_docker"
|
||||
else
|
||||
command docker completion zsh >| "$ZSH_CACHE_DIR/completions/_docker"
|
||||
command docker completion zsh | tee "$ZSH_CACHE_DIR/completions/_docker" > /dev/null
|
||||
fi
|
||||
} &|
|
||||
|
|
|
|||
|
|
@ -1,25 +1,17 @@
|
|||
# This scripts is copied from (MIT License):
|
||||
# https://github.com/dotnet/toolset/blob/master/scripts/register-completions.zsh
|
||||
# https://raw.githubusercontent.com/dotnet/sdk/main/scripts/register-completions.zsh
|
||||
|
||||
_dotnet_zsh_complete()
|
||||
{
|
||||
local completions=("$(dotnet complete "$words")")
|
||||
|
||||
# If the completion list is empty, just continue with filename selection
|
||||
if [ -z "$completions" ]
|
||||
then
|
||||
_arguments '*::arguments: _normal'
|
||||
return
|
||||
fi
|
||||
|
||||
# This is not a variable assignment, don't remove spaces!
|
||||
_values = "${(ps:\n:)completions}"
|
||||
#compdef dotnet
|
||||
_dotnet_completion() {
|
||||
local -a completions=("${(@f)$(dotnet complete "${words}")}")
|
||||
compadd -a completions
|
||||
_files
|
||||
}
|
||||
|
||||
compdef _dotnet_zsh_complete dotnet
|
||||
compdef _dotnet_completion dotnet
|
||||
|
||||
# Aliases bellow are here for backwards compatibility
|
||||
# added by Shaun Tabone (https://github.com/xontab)
|
||||
# added by Shaun Tabone (https://github.com/xontab)
|
||||
|
||||
alias dn='dotnet new'
|
||||
alias dr='dotnet run'
|
||||
|
|
|
|||
|
|
@ -27,4 +27,4 @@ The plugin uses a custom launcher (which we'll call here `$EMACS_LAUNCHER`) that
|
|||
| eeval | `$EMACS_LAUNCHER --eval` | Same as `M-x eval` but from outside Emacs |
|
||||
| eframe | `emacsclient --alternate-editor="" --create-frame` | Create new X frame |
|
||||
| efile | - | Print the path to the file open in the current buffer |
|
||||
| ecd | - | Print the directory of the file open in the the current buffer |
|
||||
| ecd | - | Print the directory of the file open in the current buffer |
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ function efile {
|
|||
}
|
||||
|
||||
# Write to standard output the directory of the file
|
||||
# opened in the the current buffer
|
||||
# opened in the current buffer
|
||||
function ecd {
|
||||
local file
|
||||
file="$(efile)" || return $?
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ unset _omz_emoji_plugin_dir
|
|||
|
||||
# This is a combining character that can be placed after any other character to surround
|
||||
# it in a "keycap" symbol.
|
||||
# The digits 0-9 are already in the emoji table as keycap_digit_<N>, keycap_ten, etc.
|
||||
# The digits 0-9 are already in the emoji table as keycap_digit_<N>, keycap_ten, etc.
|
||||
# It's unclear whether this should be in the $emoji array, because those characters are all ones
|
||||
# which can be displayed on their own.
|
||||
|
||||
|
|
@ -63,9 +63,9 @@ function random_emoji() {
|
|||
[[ $list_size -eq 0 ]] && return 1
|
||||
local random_index=$(( ( RANDOM % $list_size ) + 1 ))
|
||||
local name=${names[$random_index]}
|
||||
if [[ "$group" == "flags" ]]; then
|
||||
if [[ "$group" == "flags" ]]; then
|
||||
echo ${emoji_flags[$name]}
|
||||
else
|
||||
else
|
||||
echo ${emoji[$name]}
|
||||
fi
|
||||
}
|
||||
|
|
@ -86,22 +86,22 @@ function display_emoji() {
|
|||
# terminals treat these emoji chars as single-width.
|
||||
local counter=1
|
||||
for i in $names; do
|
||||
if [[ "$group" == "flags" ]]; then
|
||||
if [[ "$group" == "flags" ]]; then
|
||||
printf '%s ' "$emoji_flags[$i]"
|
||||
else
|
||||
printf '%s ' "$emoji[$i]"
|
||||
else
|
||||
printf '%s ' "$emoji[$i]"
|
||||
fi
|
||||
# New line every 20 emoji, to avoid weirdnesses
|
||||
if (($counter % 20 == 0)); then
|
||||
printf "\n"
|
||||
printf "\n"
|
||||
fi
|
||||
let counter=$counter+1
|
||||
done
|
||||
print
|
||||
for i in $names; do
|
||||
if [[ "$group" == "flags" ]]; then
|
||||
if [[ "$group" == "flags" ]]; then
|
||||
echo "${emoji_flags[$i]} = $i"
|
||||
else
|
||||
else
|
||||
echo "${emoji[$i]} = $i"
|
||||
fi
|
||||
done
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
"""
|
||||
Update Emoji.py
|
||||
Refeshes OMZ emoji database based on the latest Unicode spec
|
||||
Refreshes OMZ emoji database based on the latest Unicode spec
|
||||
"""
|
||||
import re
|
||||
import json
|
||||
|
|
@ -95,7 +95,7 @@ def name_to_omz(_name, _group, _subgroup, _status):
|
|||
shortname = snake_case(_name)
|
||||
# Special treatment by status
|
||||
# Enables us to have every emoji combination,
|
||||
# even the one that are not officially sanctionned
|
||||
# even the one that are not officially sanctioned
|
||||
# and are implemented by, say, only one vendor
|
||||
if _status == "unqualified":
|
||||
shortname += "_unqualified"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
|
||||
# VERSION: 1.0.0
|
||||
# DEPENDS: emoji plugin
|
||||
#
|
||||
#
|
||||
# There are different sets of emoji characters available, to choose a different
|
||||
# set export emotty_set to the name of the set you would like to use, e.g.:
|
||||
# % export emotty_set=nature
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ plugins=(... encode64)
|
|||
|
||||
### Encoding a file
|
||||
|
||||
Encode a file's contents to base64 and save output to text file.
|
||||
Encode a file's contents to base64 and save output to text file.
|
||||
**NOTE:** Takes provided file and saves encoded content as new file with `.txt` extension
|
||||
|
||||
- From parameter
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ encodefile64() {
|
|||
if [[ $# -eq 0 ]]; then
|
||||
echo "You must provide a filename"
|
||||
else
|
||||
base64 -i $1 -o $1.txt
|
||||
base64 $1 > $1.txt
|
||||
echo "${1}'s content encoded in base64 and saved as ${1}.txt"
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ plugins=(... extract)
|
|||
| `tlz` | Tarball with lzma compression |
|
||||
| `txz` | Tarball with lzma2 compression |
|
||||
| `tzst` | Tarball with zstd compression |
|
||||
| `vsix` | VS Code extension zip file |
|
||||
| `war` | Web Application archive (Java-based) |
|
||||
| `whl` | Python wheel file |
|
||||
| `xpi` | Mozilla XPI module file |
|
||||
|
|
|
|||
|
|
@ -1,7 +1,54 @@
|
|||
#compdef extract
|
||||
#autoload
|
||||
|
||||
local -a exts=(
|
||||
7z
|
||||
aar
|
||||
apk
|
||||
bz2
|
||||
cab
|
||||
cpio
|
||||
crx
|
||||
deb
|
||||
ear
|
||||
gz
|
||||
ipa
|
||||
ipsw
|
||||
jar
|
||||
lrz
|
||||
lz4
|
||||
lzma
|
||||
obscpio
|
||||
rar
|
||||
rpm
|
||||
sublime-package
|
||||
tar
|
||||
tar.bz2
|
||||
tar.gz
|
||||
tar.lrz
|
||||
tar.lz
|
||||
tar.lz4
|
||||
tar.xz
|
||||
tar.zma
|
||||
tar.zst
|
||||
tbz
|
||||
tbz2
|
||||
tgz
|
||||
tlz
|
||||
txz
|
||||
tzst
|
||||
vsix
|
||||
war
|
||||
whl
|
||||
xpi
|
||||
xz
|
||||
Z
|
||||
zip
|
||||
zpaq
|
||||
zst
|
||||
)
|
||||
|
||||
_arguments \
|
||||
'(-r --remove)'{-r,--remove}'[Remove archive.]' \
|
||||
"*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|cab|cpio|deb|ear|gz|ipa|ipsw|jar|lrz|lz4|lzma|obscpio|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lrz|tar.lz|tar.lz4|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst|zpaq)(-.)'" \
|
||||
"*::archive file:_files -g '(#i)*.(${(j:|:)exts})(-.)'" \
|
||||
&& return 0
|
||||
|
|
|
|||
|
|
@ -30,6 +30,11 @@ EOF
|
|||
local file="$1" full_path="${1:A}"
|
||||
local extract_dir="${1:t:r}"
|
||||
|
||||
# Remove the .tar extension if the file name is .tar.*
|
||||
if [[ $extract_dir =~ '\.tar$' ]]; then
|
||||
extract_dir="${extract_dir:r}"
|
||||
fi
|
||||
|
||||
# If there's a file or directory with the same name as the archive
|
||||
# add a random string to the end of the extract directory
|
||||
if [[ -e "$extract_dir" ]]; then
|
||||
|
|
@ -64,25 +69,25 @@ EOF
|
|||
(*.tar.lz) (( $+commands[lzip] )) && tar xvf "$full_path" ;;
|
||||
(*.tar.lz4) lz4 -c -d "$full_path" | tar xvf - ;;
|
||||
(*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$full_path" ;;
|
||||
(*.gz) (( $+commands[pigz] )) && pigz -dk "$full_path" || gunzip -k "$full_path" ;;
|
||||
(*.bz2) bunzip2 "$full_path" ;;
|
||||
(*.gz) (( $+commands[pigz] )) && pigz -cdk "$full_path" > "${file:t:r}" || gunzip -ck "$full_path" > "${file:t:r}" ;;
|
||||
(*.bz2) (( $+commands[pbzip2] )) && pbzip2 -d "$full_path" || bunzip2 "$full_path" ;;
|
||||
(*.xz) unxz "$full_path" ;;
|
||||
(*.lrz) (( $+commands[lrunzip] )) && lrunzip "$full_path" ;;
|
||||
(*.lz4) lz4 -d "$full_path" ;;
|
||||
(*.lzma) unlzma "$full_path" ;;
|
||||
(*.z) uncompress "$full_path" ;;
|
||||
(*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl) unzip "$full_path" ;;
|
||||
(*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl|*.vsix|*.crx) unzip "$full_path" ;;
|
||||
(*.rar) unrar x -ad "$full_path" ;;
|
||||
(*.rpm)
|
||||
rpm2cpio "$full_path" | cpio --quiet -id ;;
|
||||
(*.7z) 7za x "$full_path" ;;
|
||||
(*.7z | *.7z.[0-9]*) 7za x "$full_path" ;;
|
||||
(*.deb)
|
||||
command mkdir -p "control" "data"
|
||||
ar vx "$full_path" > /dev/null
|
||||
builtin cd -q control; extract ../control.tar.*
|
||||
builtin cd -q ../data; extract ../data.tar.*
|
||||
builtin cd -q ..; command rm *.tar.* debian-binary ;;
|
||||
(*.zst) unzstd "$full_path" ;;
|
||||
(*.zst) unzstd --stdout "$full_path" > "${file:t:r}" ;;
|
||||
(*.cab|*.exe) cabextract "$full_path" ;;
|
||||
(*.cpio|*.obscpio) cpio -idmvF "$full_path" ;;
|
||||
(*.zpaq) zpaq x "$full_path" ;;
|
||||
|
|
@ -106,19 +111,19 @@ EOF
|
|||
# - Y2: at most give 2 files
|
||||
local -a content
|
||||
content=("${extract_dir}"/*(DNY2))
|
||||
if [[ ${#content} -eq 1 && -d "${content[1]}" ]]; then
|
||||
# The extracted folder (${content[1]}) may have the same name as $extract_dir
|
||||
if [[ ${#content} -eq 1 && -e "${content[1]}" ]]; then
|
||||
# The extracted file/folder (${content[1]}) may have the same name as $extract_dir
|
||||
# If so, we need to rename it to avoid conflicts in a 3-step process
|
||||
#
|
||||
# 1. Move and rename the extracted folder to a temporary random name
|
||||
# 1. Move and rename the extracted file/folder to a temporary random name
|
||||
# 2. Delete the empty folder
|
||||
# 3. Rename the extracted folder to the original name
|
||||
# 3. Rename the extracted file/folder to the original name
|
||||
if [[ "${content[1]:t}" == "$extract_dir" ]]; then
|
||||
# =(:) gives /tmp/zsh<random>, with :t it gives zsh<random>
|
||||
local tmp_dir==(:); tmp_dir="${tmp_dir:t}"
|
||||
command mv "${content[1]}" "$tmp_dir" \
|
||||
local tmp_name==(:); tmp_name="${tmp_name:t}"
|
||||
command mv "${content[1]}" "$tmp_name" \
|
||||
&& command rmdir "$extract_dir" \
|
||||
&& command mv "$tmp_dir" "$extract_dir"
|
||||
&& command mv "$tmp_name" "$extract_dir"
|
||||
# Otherwise, if the extracted folder name already exists in the current
|
||||
# directory (because of a previous file / folder), keep the extract_dir
|
||||
elif [[ ! -e "${content[1]:t}" ]]; then
|
||||
|
|
|
|||
121
plugins/eza/README.md
Normal file
121
plugins/eza/README.md
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
# eza plugin
|
||||
|
||||
This provides aliases that invoke the [`eza`](https://github.com/eza-community/eza) utility rather than `ls`
|
||||
|
||||
To use it add `eza` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... eza)
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
All configurations are done using the `zstyle` command in the `:omz:plugins:eza` namespace.
|
||||
|
||||
**NOTE:** The configuring needs to be done prior to OMZ loading the plugins. When the plugin is loaded,
|
||||
changing the `zstyle` won't have any effect.
|
||||
|
||||
### `dirs-first`
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:eza' 'dirs-first' yes|no
|
||||
```
|
||||
|
||||
If `yes`, directories will be grouped first.
|
||||
|
||||
Default: `no`
|
||||
|
||||
### `git-status`
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:eza' 'git-status' yes|no
|
||||
```
|
||||
|
||||
If `yes`, always add `--git` flag to indicate git status (if tracked / in a git repo).
|
||||
|
||||
Default: `no`
|
||||
|
||||
### `header`
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:eza' 'header' yes|no
|
||||
```
|
||||
|
||||
If `yes`, always add `-h` flag to add a header row for each column.
|
||||
|
||||
Default: `no`
|
||||
|
||||
### `show-group`
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:eza' 'show-group' yes|no
|
||||
```
|
||||
|
||||
If `yes` (default), always add `-g` flag to show the group ownership.
|
||||
|
||||
Default: `yes`
|
||||
|
||||
### `icons`
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:eza' 'icons' yes|no
|
||||
```
|
||||
|
||||
If `yes`, sets the `--icons` option of `eza`, adding icons for files and folders.
|
||||
|
||||
Default: `no`
|
||||
|
||||
### `size-prefix`
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:eza' 'size-prefix' (binary|none|si)
|
||||
```
|
||||
|
||||
Choose the prefix to be used in displaying file size:
|
||||
|
||||
- `binary` -- use [binary prefixes](https://en.wikipedia.org/wiki/Binary_prefix) such as "Ki", "Mi", "Gi" and
|
||||
so on
|
||||
- `none` -- don't use any prefix, show size in bytes
|
||||
- `si` (default) -- use [Metric/S.I. prefixes](https://en.wikipedia.org/wiki/Metric_prefix)
|
||||
|
||||
Default: `si`
|
||||
|
||||
### `time-style`
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:eza' 'time-style' $TIME_STYLE
|
||||
```
|
||||
|
||||
Sets the `--time-style` option of `eza`. (See `man eza` for the options)
|
||||
|
||||
Default: Not set, which means the default behavior of `eza` will take place.
|
||||
|
||||
### `hyperlink`
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:eza' 'hyperlink' yes|no
|
||||
```
|
||||
|
||||
If `yes`, always add `--hyperlink` flag to create hyperlink with escape codes.
|
||||
|
||||
Default: `no`
|
||||
|
||||
## Aliases
|
||||
|
||||
**Notes:**
|
||||
|
||||
- Aliases may be modified by Configuration
|
||||
- The term "files" without "only" qualifier means both files & directories
|
||||
|
||||
| Alias | Command | Description |
|
||||
| ------ | ----------------- | -------------------------------------------------------------------------- |
|
||||
| `la` | `eza -la` | List all files (except . and ..) as a long list |
|
||||
| `ldot` | `eza -ld .*` | List dotfiles only (directories shown as entries instead of recursed into) |
|
||||
| `lD` | `eza -lD` | List only directories (excluding dotdirs) as a long list |
|
||||
| `lDD` | `eza -laD` | List only directories (including dotdirs) as a long list |
|
||||
| `ll` | `eza -l` | List files as a long list |
|
||||
| `ls` | `eza` | Plain eza call |
|
||||
| `lsd` | `eza -d` | List specified files with directories as entries, in a grid |
|
||||
| `lsdl` | `eza -dl` | List specified files with directories as entries, in a long list |
|
||||
| `lS` | `eza -l -ssize` | List files as a long list, sorted by size |
|
||||
| `lT` | `eza -l -snewest` | List files as a long list, sorted by date (newest last) |
|
||||
68
plugins/eza/eza.plugin.zsh
Normal file
68
plugins/eza/eza.plugin.zsh
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
if ! (( $+commands[eza] )); then
|
||||
print "zsh eza plugin: eza not found. Please install eza before using this plugin." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
typeset -a _EZA_HEAD
|
||||
typeset -a _EZA_TAIL
|
||||
|
||||
function _configure_eza() {
|
||||
local _val
|
||||
# Get the head flags
|
||||
if zstyle -T ':omz:plugins:eza' 'show-group'; then
|
||||
_EZA_HEAD+=("g")
|
||||
fi
|
||||
if zstyle -t ':omz:plugins:eza' 'header'; then
|
||||
_EZA_HEAD+=("h")
|
||||
fi
|
||||
zstyle -s ':omz:plugins:eza' 'size-prefix' _val
|
||||
case "${_val:l}" in
|
||||
binary)
|
||||
_EZA_HEAD+=("b")
|
||||
;;
|
||||
none)
|
||||
_EZA_HEAD+=("B")
|
||||
;;
|
||||
esac
|
||||
# Get the tail long-options
|
||||
if zstyle -t ':omz:plugins:eza' 'dirs-first'; then
|
||||
_EZA_TAIL+=("--group-directories-first")
|
||||
fi
|
||||
if zstyle -t ':omz:plugins:eza' 'git-status'; then
|
||||
_EZA_TAIL+=("--git")
|
||||
fi
|
||||
if zstyle -t ':omz:plugins:eza' 'icons'; then
|
||||
_EZA_TAIL+=("--icons=auto")
|
||||
fi
|
||||
zstyle -s ':omz:plugins:eza' 'time-style' _val
|
||||
if [[ $_val ]]; then
|
||||
_EZA_TAIL+=("--time-style='$_val'")
|
||||
fi
|
||||
if zstyle -t ":omz:plugins:eza" "hyperlink"; then
|
||||
_EZA_TAIL+=("--hyperlink")
|
||||
fi
|
||||
}
|
||||
|
||||
_configure_eza
|
||||
|
||||
function _alias_eza() {
|
||||
local _head="${(j::)_EZA_HEAD}$2"
|
||||
local _tail="${(j: :)_EZA_TAIL}"
|
||||
alias "$1"="eza${_head:+ -}${_head}${_tail:+ }${_tail}${3:+ }$3"
|
||||
}
|
||||
|
||||
_alias_eza la la
|
||||
_alias_eza ldot ld ".*"
|
||||
_alias_eza lD lD
|
||||
_alias_eza lDD lDa
|
||||
_alias_eza ll l
|
||||
_alias_eza ls
|
||||
_alias_eza lsd d
|
||||
_alias_eza lsdl dl
|
||||
_alias_eza lS "l -ssize"
|
||||
_alias_eza lT "l -snewest"
|
||||
|
||||
unfunction _alias_eza
|
||||
unfunction _configure_eza
|
||||
unset _EZA_HEAD
|
||||
unset _EZA_TAIL
|
||||
|
|
@ -1,14 +1,24 @@
|
|||
# Use Ctrl-Z to switch back to Vim
|
||||
# fancy-ctrl-z
|
||||
|
||||
I frequently need to execute random commands in my shell. To achieve it I pause
|
||||
Allows pressing Ctrl-Z again to switch back to a background job.
|
||||
|
||||
To use it, add `fancy-ctrl-z` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... fancy-ctrl-z)
|
||||
```
|
||||
|
||||
## Motivation
|
||||
|
||||
I frequently need to execute random commands in my shell. To achieve it I pause
|
||||
Vim by pressing Ctrl-z, type command and press fg<Enter> to switch back to Vim.
|
||||
The fg part really hurts me. I just wanted to hit Ctrl-z once again to get back
|
||||
to Vim. I could not find a solution, so I developed one on my own that
|
||||
The fg part really hurts me. I just wanted to hit Ctrl-z once again to get back
|
||||
to Vim. I could not find a solution, so I developed one on my own that
|
||||
works wonderfully with ZSH.
|
||||
|
||||
Source: http://sheerun.net/2014/03/21/how-to-boost-your-vim-productivity/
|
||||
|
||||
Credits:
|
||||
Credits:
|
||||
- original idea by @sheerun
|
||||
- added to OMZ by @mbologna
|
||||
|
||||
|
|
|
|||
|
|
@ -71,13 +71,13 @@ them, add `<variable>=<value>` to your zshrc file, before Oh My Zsh is sourced.
|
|||
For example: `fastfile_var_prefix='@'`.
|
||||
|
||||
- `fastfile_var_prefix`: prefix for the global aliases created. Controls the prefix of the
|
||||
created global aliases.
|
||||
created global aliases.
|
||||
**Default:** `§` (section sign), easy to type in a german keyboard via the combination
|
||||
[`⇧ Shift`+`3`](https://en.wikipedia.org/wiki/German_keyboard_layout#/media/File:KB_Germany.svg),
|
||||
or using `⌥ Option`+`6` in macOS.
|
||||
|
||||
- `fastfile_dir`: directory where the fastfile shortcuts are stored. Needs to end
|
||||
with a trailing slash.
|
||||
with a trailing slash.
|
||||
**Default:** `$HOME/.fastfile/`.
|
||||
|
||||
## Author
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
# If they are not set yet, they will be
|
||||
# overwritten with their default values
|
||||
|
||||
default fastfile_dir "${HOME}/.fastfile"
|
||||
default fastfile_var_prefix "§"
|
||||
fastfile_dir="${fastfile_dir:-${HOME}/.fastfile}"
|
||||
fastfile_var_prefix="${fastfile_var_prefix:-§}"
|
||||
|
||||
###########################
|
||||
# Impl
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
# fd
|
||||
|
||||
This plugin adds completion for the file search tool [`fd`](https://github.com/sharkdp/fd), also known as `fd-find`.
|
||||
|
||||
To use it, add `fd` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... fd)
|
||||
```
|
||||
273
plugins/fd/_fd
273
plugins/fd/_fd
|
|
@ -1,273 +0,0 @@
|
|||
#compdef fd
|
||||
|
||||
##
|
||||
# zsh completion function for fd
|
||||
#
|
||||
# Based on ripgrep completion function.
|
||||
# Originally based on code from the zsh-users project — see copyright notice
|
||||
# below.
|
||||
|
||||
autoload -U is-at-least
|
||||
|
||||
_fd() {
|
||||
local curcontext="$curcontext" no='!' ret=1
|
||||
local -a context line state state_descr _arguments_options fd_types fd_args
|
||||
local -A opt_args
|
||||
|
||||
if is-at-least 5.2; then
|
||||
_arguments_options=( -s -S )
|
||||
else
|
||||
_arguments_options=( -s )
|
||||
fi
|
||||
|
||||
fd_types=(
|
||||
{f,file}'\:"regular files"'
|
||||
{d,directory}'\:"directories"'
|
||||
{l,symlink}'\:"symbolic links"'
|
||||
{e,empty}'\:"empty files or directories"'
|
||||
{x,executable}'\:"executable (files)"'
|
||||
{s,socket}'\:"sockets"'
|
||||
{p,pipe}'\:"named pipes (FIFOs)"'
|
||||
)
|
||||
|
||||
# Do not complete rare options unless either the current prefix
|
||||
# matches one of those options or the user has the `complete-all`
|
||||
# style set. Note that this prefix check has to be updated manually to account
|
||||
# for all of the potential negation options listed below!
|
||||
if
|
||||
# (--[bpsu]* => match all options marked with '$no')
|
||||
[[ $PREFIX$SUFFIX == --[bopsu]* ]] ||
|
||||
zstyle -t ":complete:$curcontext:*" complete-all
|
||||
then
|
||||
no=
|
||||
fi
|
||||
|
||||
# We make heavy use of argument groups here to prevent the option specs from
|
||||
# growing unwieldy. These aren't supported in zsh <5.4, though, so we'll strip
|
||||
# them out below if necessary. This makes the exclusions inaccurate on those
|
||||
# older versions, but oh well — it's not that big a deal
|
||||
fd_args=(
|
||||
+ '(hidden)' # hidden files
|
||||
{-H,--hidden}'[search hidden files/directories]'
|
||||
|
||||
+ '(no-ignore-full)' # all ignore files
|
||||
'(no-ignore-partial)'{-I,--no-ignore}"[don't respect .(git|fd)ignore and global ignore files]"
|
||||
$no'(no-ignore-partial)*'{-u,--unrestricted}'[alias for --no-ignore, when repeated also alias for --hidden]'
|
||||
|
||||
+ no-ignore-partial # some ignore files
|
||||
"(no-ignore-full --no-ignore-vcs)--no-ignore-vcs[don't respect .gitignore files]"
|
||||
"!(no-ignore-full --no-global-ignore-file)--no-global-ignore-file[don't respect the global ignore file]"
|
||||
$no'(no-ignore-full --no-ignore-parent)--no-ignore-parent[]'
|
||||
|
||||
+ '(case)' # case-sensitivity
|
||||
{-s,--case-sensitive}'[perform a case-sensitive search]'
|
||||
{-i,--ignore-case}'[perform a case-insensitive search]'
|
||||
|
||||
+ '(regex-pattern)' # regex-based search pattern
|
||||
'(no-regex-pattern)--regex[perform a regex-based search (default)]'
|
||||
|
||||
+ '(no-regex-pattern)' # non-regex-based search pattern
|
||||
{-g,--glob}'[perform a glob-based search]'
|
||||
{-F,--fixed-strings}'[treat pattern as literal string instead of a regex]'
|
||||
|
||||
+ '(match-full)' # match against full path
|
||||
{-p,--full-path}'[match the pattern against the full path instead of the basename]'
|
||||
|
||||
+ '(follow)' # follow symlinks
|
||||
{-L,--follow}'[follow symbolic links to directories]'
|
||||
|
||||
+ '(abs-path)' # show absolute paths
|
||||
'(long-listing)'{-a,--absolute-path}'[show absolute paths instead of relative paths]'
|
||||
|
||||
+ '(null-sep)' # use null separator for output
|
||||
'(long-listing)'{-0,--print0}'[separate search results by the null character]'
|
||||
|
||||
+ '(long-listing)' # long-listing output
|
||||
'(abs-path null-sep max-results exec-cmds)'{-l,--list-details}'[use a long listing format with file metadata]'
|
||||
|
||||
+ '(max-results)' # max number of results
|
||||
'(long-listing exec-cmds)--max-results=[limit number of search results to given count and quit]:count'
|
||||
'(long-listing exec-cmds)-1[limit to a single search result and quit]'
|
||||
|
||||
+ '(fs-errors)' # file-system errors
|
||||
$no'--show-errors[enable the display of filesystem errors]'
|
||||
|
||||
+ '(fs-traversal)' # file-system traversal
|
||||
$no"--one-file-system[don't descend into directories on other file systems]"
|
||||
'!--mount'
|
||||
'!--xdev'
|
||||
|
||||
+ dir-depth # directory depth
|
||||
'(--exact-depth -d --max-depth)'{-d+,--max-depth=}'[set max directory depth to descend when searching]:depth'
|
||||
'!(--exact-depth -d --max-depth)--maxdepth:depth'
|
||||
'(--exact-depth --min-depth)--min-depth=[set directory depth to descend before start searching]:depth'
|
||||
'(--exact-depth -d --max-depth --maxdepth --min-depth)--exact-depth=[only search at the exact given directory depth]:depth'
|
||||
|
||||
+ prune # pruning
|
||||
"--prune[don't traverse into matching directories]"
|
||||
|
||||
+ filter-misc # filter search
|
||||
'*'{-t+,--type=}"[filter search by type]:type:(($fd_types))"
|
||||
'*'{-e+,--extension=}'[filter search by file extension]:extension'
|
||||
'*'{-E+,--exclude=}'[exclude files/directories that match the given glob pattern]:glob pattern'
|
||||
'*'{-S+,--size=}'[limit search by file size]:size limit:->size'
|
||||
'(-o --owner)'{-o+,--owner=}'[filter by owning user and/or group]:owner and/or group:->owner'
|
||||
|
||||
+ ignore-file # extra ignore files
|
||||
'*--ignore-file=[add a custom, low-precedence ignore-file with .gitignore format]: :_files'
|
||||
|
||||
+ '(filter-mtime-newer)' # filter by files modified after than
|
||||
'--changed-within=[limit search to files/directories modified within the given date/duration]:date or duration'
|
||||
'!--change-newer-than=:date/duration'
|
||||
'!--newer=:date/duration'
|
||||
|
||||
+ '(filter-mtime-older)' # filter by files modified before than
|
||||
'--changed-before=[limit search to files/directories modified before the given date/duration]:date or duration'
|
||||
'!--change-older-than=:date/duration'
|
||||
'!--older=:date/duration'
|
||||
|
||||
+ '(color)' # colorize output
|
||||
{-c+,--color=}'[declare when to colorize search results]:when to colorize:((
|
||||
auto\:"show colors if the output goes to an interactive console (default)"
|
||||
never\:"do not use colorized output"
|
||||
always\:"always use colorized output"
|
||||
))'
|
||||
|
||||
+ '(threads)'
|
||||
{-j+,--threads=}'[set the number of threads for searching and executing]:number of threads'
|
||||
|
||||
+ '(exec-cmds)' # execute command
|
||||
'(long-listing max-results)'{-x+,--exec=}'[execute command for each search result]:command: _command_names -e:*\;::program arguments: _normal'
|
||||
'(long-listing max-results)'{-X+,--exec-batch=}'[execute command for all search results at once]:command: _command_names -e:*\;::program arguments: _normal'
|
||||
'(long-listing max-results)--batch-size=[max number of args for each -X call]:size'
|
||||
|
||||
+ other
|
||||
'!(--max-buffer-time)--max-buffer-time=[set amount of time to buffer before showing output]:time (ms)'
|
||||
|
||||
+ '(about)' # about flags
|
||||
'(: * -)'{-h,--help}'[display help message]'
|
||||
'(: * -)'{-v,--version}'[display version information]'
|
||||
|
||||
+ path-sep # set path separator for output
|
||||
$no'(--path-separator)--path-separator=[set the path separator to use when printing file paths]:path separator'
|
||||
|
||||
+ search-path
|
||||
$no'(--base-directory)--base-directory=[change the current working directory to the given path]:directory:_files -/'
|
||||
$no'(*)*--search-path=[set search path (instead of positional <path> arguments)]:directory:_files -/'
|
||||
|
||||
+ strip-cwd-prefix
|
||||
$no'(strip-cwd-prefix exec-cmds)--strip-cwd-prefix[Strip ./ prefix when output is redirected]'
|
||||
|
||||
+ args # positional arguments
|
||||
'1: :_guard "^-*" pattern'
|
||||
'(--search-path)*:directory:_files -/'
|
||||
)
|
||||
|
||||
# Strip out argument groups where unsupported (see above)
|
||||
is-at-least 5.4 ||
|
||||
fd_args=( ${(@)args:#(#i)(+|[a-z0-9][a-z0-9_-]#|\([a-z0-9][a-z0-9_-]#\))} )
|
||||
|
||||
_arguments $_arguments_options : $fd_args && ret=0
|
||||
|
||||
case ${state} in
|
||||
owner)
|
||||
compset -P '(\\|)\!'
|
||||
if compset -P '*:'; then
|
||||
_groups && ret=0
|
||||
else
|
||||
if
|
||||
compset -S ':*' ||
|
||||
# Do not add the colon suffix when completing "!user<TAB>
|
||||
# (with a starting double-quote) otherwise pressing tab again
|
||||
# after the inserted colon "!user:<TAB> will complete history modifiers
|
||||
[[ $IPREFIX == (\\|\!)* && ($QIPREFIX == \"* && -z $QISUFFIX) ]]
|
||||
then
|
||||
_users && ret=0
|
||||
else
|
||||
local q
|
||||
# Since quotes are needed when using the negation prefix !,
|
||||
# automatically remove the colon suffix also when closing the quote
|
||||
if [[ $QIPREFIX == [\'\"]* ]]; then
|
||||
q=${QIPREFIX:0:1}
|
||||
fi
|
||||
_users -r ": \t\n\-$q" -S : && ret=0
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
size)
|
||||
if compset -P '[-+][0-9]##'; then
|
||||
local -a suff=(
|
||||
'B:bytes'
|
||||
'K:kilobytes (10^3 = 1000 bytes)'
|
||||
'M:megabytes (10^6 = 1000^2 bytes)'
|
||||
'G:gigabytes (10^9 = 1000^3 bytes)'
|
||||
'T:terabytes (10^12 = 1000^4 bytes)'
|
||||
'Ki:kibibytes ( 2^10 = 1024 bytes)'
|
||||
'Mi:mebibytes ( 2^20 = 1024^2 bytes)'
|
||||
'Gi:gigibytes ( 2^30 = 1024^3 bytes)'
|
||||
'Ti:tebibytes ( 2^40 = 1024^4 bytes)'
|
||||
)
|
||||
_describe -t units 'size limit units' suff -V 'units'
|
||||
elif compset -P '[-+]'; then
|
||||
_message -e 'size limit number (full format: <+-><number><unit>)'
|
||||
else
|
||||
_values 'size limit prefix (full format: <prefix><number><unit>)' \
|
||||
'\+[file size must be greater or equal to]'\
|
||||
'-[file size must be less than or equal to]' && ret=0
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
_fd "$@"
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Copyright (c) 2011 GitHub zsh-users - http://github.com/zsh-users
|
||||
# All rights reserved.
|
||||
#
|
||||
# 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 fd
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * smancill (https://github.com/smancill)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# coding: utf-8-unix
|
||||
# indent-tabs-mode: nil
|
||||
# sh-indentation: 2
|
||||
# sh-basic-offset: 2
|
||||
# End:
|
||||
# vim: ft=zsh sw=2 ts=2 et
|
||||
|
|
@ -9,7 +9,7 @@ function fwl () {
|
|||
zones=("${(@f)$(sudo firewall-cmd --get-active-zones | grep -v 'interfaces\|sources')}")
|
||||
|
||||
for i in $zones; do
|
||||
sudo firewall-cmd --zone $i --list-all
|
||||
sudo firewall-cmd --zone ${i/ \(default\)} --list-all
|
||||
done
|
||||
|
||||
echo 'Direct Rules:'
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
# Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
|
||||
# Updated to support ForkLift 2 and ForkLift 3 by Johan Kaving
|
||||
# Updated to support ForkLift from Setapp by Paul Rudkin
|
||||
# Updated to support ForkLift 4 by Michal Szymanski (misiektoja)
|
||||
#
|
||||
# Usage:
|
||||
# fl [<folder>]
|
||||
|
|
@ -58,7 +59,7 @@ function fl {
|
|||
tell application forkLiftSetapp
|
||||
activate
|
||||
set forkLiftVersion to version
|
||||
end tell
|
||||
end tell
|
||||
else if forkLift3 is not null and application forkLift3 is running then
|
||||
tell application forkLift3
|
||||
activate
|
||||
|
|
@ -84,7 +85,7 @@ function fl {
|
|||
else if forkLift is not null then
|
||||
set appName to forkLift
|
||||
end if
|
||||
|
||||
|
||||
tell application appName
|
||||
activate
|
||||
set forkLiftVersion to version
|
||||
|
|
@ -110,6 +111,11 @@ function fl {
|
|||
tell pop over of list of group of splitter group of splitter group of topWindow
|
||||
set value of text field 1 to "$PWD"
|
||||
end tell
|
||||
else if forkLiftVersion starts with "4" then
|
||||
tell pop over of list of group of splitter group of splitter group of topWindow
|
||||
keystroke "$PWD"
|
||||
delay 0.1
|
||||
end tell
|
||||
else
|
||||
tell sheet 1 of topWindow
|
||||
set value of text field 1 to "$PWD"
|
||||
|
|
|
|||
|
|
@ -60,12 +60,22 @@ Available search contexts are:
|
|||
| typescript | `https://google.com/search?as_sitesearch=www.typescriptlang.org/docs&as_q=` |
|
||||
| unheap | `http://www.unheap.com/?s=` |
|
||||
| vuejs | `https://www.google.com/search?as_sitesearch=vuejs.org&as_q=` |
|
||||
| nextjs | `https://www.google.com/search?as_sitesearch=nextjs.org&as_q=` |
|
||||
|
||||
If you want to have another context, open an Issue and tell us!
|
||||
|
||||
## Fallback search behaviour
|
||||
|
||||
The plugin will use Google as a fallback if the docs site for a search context does not have a search function. You can set the fallback search engine to DuckDuckGo by setting `FRONTEND_SEARCH_FALLBACK='duckduckgo'` in your `~/.zshrc` file before Oh My Zsh is sourced.
|
||||
The plugin will use Google as a fallback if the docs site for a search context does not have a search
|
||||
function. You can set the fallback search engine to DuckDuckGo by setting
|
||||
`FRONTEND_SEARCH_FALLBACK='duckduckgo'` in your `~/.zshrc` file before Oh My Zsh is sourced.
|
||||
|
||||
## DuckDuckGo Lucky Search
|
||||
|
||||
Enable DuckDuckGo's "ducky" (lucky) search feature to automatically access the top search result. This feature
|
||||
is optimized for DuckDuckGo, as Google redirects to an intermediate page. The FRONTEND_SEARCH_FALLBACK_LUCKY
|
||||
environment variable triggers the use of DuckDuckGo's lucky search, rendering the FRONTEND_SEARCH_FALLBACK
|
||||
setting unnecessary in this context.
|
||||
|
||||
## Author
|
||||
|
||||
|
|
|
|||
|
|
@ -27,12 +27,19 @@ alias stackoverflow='frontend stackoverflow'
|
|||
alias typescript='frontend typescript'
|
||||
alias unheap='frontend unheap'
|
||||
alias vuejs='frontend vuejs'
|
||||
alias nextjs='frontend nextjs'
|
||||
|
||||
function _frontend_fallback() {
|
||||
case "$FRONTEND_SEARCH_FALLBACK" in
|
||||
duckduckgo) echo "https://duckduckgo.com/?sites=$1&q=" ;;
|
||||
*) echo "https://google.com/search?as_sitesearch=$1&as_q=" ;;
|
||||
esac
|
||||
if [[ "$FRONTEND_SEARCH_FALLBACK_LUCKY" == "true" ]]; then
|
||||
case true in
|
||||
*) echo "https://duckduckgo.com/?q=!ducky+site%3A$1+" ;;
|
||||
esac
|
||||
else
|
||||
case "$FRONTEND_SEARCH_FALLBACK" in
|
||||
duckduckgo) echo "https://duckduckgo.com/?sites=$1&q=" ;;
|
||||
*) echo "https://google.com/search?as_sitesearch=$1&as_q=" ;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
function frontend() {
|
||||
|
|
@ -70,6 +77,7 @@ function frontend() {
|
|||
typescript $(_frontend_fallback 'www.typescriptlang.org/docs')
|
||||
unheap 'http://www.unheap.com/?s='
|
||||
vuejs $(_frontend_fallback 'vuejs.org')
|
||||
nextjs $(_frontend_fallback 'nextjs.org')
|
||||
)
|
||||
|
||||
# show help for command list
|
||||
|
|
@ -81,7 +89,7 @@ function frontend() {
|
|||
print -P ""
|
||||
print -P " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
|
||||
print -P " dartlang, emberjs, fontello, flowtype, github, html5please, jestjs, jquery, lodash,"
|
||||
print -P " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia"
|
||||
print -P " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia, nextjs"
|
||||
print -P ""
|
||||
print -P "For example: frontend npmjs mocha (or just: npmjs mocha)."
|
||||
print -P ""
|
||||
|
|
@ -96,7 +104,7 @@ function frontend() {
|
|||
echo ""
|
||||
echo " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
|
||||
echo " dartlang, emberjs, fontello, github, html5please, jest, jquery, lodash,"
|
||||
echo " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia"
|
||||
echo " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia, nextjs"
|
||||
echo ""
|
||||
return 1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,3 +1,16 @@
|
|||
function fzf_setup_using_fzf() {
|
||||
(( ${+commands[fzf]} )) || return 1
|
||||
|
||||
# we remove "fzf " prefix, this fixes really old fzf versions behaviour
|
||||
# see https://github.com/ohmyzsh/ohmyzsh/issues/12387
|
||||
local fzf_ver=${"$(fzf --version)"#fzf }
|
||||
|
||||
autoload -Uz is-at-least
|
||||
is-at-least 0.48.0 ${${(s: :)fzf_ver}[1]} || return 1
|
||||
|
||||
eval "$(fzf --zsh)"
|
||||
}
|
||||
|
||||
function fzf_setup_using_base_dir() {
|
||||
local fzf_base fzf_shell fzfdirs dir
|
||||
|
||||
|
|
@ -8,6 +21,7 @@ function fzf_setup_using_base_dir() {
|
|||
"${HOME}/.fzf"
|
||||
"${HOME}/.nix-profile/share/fzf"
|
||||
"${XDG_DATA_HOME:-$HOME/.local/share}/fzf"
|
||||
"${MSYSTEM_PREFIX}/share/fzf"
|
||||
"/usr/local/opt/fzf"
|
||||
"/opt/homebrew/opt/fzf"
|
||||
"/usr/share/fzf"
|
||||
|
|
@ -61,7 +75,7 @@ function fzf_setup_using_base_dir() {
|
|||
|
||||
function fzf_setup_using_debian() {
|
||||
if (( ! $+commands[apt] && ! $+commands[apt-get] )); then
|
||||
# Not a debian based distro
|
||||
# Not a debian based distro
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
|
@ -134,6 +148,27 @@ function fzf_setup_using_opensuse() {
|
|||
return 0
|
||||
}
|
||||
|
||||
function fzf_setup_using_fedora() {
|
||||
(( $+commands[fzf] )) || return 1
|
||||
|
||||
local completions="/usr/share/zsh/site-functions/fzf"
|
||||
local key_bindings="/usr/share/fzf/shell/key-bindings.zsh"
|
||||
|
||||
if [[ ! -f "$completions" || ! -f "$key_bindings" ]]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then
|
||||
source "$completions" 2>/dev/null
|
||||
fi
|
||||
|
||||
if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then
|
||||
source "$key_bindings" 2>/dev/null
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
function fzf_setup_using_openbsd() {
|
||||
# openBSD installs fzf in /usr/local/bin/fzf
|
||||
if [[ "$OSTYPE" != openbsd* ]] || (( ! $+commands[fzf] )); then
|
||||
|
|
@ -216,9 +251,11 @@ Please add `export FZF_BASE=/path/to/fzf/install/dir` to your .zshrc
|
|||
EOF
|
||||
}
|
||||
|
||||
fzf_setup_using_openbsd \
|
||||
fzf_setup_using_fzf \
|
||||
|| fzf_setup_using_openbsd \
|
||||
|| fzf_setup_using_debian \
|
||||
|| fzf_setup_using_opensuse \
|
||||
|| fzf_setup_using_fedora \
|
||||
|| fzf_setup_using_cygwin \
|
||||
|| fzf_setup_using_macports \
|
||||
|| fzf_setup_using_base_dir \
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Gas plugin
|
||||
|
||||
This plugin adds autocompletion for the [gas](http://walle.github.com/gas) command,
|
||||
This plugin adds autocompletion for the [gas](http://ramblingsby.me/gas/) command,
|
||||
a utility to manage Git authors.
|
||||
|
||||
To use it, add `gas` to the plugins array of your zshrc file:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# gatsby autocomplete plugin
|
||||
|
||||
* Adds autocomplete options for all gatsby commands.
|
||||
Adds autocomplete options for all gatsby commands.
|
||||
|
||||
## Requirements
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
|
|||
"/usr/local/share/google-cloud-sdk"
|
||||
"/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
|
||||
"/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk"
|
||||
"/opt/homebrew/share/google-cloud-sdk"
|
||||
"/usr/share/google-cloud-sdk"
|
||||
"/snap/google-cloud-sdk/current"
|
||||
"/snap/google-cloud-cli/current"
|
||||
|
|
@ -17,6 +18,7 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
|
|||
"/opt/google-cloud-sdk"
|
||||
"/opt/google-cloud-cli"
|
||||
"/opt/local/libexec/google-cloud-sdk"
|
||||
"$HOME/.asdf/installs/gcloud/*/"
|
||||
)
|
||||
|
||||
for gcloud_sdk_location in $search_locations; do
|
||||
|
|
@ -29,11 +31,9 @@ if [[ -z "${CLOUDSDK_HOME}" ]]; then
|
|||
fi
|
||||
|
||||
if (( ${+CLOUDSDK_HOME} )); then
|
||||
# Only source this if gcloud isn't already on the path
|
||||
if (( ! $+commands[gcloud] )); then
|
||||
if [[ -f "${CLOUDSDK_HOME}/path.zsh.inc" ]]; then
|
||||
source "${CLOUDSDK_HOME}/path.zsh.inc"
|
||||
fi
|
||||
# Source path file
|
||||
if [[ -f "${CLOUDSDK_HOME}/path.zsh.inc" ]]; then
|
||||
source "${CLOUDSDK_HOME}/path.zsh.inc"
|
||||
fi
|
||||
|
||||
# Look for completion file in different paths
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue