mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-23 02:35:38 +01:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
26b3844dbd
23 changed files with 489 additions and 54 deletions
17
.github/main.workflow
vendored
17
.github/main.workflow
vendored
|
|
@ -1,17 +0,0 @@
|
|||
workflow "Triage Pull Request" {
|
||||
on = "pull_request"
|
||||
resolves = ["Triage"]
|
||||
}
|
||||
|
||||
# Only act if there are code changes: if the pull_request
|
||||
# event's action is either 'opened' (new PR) or 'synchronize' (new commits)
|
||||
action "Filter actions" {
|
||||
uses = "actions/bin/filter@0ac6d44"
|
||||
args = "action 'opened|synchronize'"
|
||||
}
|
||||
|
||||
action "Triage" {
|
||||
needs = ["Filter actions"]
|
||||
uses = "ohmyzsh/github-actions/pull-request-triage@master"
|
||||
secrets = ["GITHUB_TOKEN"]
|
||||
}
|
||||
15
.github/workflows/pull_request_triage.yml
vendored
Normal file
15
.github/workflows/pull_request_triage.yml
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
on: pull_request
|
||||
name: Triage Pull Request
|
||||
jobs:
|
||||
triage:
|
||||
name: Triage
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
if: github.event.action == 'opened' || github.event.action == 'synchronize'
|
||||
- name: Analyze and triage
|
||||
uses: ohmyzsh/github-actions/pull-request-triage@master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
DEBUG_ACTIONS: ${{ secrets.DEBUG_ACTIONS }}
|
||||
|
|
@ -31,10 +31,5 @@ else
|
|||
alias afind='ack -il'
|
||||
fi
|
||||
|
||||
# only define LC_CTYPE if undefined
|
||||
if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then
|
||||
export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG
|
||||
fi
|
||||
|
||||
# recognize comments
|
||||
setopt interactivecomments
|
||||
|
|
|
|||
46
plugins/alias-finder/README.md
Normal file
46
plugins/alias-finder/README.md
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
# alias-finder plugin
|
||||
|
||||
This plugin searches the defined aliases and outputs any that match the command inputted. This makes learning new aliases easier.
|
||||
|
||||
To use it, add `alias-finder` to the `plugins` array of your zshrc file:
|
||||
```
|
||||
plugins=(... alias-finder)
|
||||
```
|
||||
|
||||
## 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
|
||||
|
||||
- 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.
|
||||
|
||||
## Examples
|
||||
```
|
||||
$ alias-finder "git pull"
|
||||
gl='git pull'
|
||||
g=git
|
||||
```
|
||||
```
|
||||
$ 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'
|
||||
```
|
||||
46
plugins/alias-finder/alias-finder.plugin.zsh
Normal file
46
plugins/alias-finder/alias-finder.plugin.zsh
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
alias-finder() {
|
||||
local cmd="" exact="" longer="" wordStart="" wordEnd="" multiWordEnd=""
|
||||
for i in $@; do
|
||||
case $i in
|
||||
-e|--exact) exact=true;;
|
||||
-l|--longer) longer=true;;
|
||||
*)
|
||||
if [[ -z $cmd ]]; then
|
||||
cmd=$i
|
||||
else
|
||||
cmd="$cmd $i"
|
||||
fi
|
||||
;;
|
||||
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
|
||||
fi
|
||||
}
|
||||
|
||||
preexec_alias-finder() {
|
||||
if [[ $ZSH_ALIAS_FINDER_AUTOMATIC = true ]]; then
|
||||
alias-finder $1
|
||||
fi
|
||||
}
|
||||
|
||||
preexec_functions+=(preexec_alias-finder)
|
||||
15
plugins/colored-man-pages/README.md
Normal file
15
plugins/colored-man-pages/README.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Colored man pages plugin
|
||||
|
||||
This plugin adds colors to man pages.
|
||||
|
||||
To use it, add `colored-man-pages` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... colored-man-pages)
|
||||
```
|
||||
|
||||
You can also try to color other pages by prefixing the respective command with `colored`:
|
||||
|
||||
```zsh
|
||||
colored git help clone
|
||||
```
|
||||
|
|
@ -16,7 +16,7 @@ EOF
|
|||
fi
|
||||
fi
|
||||
|
||||
function man() {
|
||||
function colored() {
|
||||
env \
|
||||
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
|
||||
LESS_TERMCAP_md=$(printf "\e[1;31m") \
|
||||
|
|
@ -28,5 +28,9 @@ function man() {
|
|||
PAGER="${commands[less]:-$PAGER}" \
|
||||
_NROFF_U=1 \
|
||||
PATH="$HOME/bin:$PATH" \
|
||||
man "$@"
|
||||
"$@"
|
||||
}
|
||||
|
||||
function man() {
|
||||
colored man "$@"
|
||||
}
|
||||
|
|
|
|||
121
plugins/common-aliases/README.md
Normal file
121
plugins/common-aliases/README.md
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
# Common Aliases Plugin
|
||||
|
||||
This plugin creates helpful shortcut aliases for many commonly used commands.
|
||||
|
||||
To use it add `common-aliases` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... common-aliases)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
### ls command
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|---------------|--------------------------------------------------------------------------------|
|
||||
| l | `ls -lFh` | List files as a long list, show size, type, human-readable |
|
||||
| la | `ls -lAFh` | List almost all files as a long list show size, type, human-readable |
|
||||
| lr | `ls -tRFh` | List files recursively sorted by date, show type, human-readable |
|
||||
| lt | `ls -ltFh` | List files as a long list sorted by date, show type, human-readable |
|
||||
| ll | `ls -l` | List files as a long list |
|
||||
| ldot | `ls -ld .*` | List dot files as a long list |
|
||||
| lS | `ls -1FSsh` | List files showing only size and name sorted by size |
|
||||
| lart | `ls -1Fcart` | List all files sorted in reverse of create/modification time (oldest first) |
|
||||
| lrt | `ls -1Fcrt` | List files sorted in reverse of create/modification time(oldest first) |
|
||||
|
||||
### File handling
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|-----------------------|------------------------------------------------------------------------------------|
|
||||
| rm | `rm -i` | Remove a file |
|
||||
| cp | `cp -i` | Copy a file |
|
||||
| mv | `mv -i` | Move a file |
|
||||
| zshrc | `${=EDITOR} ~/.zshrc` | Quickly access the ~/.zshrc file |
|
||||
| dud | `du -d 1 -h` | Display the size of files at depth 1 in current location in human-readable form |
|
||||
| duf | `du -sh` | Display the size of files in current location in human-readable form |
|
||||
| t | `tail -f` | Shorthand for tail which outputs the last part of a file |
|
||||
|
||||
### find and grep
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|-----------------------------------------------------|-----------------------------------------|
|
||||
| fd | `find . -type d -name` | Find a directory with the given name |
|
||||
| ff | `find . -type f -name` | Find a file with the given name |
|
||||
| grep | `grep --color` | Searches for a query string |
|
||||
| sgrep | `grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS}` | Useful for searching within files |
|
||||
|
||||
### Other Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-----------|---------------------|-------------------------------------------------------------|
|
||||
| h | `history` | Lists all recently used commands |
|
||||
| hgrep | `fc -El 0 \| grep` | Searches for a word in the list of previously used commands |
|
||||
| help | `man` | Opens up the man page for a command |
|
||||
| p | `ps -f` | Displays currently executing processes |
|
||||
| sortnr | `sort -n -r` | Used to sort the lines of a text file |
|
||||
| unexport | `unset` | Used to unset an environment variable |
|
||||
|
||||
## Global aliases
|
||||
|
||||
These aliases are expanded in any position in the command line, meaning you can use them even at the
|
||||
end of the command you've typed. Examples:
|
||||
|
||||
Quickly pipe to less:
|
||||
```zsh
|
||||
$ ls -l /var/log L
|
||||
# will run
|
||||
$ ls -l /var/log | less
|
||||
```
|
||||
Silences stderr output:
|
||||
```zsh
|
||||
$ find . -type f NE
|
||||
# will run
|
||||
$ find . -type f 2>/dev/null
|
||||
```
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|-----------------------------|-------------------------------------------------------------|
|
||||
| H | `\| head` | Pipes output to head which outputs the first part of a file |
|
||||
| T | `\| tail` | Pipes output to tail which outputs the last part of a file |
|
||||
| G | `\| grep` | Pipes output to grep to search for some word |
|
||||
| L | `\| less` | Pipes output to less, useful for paging |
|
||||
| M | `\| most` | Pipes output to more, useful for paging |
|
||||
| LL | `2>&1 \| less` | Writes stderr to stdout and passes it to less |
|
||||
| CA | `2>&1 \| cat -A` | Writes stderr to stdout and passes it to cat |
|
||||
| NE | `2 > /dev/null` | Silences stderr |
|
||||
| NUL | `> /dev/null 2>&1` | Silences both stdout and stderr |
|
||||
| P | `2>&1\| pygmentize -l pytb` | Writes stderr to stdout and passes it to pygmentize |
|
||||
|
||||
## File extension aliases
|
||||
|
||||
These are special aliases that are triggered when a file name is passed as the command. For example,
|
||||
if the pdf file extension is aliased to `acroread` (a popular Linux pdf reader), when running `file.pdf`
|
||||
that file will be open with `acroread`.
|
||||
|
||||
### Reading Docs
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|-------------|-------------------------------------|
|
||||
| pdf | `acroread` | Opens up a document using acroread |
|
||||
| ps | `gv` | Opens up a .ps file using gv |
|
||||
| dvi | `xdvi` | Opens up a .dvi file using xdvi |
|
||||
| chm | `xchm` | Opens up a .chm file using xchm |
|
||||
| djvu | `djview` | Opens up a .djvu file using djview |
|
||||
|
||||
### Listing files inside a packed file
|
||||
|
||||
| Alias | Command | Description |
|
||||
|---------|-------------|-------------------------------------|
|
||||
| zip | `unzip -l` | Lists files inside a .zip file |
|
||||
| rar | `unrar l` | Lists files inside a .rar file |
|
||||
| tar | `tar tf` | Lists files inside a .tar file |
|
||||
| tar.gz | `echo` | Lists files inside a .tar.gz file |
|
||||
| ace | `unace l` | Lists files inside a .ace file |
|
||||
|
||||
### Some other features
|
||||
|
||||
- Opens urls in terminal using browser specified by the variable `$BROWSER`
|
||||
- Opens C, C++, Tex and text files using editor specified by the variable `$EDITOR`
|
||||
- Opens images using image viewer specified by the variable `$XIVIEWER`
|
||||
- Opens videos and other media using mplayer
|
||||
|
|
@ -5,7 +5,7 @@ local curcontext=$curcontext state line
|
|||
declare -A opt_args
|
||||
|
||||
declare target_list
|
||||
target_list=(`fab --shortlist 2>/dev/null`)
|
||||
target_list=(`fab --shortlist 2>/dev/null || fab --complete 2>/dev/null`)
|
||||
|
||||
_targets() {
|
||||
_describe -t commands "fabric targets" target_list
|
||||
|
|
|
|||
|
|
@ -62,6 +62,10 @@ Available search contexts are:
|
|||
|
||||
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.
|
||||
|
||||
## Author
|
||||
|
||||
**Wilson Mendes (willmendesneto)**
|
||||
|
|
|
|||
|
|
@ -27,6 +27,17 @@ alias typescript='frontend typescript'
|
|||
alias unheap='frontend unheap'
|
||||
alias vuejs='frontend vuejs'
|
||||
|
||||
function _frontend_fallback() {
|
||||
local url
|
||||
if [[ "$FRONTEND_SEARCH_FALLBACK" == duckduckgo ]]; then
|
||||
url="https://duckduckgo.com/?sites=$1&q="
|
||||
else
|
||||
url="https://google.com/search?as_sitesearch=$1&as_q="
|
||||
fi
|
||||
|
||||
echo "$url"
|
||||
}
|
||||
|
||||
function frontend() {
|
||||
emulate -L zsh
|
||||
|
||||
|
|
@ -34,8 +45,8 @@ function frontend() {
|
|||
typeset -A urls
|
||||
urls=(
|
||||
angular 'https://angular.io/?search='
|
||||
angularjs 'https://google.com/search?as_sitesearch=angularjs.org&as_q='
|
||||
bem 'https://google.com/search?as_sitesearch=bem.info&as_q='
|
||||
angularjs $(_frontend_fallback 'angularjs.org')
|
||||
bem $(_frontend_fallback 'bem.info')
|
||||
bootsnipp 'https://bootsnipp.com/search?q='
|
||||
bundlephobia 'https://bundlephobia.com/result?p='
|
||||
caniuse 'https://caniuse.com/#search='
|
||||
|
|
@ -43,24 +54,24 @@ function frontend() {
|
|||
compassdoc 'http://compass-style.org/search?q='
|
||||
cssflow 'http://www.cssflow.com/search?q='
|
||||
dartlang 'https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:'
|
||||
emberjs 'https://www.google.com/search?as_sitesearch=emberjs.com/&as_q='
|
||||
flowtype 'https://google.com/search?as_sitesearch=flow.org/en/docs/&as_q='
|
||||
emberjs $(_frontend_fallback 'emberjs.com/')
|
||||
flowtype $(_frontend_fallback 'flow.org/en/docs/')
|
||||
fontello 'http://fontello.com/#search='
|
||||
github 'https://github.com/search?q='
|
||||
html5please 'https://html5please.com/#'
|
||||
jestjs 'https://www.google.com/search?as_sitesearch=jestjs.io&as_q='
|
||||
jestjs $(_frontend_fallback 'jestjs.io')
|
||||
jquery 'https://api.jquery.com/?s='
|
||||
lodash 'https://devdocs.io/lodash/index#'
|
||||
mdn 'https://developer.mozilla.org/search?q='
|
||||
nodejs 'https://www.google.com/search?as_sitesearch=nodejs.org/en/docs/&as_q='
|
||||
nodejs $(_frontend_fallback 'nodejs.org/en/docs/')
|
||||
npmjs 'https://www.npmjs.com/search?q='
|
||||
qunit 'https://api.qunitjs.com/?s='
|
||||
reactjs 'https://google.com/search?as_sitesearch=facebook.github.io/react&as_q='
|
||||
smacss 'https://google.com/search?as_sitesearch=smacss.com&as_q='
|
||||
reactjs $(_frontend_fallback 'reactjs.org/')
|
||||
smacss $(_frontend_fallback 'smacss.com')
|
||||
stackoverflow 'https://stackoverflow.com/search?q='
|
||||
typescript 'https://google.com/search?as_sitesearch=www.typescriptlang.org/docs&as_q='
|
||||
typescript $(_frontend_fallback 'www.typescriptlang.org/docs')
|
||||
unheap 'http://www.unheap.com/?s='
|
||||
vuejs 'https://www.google.com/search?as_sitesearch=vuejs.org&as_q='
|
||||
vuejs $(_frontend_fallback 'vuejs.org')
|
||||
)
|
||||
|
||||
# show help for command list
|
||||
|
|
|
|||
|
|
@ -18,10 +18,18 @@ function git-auto-fetch {
|
|||
echo "${fg_bold[red]}disabled${reset_color}")
|
||||
}
|
||||
|
||||
eval "override-git-auto-fetch-$(declare -f zle-line-init)"
|
||||
|
||||
function zle-line-init () {
|
||||
git-fetch-all
|
||||
override-git-auto-fetch-zle-line-init
|
||||
}
|
||||
# Override zle-line-init if it exists
|
||||
if (( $+functions[zle-line-init] )); then
|
||||
eval "override-git-auto-fetch-$(declare -f zle-line-init)"
|
||||
|
||||
function zle-line-init () {
|
||||
git-fetch-all
|
||||
override-git-auto-fetch-zle-line-init
|
||||
}
|
||||
else
|
||||
function zle-line-init () {
|
||||
git-fetch-all
|
||||
}
|
||||
fi
|
||||
|
||||
zle -N zle-line-init
|
||||
|
|
|
|||
17
plugins/git-escape-magic/README.md
Normal file
17
plugins/git-escape-magic/README.md
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# Git Escape Magic
|
||||
|
||||
This plugin is copied from the original at
|
||||
https://github.com/knu/zsh-git-escape-magic. All credit for the
|
||||
functionality enabled by this plugin should go to @knu.
|
||||
|
||||
An excerpt from that project's readme explains it's purpose.
|
||||
|
||||
> It eliminates the need for manually escaping those meta-characters. The zle function it provides is context aware and recognizes the characteristics of each subcommand of git. Every time you type one of these meta-characters on a git command line, it automatically escapes the meta-character with a backslash as necessary and as appropriate.
|
||||
|
||||
## Useage
|
||||
|
||||
To use this plugin add it to your list of plugins in your `.zshrc` file.
|
||||
|
||||
**NOTE**: If you use url-quote-magic it must be included before this
|
||||
plugin runs to prevent any conflicts.
|
||||
|
||||
135
plugins/git-escape-magic/git-escape-magic
Normal file
135
plugins/git-escape-magic/git-escape-magic
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
# -*- mode: sh -*-
|
||||
#
|
||||
# git-escape-magic - zle tweak for git command line arguments
|
||||
#
|
||||
# Copyright (c) 2011, 2012, 2014 Akinori MUSHA
|
||||
# Licensed under the 2-clause BSD license.
|
||||
#
|
||||
# This tweak eliminates the need for manually escaping shell
|
||||
# meta-characters such as [~^{}] that are used for specifying a git
|
||||
# object (commit or tree). Every time you type one of these
|
||||
# characters on a git command line, it is automatically escaped with a
|
||||
# backslash as necessary and as appropriate.
|
||||
#
|
||||
# If you want to use this with url-quote-magic, make sure to enable it
|
||||
# first.
|
||||
#
|
||||
# Usage:
|
||||
# autoload -Uz git-escape-magic
|
||||
# git-escape-magic
|
||||
#
|
||||
|
||||
git-escape-magic.self-insert() {
|
||||
emulate -L zsh
|
||||
setopt extendedglob
|
||||
local self_insert_function
|
||||
zstyle -s ':git-escape-magic' self-insert-function self_insert_function
|
||||
|
||||
if [[ "$KEYS" == [{}~^]* ]] && {
|
||||
local qkey="${(q)KEYS}"
|
||||
[[ "$KEYS" != "$qkey" ]]
|
||||
} && {
|
||||
local lbuf="$LBUFFER$qkey"
|
||||
[[ "${(Q)LBUFFER}$KEYS" == "${(Q)lbuf}" ]]
|
||||
} && {
|
||||
local -a words
|
||||
words=("${(@Q)${(z)lbuf}}")
|
||||
[[ "$words[(i)(*/|)git(|-[^/]##)]" -le $#words ]]
|
||||
}
|
||||
then
|
||||
local i
|
||||
i="$words[(I)([;(){\&]|\&[\&\!]|\|\||[=<>]\(*)]"
|
||||
if [[ $i -gt 0 ]]; then
|
||||
shift $((i-1)) words
|
||||
if [[ "$words[1]" == [\=\<\>]\(* ]]; then
|
||||
words[1]="${words[1]#[=<>]\(}"
|
||||
else
|
||||
[[ "$words[1]" == \; && $words[2] == (then|else|elif|do) ]] && shift words
|
||||
shift words
|
||||
fi
|
||||
fi
|
||||
while [[ "$words[1]" == (if|while|until|\!) ]]; do
|
||||
shift words
|
||||
done
|
||||
while [[ "$words[1]" == [A-Za-z_][A-Za-z0-9_]#=* ]]; do
|
||||
shift words
|
||||
done
|
||||
[[ "$words[1]" == (*/|)git(|-[^/]##) ]] && {
|
||||
local subcommand
|
||||
subcommand="${words[1]##*/git-}"
|
||||
if [[ -z "$subcommand" ]]; then
|
||||
shift words
|
||||
subcommand="$words[1]"
|
||||
fi
|
||||
[[ $#words -ge 2 ]]
|
||||
} &&
|
||||
case "$subcommand" in
|
||||
# commands that may take pathspec but never take refspec with [{}~^]
|
||||
(add|rm|am|apply|check-attr|checkout-index|clean|clone|config|diff-files|hash-object|help|index-pack|mailinfo|mailsplit|merge-file|merge-index|mergetool|mktag|mv|pack-objects|pack-redundant|relink|send-email|show-index|show-ref|stage|status|verify-pack)
|
||||
false ;;
|
||||
# commands that may take pathspec but rarely take refspec with [{}~^]
|
||||
(for-each-ref|grep|ls-files|update-index)
|
||||
false ;;
|
||||
(archive|ls-tree)
|
||||
! [[ $#words -ge 3 &&
|
||||
"$words[-2]" == [^-]* ]] ;;
|
||||
(diff-tree)
|
||||
! [[ $#words -ge 4 &&
|
||||
"$words[-2]" == [^-]* &&
|
||||
"$words[-3]" == [^-]* ]] ;;
|
||||
(*)
|
||||
[[ $words[(i)--] -gt $#words ]] ;;
|
||||
esac &&
|
||||
case "${words[-1]%%"$KEYS"}" in
|
||||
(*[@^])
|
||||
[[ "$KEYS" == [{~^]* ]] ;;
|
||||
(*[@^]\{[^}]##)
|
||||
[[ "$KEYS" == \}* ]] ;;
|
||||
(?*)
|
||||
[[ "$KEYS" == [~^]* ]] ;;
|
||||
(*)
|
||||
false ;;
|
||||
esac &&
|
||||
LBUFFER="$LBUFFER\\"
|
||||
fi
|
||||
|
||||
zle "$self_insert_function"
|
||||
}
|
||||
|
||||
git-escape-magic.on() {
|
||||
emulate -L zsh
|
||||
local self_insert_function="${$(zle -lL | awk \
|
||||
'$1=="zle"&&$2=="-N"&&$3=="self-insert"{print $4;exit}'):-.self-insert}"
|
||||
|
||||
[[ "$self_insert_function" == git-escape-magic.self-insert ]] &&
|
||||
return 0
|
||||
|
||||
# For url-quote-magic which does not zle -N itself
|
||||
zle -la "$self_insert_function" || zle -N "$self_insert_function"
|
||||
|
||||
zstyle ':git-escape-magic' self-insert-function "$self_insert_function"
|
||||
|
||||
zle -A git-escape-magic.self-insert self-insert
|
||||
return 0
|
||||
}
|
||||
|
||||
git-escape-magic.off() {
|
||||
emulate -L zsh
|
||||
local self_insert_function
|
||||
zstyle -s ':git-escape-magic' self-insert-function self_insert_function
|
||||
|
||||
[[ -n "$self_insert_function" ]] &&
|
||||
zle -A "$self_insert_function" self-insert
|
||||
return 0
|
||||
}
|
||||
|
||||
zle -N git-escape-magic.self-insert
|
||||
zle -N git-escape-magic.on
|
||||
zle -N git-escape-magic.off
|
||||
|
||||
git-escape-magic() {
|
||||
git-escape-magic.on
|
||||
}
|
||||
|
||||
[[ -o kshautoload ]] || git-escape-magic "$@"
|
||||
|
||||
9
plugins/git-escape-magic/git-escape-magic.plugin.zsh
Normal file
9
plugins/git-escape-magic/git-escape-magic.plugin.zsh
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# Automatically detect and escape zsh globbing meta-characters when used with
|
||||
# git refspec characters like `[^~{}]`. NOTE: This must be loaded _after_
|
||||
# url-quote-magic.
|
||||
#
|
||||
# This trick is detailed at https://github.com/knu/zsh-git-escape-magic and is
|
||||
# what allowed this plugin to exist.
|
||||
|
||||
autoload -Uz git-escape-magic
|
||||
git-escape-magic
|
||||
|
|
@ -22,7 +22,7 @@ plugins=(... git)
|
|||
| gb | git branch |
|
||||
| gba | git branch -a |
|
||||
| gbd | git branch -d |
|
||||
| gbda | git branch --no-color --merged \| command grep -vE "^(\*\|\s*(master\|develop\|dev)\s*$)" \| command xargs -n 1 git branch -d |
|
||||
| gbda | git branch --no-color --merged \| command grep -vE "^(\+|\*\|\s*(master\|develop\|dev)\s*$)" \| command xargs -n 1 git branch -d |
|
||||
| gbD | git branch -D |
|
||||
| gbl | git blame -b -w |
|
||||
| gbnm | git branch --no-merged |
|
||||
|
|
@ -131,7 +131,9 @@ plugins=(... git)
|
|||
| grmc | git rm --cached |
|
||||
| grmv | git remote rename |
|
||||
| grrm | git remote remove |
|
||||
| grs | git restore |
|
||||
| grset | git remote set-url |
|
||||
| grss | git restore --source |
|
||||
| grt | cd "$(git rev-parse --show-toplevel \|\| echo .)" |
|
||||
| gru | git reset -- |
|
||||
| grup | git remote update |
|
||||
|
|
@ -154,6 +156,8 @@ plugins=(... git)
|
|||
| gsts | git stash show --text |
|
||||
| gstall | git stash --all |
|
||||
| gsu | git submodule update |
|
||||
| gsw | git switch |
|
||||
| gswc | git switch -c |
|
||||
| gts | git tag -s |
|
||||
| gtv | git tag \| sort -V |
|
||||
| gtl | gtl(){ git tag --sort=-v:refname -n -l ${1}* }; noglob gtl |
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ alias gap='git apply'
|
|||
alias gb='git branch'
|
||||
alias gba='git branch -a'
|
||||
alias gbd='git branch -d'
|
||||
alias gbda='git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d'
|
||||
alias gbda='git branch --no-color --merged | command grep -vE "^(\+|\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d'
|
||||
alias gbD='git branch -D'
|
||||
alias gbl='git blame -b -w'
|
||||
alias gbnm='git branch --no-merged'
|
||||
|
|
@ -207,7 +207,9 @@ alias grm='git rm'
|
|||
alias grmc='git rm --cached'
|
||||
alias grmv='git remote rename'
|
||||
alias grrm='git remote remove'
|
||||
alias grs='git restore'
|
||||
alias grset='git remote set-url'
|
||||
alias grss='git restore --source'
|
||||
alias grt='cd "$(git rev-parse --show-toplevel || echo .)"'
|
||||
alias gru='git reset --'
|
||||
alias grup='git remote update'
|
||||
|
|
@ -236,6 +238,8 @@ alias gstp='git stash pop'
|
|||
alias gsts='git stash show --text'
|
||||
alias gstall='git stash --all'
|
||||
alias gsu='git submodule update'
|
||||
alias gsw='git switch'
|
||||
alias gswc='git switch -c'
|
||||
|
||||
alias gts='git tag -s'
|
||||
alias gtv='git tag | sort -V'
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Homestead basic command completion
|
||||
_homestead_get_command_list () {
|
||||
homestead --no-ansi | sed "1,/Available commands/d" | awk '/^ +[a-z]+/ { print $1 }'
|
||||
homestead --no-ansi | sed -E "1,/(Available|Common) commands/d" | awk '/^ +[a-z]+/ { print $1 }'
|
||||
}
|
||||
|
||||
_homestead () {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
# FILE: n98-magerun.plugin.zsh
|
||||
# DESCRIPTION: oh-my-zsh n98-magerun plugin file. Adapted from composer plugin
|
||||
# AUTHOR: Andrew Dwyer (andrewrdwyer at gmail dot com)
|
||||
# VERSION: 1.0.0
|
||||
# AUTHOR: Jisse Reitsma (jisse at yireo dot com)
|
||||
# VERSION: 1.1.0
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# n98-magerun basic command completion
|
||||
|
|
@ -24,11 +25,18 @@ _n98_magerun () {
|
|||
|
||||
compdef _n98_magerun n98-magerun.phar
|
||||
compdef _n98_magerun n98-magerun
|
||||
compdef _n98_magerun n98-magerun2.phar
|
||||
compdef _n98_magerun n98-magerun2
|
||||
|
||||
# Aliases
|
||||
alias n98='n98-magerun.phar'
|
||||
alias mage='n98-magerun.phar'
|
||||
alias magefl='n98-magerun.phar cache:flush'
|
||||
alias magerun='n98-magerun.phar'
|
||||
|
||||
alias n98-2='n98-magerun2.phar'
|
||||
alias mage2='n98-magerun2.phar'
|
||||
alias magerun2='n98-magerun2.phar'
|
||||
|
||||
# Install n98-magerun into the current directory
|
||||
alias mage-get='wget https://raw.github.com/netz98/n98-magerun/master/n98-magerun.phar'
|
||||
alias mage-get='wget https://files.magerun.net/n98-magerun.phar'
|
||||
alias mage2-get='wget https://files.magerun.net/n98-magerun2.phar'
|
||||
|
|
|
|||
|
|
@ -28,4 +28,6 @@ sudo-command-line() {
|
|||
}
|
||||
zle -N sudo-command-line
|
||||
# Defined shortcut keys: [Esc] [Esc]
|
||||
bindkey "\e\e" sudo-command-line
|
||||
bindkey -M emacs '\e\e' sudo-command-line
|
||||
bindkey -M vicmd '\e\e' sudo-command-line
|
||||
bindkey -M viins '\e\e' sudo-command-line
|
||||
|
|
|
|||
|
|
@ -15,4 +15,6 @@ fuck-command-line() {
|
|||
}
|
||||
zle -N fuck-command-line
|
||||
# Defined shortcut keys: [Esc] [Esc]
|
||||
bindkey "\e\e" fuck-command-line
|
||||
bindkey -M emacs '\e\e' fuck-command-line
|
||||
bindkey -M vicmd '\e\e' fuck-command-line
|
||||
bindkey -M viins '\e\e' fuck-command-line
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ alias acp='apt-cache policy'
|
|||
#List all installed packages
|
||||
alias agli='apt list --installed'
|
||||
|
||||
# superuser operations ######################################################
|
||||
|
||||
# List available updates only
|
||||
alias aglu='sudo apt-get -u upgrade --assume-no'
|
||||
alias aglu='apt list --upgradable'
|
||||
|
||||
# superuser operations ######################################################
|
||||
|
||||
alias afu='sudo apt-file update'
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
|||
# primary prompt
|
||||
PROMPT='$FG[237]${(l.COLUMNS..-.)}%{$reset_color%}
|
||||
$FG[032]%~\
|
||||
$(git_prompt_info) \
|
||||
$(git_prompt_info)$(hg_prompt_info) \
|
||||
$FG[105]%(!.#.»)%{$reset_color%} '
|
||||
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
|
||||
RPS1='${return_code}'
|
||||
|
|
@ -21,7 +21,7 @@ eval my_orange='$FG[214]'
|
|||
# right prompt
|
||||
if type "virtualenv_prompt_info" > /dev/null
|
||||
then
|
||||
RPROMPT='$(virtualenv_prompt_info)$my_gray%n@%m%{$reset_color%}%'
|
||||
RPROMPT='$FG[078]$(virtualenv_prompt_info)%{$reset_color%} $my_gray%n@%m%{$reset_color%}%'
|
||||
else
|
||||
RPROMPT='$my_gray%n@%m%{$reset_color%}%'
|
||||
fi
|
||||
|
|
@ -31,3 +31,9 @@ ZSH_THEME_GIT_PROMPT_PREFIX="$FG[075]($FG[078]"
|
|||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="$my_orange*%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="$FG[075])%{$reset_color%}"
|
||||
|
||||
# hg settings
|
||||
ZSH_THEME_HG_PROMPT_PREFIX="$FG[075]($FG[078]"
|
||||
ZSH_THEME_HG_PROMPT_CLEAN=""
|
||||
ZSH_THEME_HG_PROMPT_DIRTY="$my_orange*%{$reset_color%}"
|
||||
ZSH_THEME_HG_PROMPT_SUFFIX="$FG[075])%{$reset_color%}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue