Merge branch 'ohmyzsh:master' into recursive_dotenv

This commit is contained in:
Heitor Polidoro 2024-05-22 15:00:38 -03:00 committed by GitHub
commit af3825e13e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
123 changed files with 1323 additions and 629 deletions

View file

@ -28,6 +28,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)

View file

@ -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."

View file

@ -13,7 +13,9 @@ autojump_paths=(
/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

View file

@ -280,7 +280,7 @@ if [[ "$AWS_PROFILE_STATE_ENABLED" == true ]]; then
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"

View file

@ -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%} "
```

View file

@ -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

View 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

View file

@ -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

View 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

View file

@ -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."

View file

@ -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`

View file

@ -11,7 +11,7 @@ _dotnet_completion() {
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'

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -87,7 +87,7 @@ EOF
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" ;;

View file

@ -1,14 +1,14 @@
# Use Ctrl-Z to switch back to Vim
I frequently need to execute random commands in my shell. To achieve it I pause
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

View file

@ -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

View file

@ -58,7 +58,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 +84,7 @@ function fl {
else if forkLift is not null then
set appName to forkLift
end if
tell application appName
activate
set forkLiftVersion to version

View file

@ -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
@ -62,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
@ -135,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
@ -217,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 \

View file

@ -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"

View file

@ -9,6 +9,10 @@ To use it, add `git-prompt` to the plugins array in your zshrc file:
plugins=(... git-prompt)
```
You may also need to [customize your theme](https://github.com/ohmyzsh/ohmyzsh/issues/9395#issuecomment-1027130429)
to change the way the prompt is built. See the
[OMZ wiki on customizing themes](https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-and-adding-themes).
See the [original repository](https://github.com/olivierverdier/zsh-git-prompt).
## Requirements

View file

@ -41,8 +41,8 @@ plugins=(... git)
| `gba` | `git branch --all` |
| `gbd` | `git branch --delete` |
| `gbD` | `git branch --delete --force` |
| `gbgd` | `LANG=C git branch --no-color -vv \| grep ": gone\]" \| awk '"'"'{print $1}'"'"' \| xargs git branch -d` |
| `gbgD` | `LANG=C git branch --no-color -vv \| grep ": gone\]" \| awk '"'"'{print $1}'"'"' \| xargs git branch -D` |
| `gbgd` | `LANG=C git branch --no-color -vv \| grep ": gone\]" \| cut -c 3- \| awk '"'"'{print $1}'"'"' \| xargs git branch -d` |
| `gbgD` | `LANG=C git branch --no-color -vv \| grep ": gone\]" \| cut -c 3- \| awk '"'"'{print $1}'"'"' \| xargs git branch -D` |
| `gbm` | `git branch --move` |
| `gbnm` | `git branch --no-merged` |
| `gbr` | `git branch --remote` |
@ -111,6 +111,7 @@ plugins=(... git)
| `gfg` | `git ls-files \| grep` |
| `gm` | `git merge` |
| `gma` | `git merge --abort` |
| `gmc` | `git merge --continue` |
| `gms` | `git merge --squash` |
| `gmom` | `git merge origin/$(git_main_branch)` |
| `gmum` | `git merge upstream/$(git_main_branch)` |
@ -166,6 +167,7 @@ plugins=(... git)
| `grhk` | `git reset --keep` |
| `grhs` | `git reset --soft` |
| `gpristine` | `git reset --hard && git clean --force -dfx` |
| `gwipe` | `git reset --hard && git clean --force -df` |
| `groh` | `git reset origin/$(git_current_branch) --hard` |
| `grs` | `git restore` |
| `grss` | `git restore --source` |

View file

@ -147,8 +147,8 @@ function gbds() {
done
}
alias gbgd='LANG=C git branch --no-color -vv | grep ": gone\]" | awk '"'"'{print $1}'"'"' | xargs git branch -d'
alias gbgD='LANG=C git branch --no-color -vv | grep ": gone\]" | awk '"'"'{print $1}'"'"' | xargs git branch -D'
alias gbgd='LANG=C git branch --no-color -vv | grep ": gone\]" | cut -c 3- | awk '"'"'{print $1}'"'"' | xargs git branch -d'
alias gbgD='LANG=C git branch --no-color -vv | grep ": gone\]" | cut -c 3- | awk '"'"'{print $1}'"'"' | xargs git branch -D'
alias gbm='git branch --move'
alias gbnm='git branch --no-merged'
alias gbr='git branch --remote'
@ -252,6 +252,7 @@ alias gignored='git ls-files -v | grep "^[[:lower:]]"'
alias gfg='git ls-files | grep'
alias gm='git merge'
alias gma='git merge --abort'
alias gmc='git merge --continue'
alias gms="git merge --squash"
alias gmom='git merge origin/$(git_main_branch)'
alias gmum='git merge upstream/$(git_main_branch)'
@ -349,6 +350,7 @@ alias grhh='git reset --hard'
alias grhk='git reset --keep'
alias grhs='git reset --soft'
alias gpristine='git reset --hard && git clean --force -dfx'
alias gwipe='git reset --hard && git clean --force -df'
alias groh='git reset origin/$(git_current_branch) --hard'
alias grs='git restore'
alias grss='git restore --source'

View file

@ -14,7 +14,7 @@ __gnu_utils() {
local -a gcmds
local gcmd
# coreutils
# coreutils
gcmds=('g[' 'gbase64' 'gbasename' 'gcat' 'gchcon' 'gchgrp' 'gchmod'
'gchown' 'gchroot' 'gcksum' 'gcomm' 'gcp' 'gcsplit' 'gcut' 'gdate'
'gdd' 'gdf' 'gdir' 'gdircolors' 'gdirname' 'gdu' 'gecho' 'genv' 'gexpand'
@ -41,7 +41,7 @@ __gnu_utils() {
for gcmd in "${gcmds[@]}"; do
# Do nothing if the command isn't found
(( ${+commands[$gcmd]} )) || continue
# This method allows for builtin commands to be primary but it's
# lost if hash -r or rehash is executed, or if $PATH is updated.
# Thus, a preexec hook is needed, which will only run if whoami

View file

@ -7,7 +7,7 @@ _enumerateGrailsScripts() {
then
directories+=(plugins/*/scripts)
fi
# Enumerate all of the Groovy files
files=()
for dir in $directories;
@ -17,13 +17,13 @@ _enumerateGrailsScripts() {
files+=($dir/[^_]*.groovy)
fi
done
# Don't try to basename ()
if [ ${#files} -eq 0 ];
then
return
fi
scripts=()
for file in $files
do
@ -42,19 +42,19 @@ _enumerateGrailsScripts() {
done
echo $scripts
}
_grails() {
if (( CURRENT == 2 )); then
scripts=( $(_enumerateGrailsScripts) )
if [ ${#scripts} -ne 0 ];
then
_multi_parts / scripts
return
fi
fi
_files
}
compdef _grails grails

View file

@ -57,13 +57,13 @@ Using [antigen](https://github.com/zsh-users/antigen):
1. Add the `antigen bundle` command just before `antigen apply`, like this:
```
```
antigen bundle zsh-users/zsh-history-substring-search
antigen apply
```
2. Then, **after** `antigen apply`, add the key binding configurations, like this:
```
# zsh-history-substring-search configuration
bindkey '^[[A' history-substring-search-up # or '\eOA'
@ -120,7 +120,7 @@ Usage
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
Users have also observed that `[OA` and `[OB` are correct values,
Users have also observed that `[OA` and `[OB` are correct values,
_even if_ these were not the observed values. If you are having trouble
with the observed values, give these a try.

View file

@ -1,4 +1,4 @@
#compdef http
#compdef http https
# ------------------------------------------------------------------------------
# Copyright (c) 2015 GitHub zsh-users - http://github.com/zsh-users
# All rights reserved.

View file

@ -3,13 +3,13 @@ alias ih="ionic --help"
alias ist="ionic start"
alias ii="ionic info"
alias is="ionic serve"
alias icba="ionic cordova build android"
alias icbi="ionic cordova build ios"
alias icra="ionic cordova run android"
alias icri="ionic cordova run ios"
alias icrsa="ionic cordova resources android"
alias icba="ionic cordova build android"
alias icbi="ionic cordova build ios"
alias icra="ionic cordova run android"
alias icri="ionic cordova run ios"
alias icrsa="ionic cordova resources android"
alias icrsi="ionic cordova resources ios"
alias icpaa="ionic cordova platform add android"
alias icpaa="ionic cordova platform add android"
alias icpai="ionic cordova platform add ios"
alias icpra="ionic cordova platform rm android"
alias icpri="ionic cordova platform rm ios"

View file

@ -9,7 +9,7 @@ plugins=(... iterm2)
```
Optionally, the plugin also applies the [Shell Integration Script for iTerm2](https://iterm2.com/documentation-shell-integration.html).
You can enable the integration with zstyle. It's important to add this line
You can enable the integration with zstyle. It's important to add this line
before the line sourcing oh-my-zsh:
```

View file

@ -8,7 +8,7 @@
if [[ "$OSTYPE" == darwin* ]] && [[ -n "$ITERM_SESSION_ID" ]] ; then
# maybe make it the default in the future and allow opting out?
if zstyle -t ':omz:plugins:iterm2' shell-integration; then
if zstyle -t ':omz:plugins:iterm2' shell-integration; then
# Handle $0 according to the standard:
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"

View file

@ -2,12 +2,12 @@
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

View file

@ -16,23 +16,26 @@ This plugin supplies one command, `jira`, through which all its features are exp
## Commands
`jira help` or `jira usage` will print the below usage instructions
| Command | Description |
| :------------ | :-------------------------------------------------------- |
| `jira` | Performs the default action |
| `jira new` | Opens a new Jira issue dialogue |
| `jira ABC-123` | Opens an existing issue |
| `jira ABC-123 m` | Opens an existing issue for adding a comment |
| `jira dashboard [rapid_view]` | # opens your JIRA dashboard |
| `jira dashboard [rapid_view]` | Opens your JIRA dashboard |
| `jira mine` | Queries for your own issues |
| `jira tempo` | Opens your JIRA Tempo |
| `jira reported [username]` | Queries for issues reported by a user |
| `jira assigned [username]` | Queries for issues assigned to a user |
| `jira branch` | Opens an existing issue matching the current branch name |
| `jira help` | Prints usage instructions |
### Jira Branch usage notes
The branch name may have prefixes ending in "/": "feature/MP-1234", and also suffixes
The branch name may have prefixes ending in "/": "feature/MP-1234", and also suffixes
starting with "_": "MP-1234_fix_dashboard". In both these cases, the issue opened will be "MP-1234"
This is also checks if the prefix is in the name, and adds it if not, so: "MP-1234" opens the issue "MP-1234",

View file

@ -11,6 +11,7 @@ _1st_arguments=(
'assigned:search for issues assigned to a user'
'branch:open the issue named after the git branch of the current directory'
'dumpconfig:display effective jira configuration'
'help:print usage help to stdout'
)
_arguments -C \

View file

@ -2,6 +2,21 @@
#
# See README.md for details
function _jira_usage() {
cat <<EOF
jira Performs the default action
jira new Opens a new Jira issue dialogue
jira ABC-123 Opens an existing issue
jira ABC-123 m Opens an existing issue for adding a comment
jira dashboard [rapid_view] Opens your JIRA dashboard
jira mine Queries for your own issues
jira tempo Opens your JIRA Tempo
jira reported [username] Queries for issues reported by a user
jira assigned [username] Queries for issues assigned to a user
jira branch Opens an existing issue matching the current branch name
EOF
}
function jira() {
emulate -L zsh
local action jira_url jira_prefix
@ -44,6 +59,8 @@ function jira() {
open_command "${jira_url}/secure/CreateIssue!default.jspa"
elif [[ "$action" == "assigned" || "$action" == "reported" ]]; then
_jira_query ${@:-$action}
elif [[ "$action" == "help" || "$action" == "usage" ]]; then
_jira_usage
elif [[ "$action" == "mine" ]]; then
echo "Opening my issues"
open_command "${jira_url}/issues/?filter=-1"

View file

@ -184,7 +184,7 @@ jmodel() {
fi
local model="$(yq e ".controllers.$(jcontroller).current-model" < ~/.local/share/juju/models.yaml | cut -d/ -f2)"
if [[ -z "$model" ]]; then
echo "--"
return 1

View file

@ -4,5 +4,5 @@
if [ $commands[kn] ]; then
source <(kn completion zsh)
compdef _kn kn
compdef _kn kn
fi

View file

@ -10,6 +10,7 @@ plugins=(... laravel)
|:-:|:-:|
| `artisan` | `php artisan` |
| `pas` | `php artisan serve` |
| `pats` | `php artisan test` |
## Database
@ -35,6 +36,10 @@ plugins=(... laravel)
| `pamj` | `php artisan make:job` |
| `paml` | `php artisan make:listener` |
| `pamn` | `php artisan make:notification` |
| `pamcl` | `php artisan make:class` |
| `pamen` | `php artisan make:enum` |
| `pami` | `php artisan make:interface` |
| `pamtr` | `php artisan make:trait` |
## Clears

View file

@ -4,6 +4,7 @@ alias bob='php artisan bob::build'
# Development
alias pas='php artisan serve'
alias pats='php artisan test'
# Database
alias pam='php artisan migrate'
@ -24,6 +25,10 @@ alias pamj='php artisan make:job'
alias paml='php artisan make:listener'
alias pamn='php artisan make:notification'
alias pampp='php artisan make:provider'
alias pamcl='php artisan make:class'
alias pamen='php artisan make:enum'
alias pami='php artisan make:interface'
alias pamtr='php artisan make:trait'
# Clears

View file

@ -17,7 +17,7 @@ Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
| `tab` | Open the current directory in a new tab |
| `split_tab` | Split the current terminal tab horizontally |
| `vsplit_tab` | Split the current terminal tab vertically |
| `ofd` | Open the current directory in a Finder window |
| `ofd` | Open passed directories (or $PWD by default) in Finder |
| `pfd` | Return the path of the frontmost Finder window |
| `pfs` | Return the current Finder selection |
| `cdf` | `cd` to the current Finder directory |

View file

@ -3,8 +3,15 @@
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
# Open the current directory in a Finder window
alias ofd='open_command $PWD'
# Open in Finder the directories passed as arguments, or the current directory if
# no directories are passed
function ofd {
if (( ! $# )); then
open_command $PWD
else
open_command $@
fi
}
# Show/hide hidden files in the Finder
alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"

View file

@ -1,6 +1,6 @@
#compdef port
local subcmds
local subcmds
# we cache the list of ports
# we shall use some cache policy to avoid problems with new ports
@ -31,8 +31,8 @@ subcmds=(
'file'
'help'
'info'
'install'
'installed'
'install'
'installed'
'list'
'livecheck'
'location'
@ -51,7 +51,7 @@ subcmds=(
'test'
'unarchive'
'uninstall'
'upgrade'
'upgrade'
'variants'
'version'
)

View file

@ -1,6 +1,6 @@
## marked2
Plugin for Marked 2, a previewer for Markdown files on Mac OS X
Plugin for Marked 2, a previewer for Markdown files on Mac OS X
### Requirements

View file

@ -1,6 +1,6 @@
## marktext
Plugin for MarkText, a previewer for Markdown files on Mac OS X
Plugin for MarkText, a previewer for Markdown files on Mac OS X
### Requirements

View file

@ -11,6 +11,9 @@ fi
# Load mise hooks
eval "$($__mise activate zsh)"
# Hook mise into current environment
eval "$($__mise hook-env -s zsh)"
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `mise`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_$__mise" ]]; then

View file

@ -1,6 +1,6 @@
# MongoDB Atlas plugin
This plugin adds completion for [Atlas](https://www.mongodb.com/docs/atlas/cli/stable/) a command line interface built specifically for
This plugin adds completion for [Atlas](https://www.mongodb.com/docs/atlas/cli/stable/) a command line interface built specifically for
MongoDB Atlas.
To use it, add `mongo-atlas` to the plugins array in your zshrc file:

View file

@ -1,6 +1,6 @@
# ------------------------------------------------------------------------------
# FILE: n98-magerun.plugin.zsh
# DESCRIPTION: oh-my-zsh n98-magerun plugin file. Adapted from composer plugin
# DESCRIPTION: oh-my-zsh n98-magerun plugin file. Adapted from composer plugin
# AUTHOR: Andrew Dwyer (andrewrdwyer at gmail dot com)
# AUTHOR: Jisse Reitsma (jisse at yireo dot com)
# VERSION: 1.1.0

View file

@ -27,6 +27,6 @@ alias nmap_detect_versions="sudo nmap -sV -p1-65535 -O --osscan-guess -T4 -Pn"
alias nmap_check_for_vulns="nmap --script=vuln"
alias nmap_full_udp="sudo nmap -sS -sU -T4 -A -v -PE -PS22,25,80 -PA21,23,80,443,3389 "
alias nmap_traceroute="sudo nmap -sP -PE -PS22,25,80 -PA21,23,80,3389 -PU -PO --traceroute "
alias nmap_full_with_scripts="sudo nmap -sS -sU -T4 -A -v -PE -PP -PS21,22,23,25,80,113,31339 -PA80,113,443,10042 -PO --script all "
alias nmap_full_with_scripts="sudo nmap -sS -sU -T4 -A -v -PE -PP -PS21,22,23,25,80,113,31339 -PA80,113,443,10042 -PO --script all "
alias nmap_web_safe_osscan="sudo nmap -p 80,443 -O -v --osscan-guess --fuzzy "
alias nmap_ping_scan="nmap -n -sP"

View file

@ -89,7 +89,7 @@ __plan() {
'-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
'-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \
'-no-color[Disables colored command output.]' \
'-diff[Determines whether the diff between the remote job and planned job is shown. Defaults to true.]'
'-diff[Determines whether the diff between the remote job and planned job is shown. Defaults to true.]'
}
__run() {

View file

@ -58,7 +58,7 @@ alias npmt="npm test"
# Run npm scripts
alias npmR="npm run"
# Run npm publish
# Run npm publish
alias npmP="npm publish"
# Run npm init

View file

@ -26,9 +26,9 @@ These settings should go in your zshrc file, before Oh My Zsh is sourced:
#### Lazy startup
This option will help you to defer nvm's load until you use it to speed-up your zsh startup. This will source
nvm script only when using it, and will create a function for `node`, `npm`, `npx`, `pnpm`, `yarn`, and the
command(s) specified by `lazy-cmd` option, so when you call either of them, nvm will be loaded and run with
default version. To enable it, you can add this snippet to your zshrc, before Oh My Zsh is sourced:
nvm script only when using it, and will create a function for `node`, `npm`, `npx`, `pnpm`, `yarn`, `corepack`
and the command(s) specified by `lazy-cmd` option, so when you call either of them, nvm will be loaded and run
with default version. To enable it, you can add this snippet to your zshrc, before Oh My Zsh is sourced:
```zsh
zstyle ':omz:plugins:nvm' lazy yes

View file

@ -16,7 +16,7 @@ if [[ -z "$NVM_DIR" ]]; then
fi
fi
if [[ -z "$NVM_DIR" ]] || [[ ! -f "$NVM_DIR/nvm.sh" ]]; then
if [[ -z "$NVM_DIR" ]] || [[ ! -f "$NVM_DIR/nvm.sh" ]]; then
return
fi
@ -50,11 +50,11 @@ function _omz_setup_autoload {
zstyle -t ':omz:plugins:nvm' silent-autoload && nvm_silent="--silent"
if [[ -n "$nvmrc_path" ]]; then
local nvmrc_node_version=$(nvm version $(cat "$nvmrc_path" | tr -dc '[:print:]'))
local nvmrc_node_version=$(nvm version $(command cat "$nvmrc_path" | tr -dc '[:print:]'))
if [[ "$nvmrc_node_version" = "N/A" ]]; then
nvm install
elif [[ "$nvmrc_node_version" != "$node_version" ]]; then
elif [[ "$nvmrc_node_version" != "$(nvm version)" ]]; then
nvm use $nvm_silent
fi
elif [[ -n "$(PWD=$OLDPWD nvm_find_nvmrc)" ]] && [[ "$(nvm version)" != "$(nvm version default)" ]]; then
@ -72,9 +72,9 @@ function _omz_setup_autoload {
}
if zstyle -t ':omz:plugins:nvm' lazy; then
# Call nvm when first using nvm, node, npm, pnpm, yarn or other commands in lazy-cmd
# Call nvm when first using nvm, node, npm, pnpm, yarn, corepack or other commands in lazy-cmd
zstyle -a ':omz:plugins:nvm' lazy-cmd nvm_lazy_cmd
nvm_lazy_cmd=(nvm node npm npx pnpm yarn $nvm_lazy_cmd) # default values
nvm_lazy_cmd=(nvm node npm npx pnpm yarn corepack $nvm_lazy_cmd) # default values
eval "
function $nvm_lazy_cmd {
for func in $nvm_lazy_cmd; do

View file

@ -16,7 +16,7 @@ Provided aliases:
email address). Then the OTP key needs to be pasted, followed by a CTRL+D character
inserted on an empty line.
- `ot`: generates a MFA code based on the given key and copies it to the clipboard
- `ot`: generates a MFA code based on the given key and copies it to the clipboard
(on Linux it relies on xsel, on MacOS X it uses pbcopy instead).
The plugin uses `$HOME/.otp` to store its internal files.

View file

@ -79,7 +79,7 @@ _id_names() {
local app_list
app_list=`pm2 list -m`
local -a names ids
local -a names ids
names=(`echo $app_list | grep '+---' | awk '{print $2}'`)
ids=(`echo $app_list | grep 'pm2 id' | awk '{print $4}'`)

View file

@ -1,6 +1,6 @@
# Poetry Environment Plugin
This plugin automatically changes poetry environment when you cd into or out of the project directory.
This plugin automatically changes poetry environment when you cd into or out of the project directory.
Note: Script looks for pyproject.toml file to determine poetry if its a poetry environment
To use it, add `poetry-env` to the plugins array in your zshrc file:

View file

@ -1,27 +1,27 @@
# Automatic poetry environment activation/deactivation
_togglePoetryShell() {
# deactivate environment if pyproject.toml doesn't exist and not in a subdir
if [[ ! -f "$PWD/pyproject.toml" ]] ; then
if [[ "$poetry_active" == 1 ]]; then
if [[ "$PWD" != "$poetry_dir"* ]]; then
export poetry_active=0
deactivate
return
fi
fi
# Determine if currently in a Poetry-managed directory
local in_poetry_dir=0
if [[ -f "$PWD/pyproject.toml" ]] && grep -q 'tool.poetry' "$PWD/pyproject.toml"; then
in_poetry_dir=1
fi
# activate the environment if pyproject.toml exists
if [[ "$poetry_active" != 1 ]]; then
if [[ -f "$PWD/pyproject.toml" ]]; then
if grep -q 'tool.poetry' "$PWD/pyproject.toml"; then
export poetry_active=1
export poetry_dir="$PWD"
source "$(poetry env info --path)/bin/activate"
fi
# Deactivate the current environment if moving out of a Poetry directory or into a different Poetry directory
if [[ $poetry_active -eq 1 ]] && { [[ $in_poetry_dir -eq 0 ]] && [[ "$PWD" != "$poetry_dir"* ]]; }; then
export poetry_active=0
unset poetry_dir
deactivate
fi
# Activate the environment if in a Poetry directory and no environment is currently active
if [[ $in_poetry_dir -eq 1 ]] && [[ $poetry_active -ne 1 ]]; then
venv_dir=$(poetry env info --path 2>/dev/null)
if [[ -n "$venv_dir" ]]; then
export poetry_active=1
export poetry_dir="$PWD"
source "${venv_dir}/bin/activate"
fi
fi
}
autoload -U add-zsh-hook
add-zsh-hook chpwd _togglePoetryShell
_togglePoetryShell
_togglePoetryShell # Initial call to check the current directory at shell startup

9
plugins/procs/README.md Normal file
View file

@ -0,0 +1,9 @@
# procs
This plugin provides completion for [procs](https://github.com/dalance/procs).
To use it, add `procs` to the plugins array in your zshrc file.
```
plugins=(... procs)
```

View file

@ -0,0 +1,13 @@
if (( ! $+commands[procs] )); then
return
fi
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `minikube`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_procs" ]]; then
typeset -g -A _comps
autoload -Uz _procs
_comps[procs]=_procs
fi
procs --gen-completion-out zsh >| "$ZSH_CACHE_DIR/completions/_procs" &|

View file

@ -32,8 +32,9 @@ virtual environments:
`venv`) in the current directory.
- `auto_vrun`: Automatically activate the venv virtual environment when entering a directory containing
`<venv-name>/bin/activate`, and automatically deactivate it when navigating out of it (including
subdirectories!).
`<venv-name>/bin/activate`, and automatically deactivate it when navigating out of it (keeps venv activated
in subdirectories).
- To enable the feature, set `export PYTHON_AUTO_VRUN=true` before sourcing oh-my-zsh.
- The default virtual environment name is `venv`. To use a different name, set
- Plugin activates first virtual environment in lexicographic order whose name begins with `<venv-name>`.
The default virtual environment name is `venv`. To use a different name, set
`export PYTHON_VENV_NAME=<venv-name>`. For example: `export PYTHON_VENV_NAME=".venv"`

View file

@ -86,11 +86,20 @@ function mkv() {
if [[ "$PYTHON_AUTO_VRUN" == "true" ]]; then
# Automatically activate venv when changing dir
auto_vrun() {
if [[ -f "${PYTHON_VENV_NAME}/bin/activate" ]]; then
source "${PYTHON_VENV_NAME}/bin/activate" > /dev/null 2>&1
else
(( $+functions[deactivate] )) && deactivate > /dev/null 2>&1
function auto_vrun() {
# deactivate if we're on a different dir than VIRTUAL_ENV states
# we don't deactivate subdirectories!
if (( $+functions[deactivate] )) && [[ $PWD != ${VIRTUAL_ENV:h}* ]]; then
deactivate > /dev/null 2>&1
fi
if [[ $PWD != ${VIRTUAL_ENV:h} ]]; then
for _file in "${PYTHON_VENV_NAME}"*/bin/activate(N.); do
# make sure we're not in a venv already
(( $+functions[deactivate] )) && deactivate > /dev/null 2>&1
source $_file > /dev/null 2>&1
break
done
fi
}
add-zsh-hook chpwd auto_vrun

View file

@ -18,7 +18,7 @@ _1st_arguments=(
'config:Get and set options'
'version:Show the roswell version information'
"help:Use \"ros help [command]\" for more information about a command."$'\n\t\t'"Use \"ros help [topic]\" for more information about the topic."
)
)
#local expl

View file

@ -4,7 +4,7 @@
# AUTHOR: Mirko Caserta (mirko.caserta@gmail.com)
# VERSION: 1.0.2
# ------------------------------------------------------------------------------
# aliases - mnemonic: prefix is 'sb'
alias sbc='sbt compile'
alias sbcc='sbt clean compile'

View file

@ -8,7 +8,7 @@ if [[ "$TERM" == screen* ]]; then
_GET_HOST='echo $HOST | sed "s/\..*//"'
fi
# use the current user as the prefix of the current tab title
# use the current user as the prefix of the current tab title
TAB_TITLE_PREFIX='"`'$_GET_HOST'`:`'$_GET_PATH' | sed "s:..*/::"`$PROMPT_CHAR"'
# when at the shell prompt, show a truncated version of the current path (with
# standard ~ replacement) as the rest of the title.

View file

@ -22,7 +22,8 @@ if parsed.scheme not in proxy_protocols:
def make_argv():
yield "nc"
if sys.platform == 'linux':
if sys.platform in {'linux', 'cygwin'}:
# caveats: the built-in netcat of most linux distributions and cygwin support proxy type
# caveats: macOS built-in netcat command not supported proxy-type
yield "-X" # --proxy-type
# Supported protocols are 4 (SOCKS v4), 5 (SOCKS v5) and connect (HTTP proxy).

View file

@ -1,5 +1,5 @@
###########################
# Settings
# Settings
# These can be overwritten any time.
# If they are not set yet, they will be

View file

@ -62,7 +62,7 @@ function _add_identities() {
# if id is an absolute path, make file equal to id
[[ "$id" = /* ]] && file="$id" || file="$HOME/.ssh/$id"
# check for filename match, otherwise try for signature match
if [[ ${loaded_ids[(I)$file]} -le 0 ]]; then
if [[ -f $file && ${loaded_ids[(I)$file]} -le 0 ]]; then
sig="$(ssh-keygen -lf "$file" | awk '{print $2}')"
[[ ${loaded_sigs[(I)$sig]} -le 0 ]] && not_loaded+=("$file")
fi
@ -98,8 +98,10 @@ function _add_identities() {
# Add a nifty symlink for screen/tmux if agent forwarding is enabled
if zstyle -t :omz:plugins:ssh-agent agent-forwarding \
&& [[ -n "$SSH_AUTH_SOCK" && ! -L "$SSH_AUTH_SOCK" ]]; then
ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USERNAME-screen
&& [[ -n "$SSH_AUTH_SOCK" ]]; then
if [[ ! -L "$SSH_AUTH_SOCK" ]]; then
ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USERNAME-screen
fi
else
_start_agent
fi

View file

@ -1,7 +1,7 @@
# ignore oh-my-zsh theme
unset ZSH_THEME
if (( $+commands[starship] )); then
# ignore oh-my-zsh theme
unset ZSH_THEME
eval "$(starship init zsh)"
else
echo '[oh-my-zsh] starship not found, please install it from https://starship.rs'

View file

@ -1,7 +1,7 @@
# Systemadmin plugin
This plugin adds a series of aliases and functions which make a System Administrator's life easier.
To use it, add `systemadmin` to the plugins array in your zshrc file:
```zsh

View file

@ -15,19 +15,20 @@ plugins=(... terraform)
## Aliases
| Alias | Command |
| ----- | -------------------- |
| `tf` | `terraform` |
| `tfa` | `terraform apply` |
| `tfc` | `terraform console` |
| `tfd` | `terraform destroy` |
| `tff` | `terraform fmt` |
| `tfi` | `terraform init` |
| `tfo` | `terraform output` |
| `tfp` | `terraform plan` |
| `tfv` | `terraform validate` |
| `tfs` | `terraform state` |
| `tfsh`| `terraform show` |
| Alias | Command |
| ------ | -------------------- |
| `tf` | `terraform` |
| `tfa` | `terraform apply` |
| `tfc` | `terraform console` |
| `tfd` | `terraform destroy` |
| `tff` | `terraform fmt` |
| `tfi` | `terraform init` |
| `tfo` | `terraform output` |
| `tfp` | `terraform plan` |
| `tfv` | `terraform validate` |
| `tfs` | `terraform state` |
| `tft` | `terraform test` |
| `tfsh` | `terraform show` |
## Prompt function

View file

@ -25,4 +25,5 @@ alias tfo='terraform output'
alias tfp='terraform plan'
alias tfv='terraform validate'
alias tfs='terraform state'
alias tft='terraform test'
alias tfsh='terraform show'

View file

@ -1,6 +1,6 @@
# Thor plugin
This plugin adds completion for [Thor](http://whatisthor.com/),
This plugin adds completion for [Thor](http://whatisthor.com/),
a ruby toolkit for building powerful command-line interfaces.
To use it, add `thor` to the plugins array in your zshrc file:

15
plugins/tldr/README.md Normal file
View file

@ -0,0 +1,15 @@
# tldr plugin
This plugin adds a shortcut to insert tldr before the previous command.
Heavily inspired from [Man plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/man).
To use it, add `tldr` to the plugins array in your zshrc file:
```zsh
plugins=(... tldr)
```
# Keyboard Shortcuts
| Shortcut | Description |
|------------------------------------|----------------------------------------------------------------------------|
| <kbd>Esc</kbd> + tldr | add tldr before the previous command to see the tldr page for this command |

View file

@ -0,0 +1,19 @@
tldr-command-line() {
# if there is no command typed, use the last command
[[ -z "$BUFFER" ]] && zle up-history
# if typed command begins with tldr, do nothing
[[ "$BUFFER" = tldr\ * ]] && return
# get command and possible subcommand
# http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags
local -a args
args=(${${(Az)BUFFER}[1]} ${${(Az)BUFFER}[2]})
BUFFER="tldr ${args[1]}"
}
zle -N tldr-command-line
# Defined shortcut keys: [Esc]tldr
bindkey "\e"tldr tldr-command-line

View file

@ -37,6 +37,7 @@ The plugin also supports the following:
| `ZSH_TMUX_AUTOQUIT` | Automatically closes terminal once tmux exits (default: `ZSH_TMUX_AUTOSTART`) |
| `ZSH_TMUX_CONFIG` | Set the configuration path (default: `$HOME/.tmux.conf`, `$XDG_CONFIG_HOME/tmux/tmux.conf`) |
| `ZSH_TMUX_DEFAULT_SESSION_NAME` | Set tmux default session name when autostart is enabled |
| `ZSH_TMUX_AUTONAME_SESSION` | Automatically name new sessions based on the basename of `$PWD` (default: `false`) |
| `ZSH_TMUX_DETACHED` | Set the detached mode (default: `false`) |
| `ZSH_TMUX_FIXTERM` | Sets `$TERM` to 256-color term or not based on current terminal support |
| `ZSH_TMUX_FIXTERM_WITHOUT_256COLOR` | `$TERM` to use for non 256-color terminals (default: `tmux` if available, `screen` otherwise) |

View file

@ -13,6 +13,8 @@ fi
: ${ZSH_TMUX_AUTOCONNECT:=true}
# Automatically close the terminal when tmux exits
: ${ZSH_TMUX_AUTOQUIT:=$ZSH_TMUX_AUTOSTART}
# Automatically name the new session based on the basename of PWD
: ${ZSH_TMUX_AUTONAME_SESSION:=false}
# Set term to screen or screen-256color based on current terminal support
: ${ZSH_TMUX_DETACHED:=false}
# Set detached mode
@ -102,9 +104,22 @@ function _zsh_tmux_plugin_run() {
local _detached=""
[[ "$ZSH_TMUX_DETACHED" == "true" ]] && _detached="-d"
local session_name
if [[ "$ZSH_TMUX_AUTONAME_SESSION" == "true" ]]; then
# Name the session after the basename of the current directory
session_name=${PWD##*/}
# If the current directory is the home directory, name it 'HOME'
[[ "$PWD" == "$HOME" ]] && session_name="HOME"
# If the current directory is the root directory, name it 'ROOT'
[[ "$PWD" == "/" ]] && session_name="ROOT"
else
session_name="$ZSH_TMUX_DEFAULT_SESSION_NAME"
fi
# Try to connect to an existing session.
if [[ -n "$ZSH_TMUX_DEFAULT_SESSION_NAME" ]]; then
[[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach $_detached -t $ZSH_TMUX_DEFAULT_SESSION_NAME
if [[ -n "$session_name" ]]; then
[[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach $_detached -t "$session_name"
else
[[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach $_detached
fi
@ -116,8 +131,9 @@ function _zsh_tmux_plugin_run() {
elif [[ -e "$ZSH_TMUX_CONFIG" ]]; then
tmux_cmd+=(-f "$ZSH_TMUX_CONFIG")
fi
if [[ -n "$ZSH_TMUX_DEFAULT_SESSION_NAME" ]]; then
$tmux_cmd new-session -s $ZSH_TMUX_DEFAULT_SESSION_NAME
if [[ -n "$session_name" ]]; then
$tmux_cmd new-session -s "$session_name"
else
$tmux_cmd new-session
fi

View file

@ -10,7 +10,7 @@ plugins=(... ufw)
Some of the commands include:
* `allow <port>/<optional: protocol>` add an allow rule
* `allow <port>/<optional: protocol>` add an allow rule
* `default` set default policy
* `delete <port>/<optional: protocol>` delete RULE
* `deny <port>/<optional: protocol>` add deny rule

View file

@ -1,6 +1,6 @@
This plugin prompts the status of the Vagrant VMs. It supports single-host and
multi-host configurations as well.
Look inside the source for documentation about custom variables.
Look inside the source for documentation about custom variables.
Alberto Re <alberto.re@gmail.com>

View file

@ -55,7 +55,7 @@ INSERT_MODE_INDICATOR="%F{yellow}+%f"
### Adding mode indicators to your prompt
`Vi-mode` by default will add mode indicators to `RPROMPT` **unless** that is defined by
`Vi-mode` by default will add mode indicators to `RPROMPT` **unless** that is defined by
a preceding plugin.
If `PROMPT` or `RPROMPT` is not defined to your liking, you can add mode info manually. The `vi_mode_prompt_info` function is available to insert mode indicator information.

View file

@ -3,7 +3,7 @@
The plugin presents a function called `callvim` whose usage is:
usage: callvim [-b cmd] [-a cmd] [file ... fileN]
-b cmd Run this command in GVIM before editing the first file
-a cmd Run this command in GVIM after editing the first file
file The file to edit

View file

@ -2,7 +2,7 @@
# See README.md
#
# Derek Wyatt (derek@{myfirstnamemylastname}.org
#
#
function callvim {
if [[ $# == 0 ]]; then

View file

@ -52,7 +52,7 @@ if [[ ! $DISABLE_VENV_CD -eq 1 ]]; then
else
ENV_NAME=""
fi
if [[ -n $CD_VIRTUAL_ENV && "$ENV_NAME" != "$CD_VIRTUAL_ENV" ]]; then
# We've just left the repo, deactivate the environment
# Note: this only happens if the virtualenv was activated automatically

View file

@ -57,6 +57,24 @@ wd() {
}
```
### [Home Manager](https://github.com/nix-community/home-manager)
Add the following to your `home.nix` then run `home-manager switch`:
```nix
programs.zsh.plugins = [
{
name = "wd";
src = pkgs.fetchFromGitHub {
owner = "mfaerevaag";
repo = "wd";
rev = "v0.5.2";
sha256 = "sha256-4yJ1qhqhNULbQmt6Z9G22gURfDLe30uV1ascbzqgdhg=";
};
}
];
```
### [zplug](https://github.com/zplug/zplug)
```zsh
@ -119,6 +137,14 @@ Also, you may have to force a rebuild of `zcompdump` by running:
rm -f ~/.zcompdump; compinit
```
## Browse
If you want to make use of the `fzf`-powered browse feature to fuzzy search through all your warp points, set up a keybind in your `.zshrc`:
```zsh
bindkey ${FZF_WD_BINDKEY:-'^B'} fuzzy_wd_widget
```
## Usage
* Add warp point to current working directory:
@ -132,6 +158,19 @@ If a warp point with the same name exists, use `wd add foo --force` to overwrite
**Note:** a warp point cannot contain colons, or consist of only spaces and dots.
The first will conflict in how `wd` stores the warp points, and the second will conflict with other features, as below.
* Add warp point to any directory with default name:
```zsh
wd addcd /foo/ bar
```
* Add warp point to any directory with a custom name:
```zsh
wd addcd /foo/
```
You can omit point name to automatically use the current directory's name instead.
* From any directory, warp to `foo` with:

View file

@ -31,6 +31,7 @@ function _wd() {
commands=(
'add:Adds the current working directory to your warp points'
'addcd:Adds a directory to your warp points'
'add!:Overwrites existing warp point'
'export:Export warp points as static named directories'
'rm:Removes the given warp point'
@ -63,6 +64,9 @@ function _wd() {
add)
_message 'Write the name of your warp point' && ret=0
;;
addcd)
_message 'Write the name of your path' && ret=0
;;
show)
_describe -t points "Warp points" warp_points && ret=0
;;
@ -77,7 +81,7 @@ function _wd() {
# complete sub directories from the warp point
_path_files -W "(${points[$target]})" -/ && ret=0
fi
# don't complete anything if warp point is not valid
;;
esac

View file

@ -8,8 +8,14 @@
# @github.com/mfaerevaag/wd
# Handle $0 according to the standard:
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
# # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
eval "wd() { source '${0:A:h}/wd.sh' }"
wd > /dev/null
zle -N wd_browse_widget
zle -N wd_restore_buffer
autoload -Uz add-zle-hook-widget
add-zle-hook-widget line-init wd_restore_buffer
bindkey ${FZF_WD_BINDKEY:-'^B'} wd_browse_widget

120
plugins/wd/wd.sh Normal file → Executable file
View file

@ -8,7 +8,7 @@
# @github.com/mfaerevaag/wd
# version
readonly WD_VERSION=0.5.0
readonly WD_VERSION=0.7.0
# colors
readonly WD_BLUE="\033[96m"
@ -57,12 +57,11 @@ wd_print_msg()
{
if [[ -z $wd_quiet_mode ]]
then
local color=$1
local msg=$2
if [[ $color == "" || $msg == "" ]]
then
print " ${WD_RED}*${WD_NOC} Could not print message. Sorry!"
local color="${1:-$WD_BLUE}" # Default to blue if no color is provided
local msg="$2"
if [[ -z "$msg" ]]; then
print "${WD_RED}*${WD_NOC} Could not print message. Sorry!"
else
print " ${color}*${WD_NOC} ${msg}"
fi
@ -75,18 +74,20 @@ wd_print_usage()
Usage: wd [command] [point]
Commands:
<point> Warps to the directory specified by the warp point
<point> <path> Warps to the directory specified by the warp point with path appended
add <point> Adds the current working directory to your warp points
add Adds the current working directory to your warp points with current directory's name
rm <point> Removes the given warp point
rm Removes the given warp point with current directory's name
show <point> Print path to given warp point
show Print warp points to current directory
list Print all stored warp points
ls <point> Show files from given warp point (ls)
path <point> Show the path to given warp point (pwd)
clean Remove points warping to nonexistent directories (will prompt unless --force is used)
<point> Warps to the directory specified by the warp point
<point> <path> Warps to the directory specified by the warp point with path appended
add <point> Adds the current working directory to your warp points
add Adds the current working directory to your warp points with current directory's name
addcd <path> Adds a path to your warp points with the directory's name
addcd <path> <point> Adds a path to your warp points with a custom name
rm <point> Removes the given warp point
rm Removes the given warp point with current directory's name
show <point> Print path to given warp point
show Print warp points to current directory
list Print all stored warp points
ls <point> Show files from given warp point (ls)
path <point> Show the path to given warp point (pwd)
clean Remove points warping to nonexistent directories (will prompt unless --force is used)
-v | --version Print version
-d | --debug Exit after execution with exit codes (for testing)
@ -204,6 +205,28 @@ wd_add()
fi
}
wd_addcd() {
local folder="$1"
local point=$2
local force=$3
local currentdir=$PWD
if [[ -z "$folder" ]]; then
wd_exit_fail "You must specify a path"
return
fi
if [[ ! -d "$folder" ]]; then
wd_exit_fail "The directory does not exist"
return
fi
cd "$folder" || return
wd_add "$point" "$force"
cd "$currentdir" || return
}
wd_remove()
{
local point_list=$1
@ -230,6 +253,46 @@ wd_remove()
done
}
wd_browse() {
if ! command -v fzf >/dev/null; then
echo "This functionality requires fzf. Please install fzf first."
return 1
fi
local entries=("${(@f)$(sed "s:${HOME}:~:g" "$WD_CONFIG" | awk -F ':' '{print $1 " -> " $2}')}")
local script_path="${${(%):-%x}:h}"
local wd_remove_output=$(mktemp "${TMPDIR:-/tmp}/wd.XXXXXXXXXX")
local entries_with_headers=("All warp points:" "Press enter to select. Press delete to remove" "${entries[@]}")
local fzf_bind="delete:execute(echo {} | awk -F ' -> ' '{print \$1}' | xargs -I {} "$script_path/wd.sh" rm {} > "$wd_remove_output")+abort"
local fzf_command=$(printf '%s\n' "${entries_with_headers[@]}" | fzf --height 100% --reverse --header-lines=2 --bind="$fzf_bind")
if [[ -e $wd_remove_output ]]; then
cat "$wd_remove_output"
rm "$wd_remove_output"
fi
if [[ -n $selected_entry ]]; then
local selected_point="${selected_entry%% ->*}"
selected_point=$(echo "$selected_point" | xargs)
wd $selected_point
fi
}
wd_browse_widget() {
if [[ -e $WD_CONFIG ]]; then
wd_browse
saved_buffer=$BUFFER
saved_cursor=$CURSOR
BUFFER=
zle redisplay
zle accept-line
fi
}
wd_restore_buffer() {
BUFFER=$saved_buffer
CURSOR=$saved_cursor
saved_buffer=
saved_cursor=1
}
wd_list_all()
{
wd_print_msg "$WD_BLUE" "All warp points:"
@ -358,7 +421,7 @@ wd_export_static_named_directories() {
fi
}
local WD_CONFIG=${WD_CONFIG:-$HOME/.warprc}
WD_CONFIG=${WD_CONFIG:-$HOME/.warprc}
local WD_QUIET=0
local WD_EXIT_CODE=0
local WD_DEBUG=0
@ -396,7 +459,9 @@ fi
# disable extendedglob for the complete wd execution time
setopt | grep -q extendedglob
wd_extglob_is_set=$?
(( ! $wd_extglob_is_set )) && setopt noextendedglob
if (( wd_extglob_is_set == 0 )); then
setopt noextendedglob
fi
# load warp points
typeset -A points
@ -436,6 +501,14 @@ else
wd_add "$2" "$wd_force_mode"
break
;;
"-b"|"browse")
wd_browse
break
;;
"-c"|"--addcd"|"addcd")
wd_addcd "$2" "$3" "$wd_force_mode"
break
;;
"-e"|"export")
wd_export_static_named_directories
break
@ -484,11 +557,14 @@ fi
# if not, next time warp will pick up variables from this run
# remember, there's no sub shell
(( ! $wd_extglob_is_set )) && setopt extendedglob
if (( wd_extglob_is_set == 0 )); then
setopt extendedglob
fi
unset wd_extglob_is_set
unset wd_warp
unset wd_add
unset wd_addcd
unset wd_remove
unset wd_show
unset wd_list_all

View file

@ -86,7 +86,7 @@ _global_commands=(
)
_yarn_find_package_json() {
local dir=$(cd "$1" && pwd)
local dir=$(builtin cd "$1" && pwd)
while true
do
@ -109,7 +109,7 @@ _yarn_commands_scripts() {
if [[ -n $opt_args[--cwd] ]]; then
packageJson=$(_yarn_find_package_json $opt_args[--cwd])
binaries=($(cd $opt_args[--cwd] && echo node_modules/.bin/*(x:t)))
binaries=($(builtin cd $opt_args[--cwd] && echo node_modules/.bin/*(x:t)))
else
packageJson=$(_yarn_find_package_json $pwd)
binaries=($(echo node_modules/.bin/*(x:t)))
@ -130,9 +130,9 @@ _yarn_scripts() {
if [[ -n $_yarn_run_cwd ]]; then
packageJson=$(_yarn_find_package_json $_yarn_run_cwd)
if [[ -d "${_yarn_run_cwd}/node_modules" ]]; then
binaries=($(cd $_yarn_run_cwd && echo node_modules/.bin/*(x:t)))
binaries=($(builtin cd $_yarn_run_cwd && echo node_modules/.bin/*(x:t)))
else
binaries=($(cd $_yarn_run_cwd && yarn bin | perl -wln -e 'm{^[^:]+: (\S+)$} and print $1'))
binaries=($(builtin cd $_yarn_run_cwd && yarn bin | perl -wln -e 'm{^[^:]+: (\S+)$} and print $1'))
fi
else
packageJson=$(_yarn_find_package_json $pwd)

View file

@ -188,7 +188,7 @@ Add a backslash to the end of the last line add `'zsh-z'` to the list, e.g.,
Then relaunch `zsh`.
### For [zcomet](https://github.com/agkozak/zcomet) users
Simply add
zcomet load agkozak/zsh-z