mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-10-16 19:50:09 +00:00
Compare commits
7 commits
7833dd0a4e
...
3b0c931f96
Author | SHA1 | Date | |
---|---|---|---|
|
3b0c931f96 | ||
|
99e2c31484 | ||
|
e52598a5cc | ||
|
d91944d47e | ||
|
865291cb7a | ||
|
9bcafe1c27 | ||
|
cf4093dbdc |
9 changed files with 98 additions and 17 deletions
|
@ -57,6 +57,16 @@ function takeurl() {
|
|||
cd "$thedir"
|
||||
}
|
||||
|
||||
function takezip() {
|
||||
local data thedir
|
||||
data="$(mktemp)"
|
||||
curl -L "$1" > "$data"
|
||||
unzip "$data" -d "./"
|
||||
thedir="$(unzip -l "$data" | awk 'NR==4 {print $4}' | sed 's/\/.*//')"
|
||||
rm "$data"
|
||||
cd "$thedir"
|
||||
}
|
||||
|
||||
function takegit() {
|
||||
git clone "$1"
|
||||
cd "$(basename ${1%%.git})"
|
||||
|
@ -65,6 +75,8 @@ function takegit() {
|
|||
function take() {
|
||||
if [[ $1 =~ ^(https?|ftp).*\.(tar\.(gz|bz2|xz)|tgz)$ ]]; then
|
||||
takeurl "$1"
|
||||
elif [[ $1 =~ ^(https?|ftp).*\.(zip)$ ]]; then
|
||||
takezip "$1"
|
||||
elif [[ $1 =~ ^([A-Za-z0-9]\+@|https?|git|ssh|ftps?|rsync).*\.git/?$ ]]; then
|
||||
takegit "$1"
|
||||
else
|
||||
|
|
12
lib/git.zsh
12
lib/git.zsh
|
@ -162,6 +162,18 @@ function git_current_branch() {
|
|||
echo ${ref#refs/heads/}
|
||||
}
|
||||
|
||||
# Outputs the name of the previously checked out branch
|
||||
# Usage example: git pull origin $(git_current_branch)
|
||||
# rev-parse --symbolic-full-name @{-1} only prints if it is a branch
|
||||
function git_previous_branch() {
|
||||
local ref
|
||||
ref=$(__git_prompt_git rev-parse --quiet --symbolic-full-name @{-1} 2> /dev/null)
|
||||
local ret=$?
|
||||
if [[ $ret != 0 ]] || [[ -z $ref ]]; then
|
||||
return # no git repo or non-branch previous ref
|
||||
fi
|
||||
echo ${ref#refs/heads/}
|
||||
}
|
||||
|
||||
# Gets the number of commits ahead from remote
|
||||
function git_commits_ahead() {
|
||||
|
|
7
plugins/sanity/README.md
Normal file
7
plugins/sanity/README.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
# sanity autocomplete plugin
|
||||
|
||||
* Adds autocomplete options for all Sanity commands.
|
||||
|
||||
## Requirements
|
||||
|
||||
In order to make this work, you will need to have Sanity set up in your path.
|
42
plugins/sanity/_sanity
Normal file
42
plugins/sanity/_sanity
Normal file
|
@ -0,0 +1,42 @@
|
|||
#compdef sanity
|
||||
#autoload
|
||||
|
||||
# In order to make this work, you will need to have Sanity installed.
|
||||
# https://www.sanity.io/
|
||||
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
'build:Builds the current Sanity configuration to a static bundle.'
|
||||
'check:Performs a Sanity check.'
|
||||
'configcheck:Checks if the required configuration files for plugins exists and are up to date.'
|
||||
'cors:Interact with CORS-entries for your project.'
|
||||
'dataset:Interact with datasets in your project.'
|
||||
'debug:Gathers information on Sanity environment.'
|
||||
'deploy:Deploys a statically built Sanity studio.'
|
||||
'docs:Opens the Sanity documentation.'
|
||||
'documents:Interact with documents in your project.'
|
||||
'exec:Runs a script in Sanity context.'
|
||||
'graphql:Interact with GraphQL APIs.'
|
||||
'help:Displays help information about Sanity.'
|
||||
'hook:Interact with hooks in your project.'
|
||||
'init:Initialize a new Sanity project or plugin.'
|
||||
'install:Installs a Sanity plugin to the current Sanity configuration.'
|
||||
'login:Authenticates against the Sanity.io API.'
|
||||
'logout:Logs out of the Sanity.io session.'
|
||||
'manage:Opens the Sanity project management UI.'
|
||||
'projects:Interact with projects connected to your logged in user.'
|
||||
'start:Starts a web server for the Content Studio.'
|
||||
'undeploy:Removes the deployed studio from <hostname>.sanity.studio.'
|
||||
'uninstall:Removes a Sanity plugin from the current Sanity configuration.'
|
||||
'upgrade:Upgrades all (or some) Sanity modules to their latest versions.'
|
||||
'users:Manage users of your project.'
|
||||
'versions:Shows the installed versions of Sanity CLI and core components.'
|
||||
)
|
||||
|
||||
_arguments -C '*:: :->subcmds' && return 0
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "sanity subcommand" _1st_arguments
|
||||
return
|
||||
fi
|
||||
|
|
@ -15,22 +15,23 @@ plugins=(... terraform)
|
|||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command |
|
||||
|--------|----------------------------|
|
||||
| `tf` | `terraform` |
|
||||
| `tfa` | `terraform apply` |
|
||||
| `tfc` | `terraform console` |
|
||||
| `tfd` | `terraform destroy` |
|
||||
| `tff` | `terraform fmt` |
|
||||
| `tffr` | `terraform fmt -recursive` |
|
||||
| `tfi` | `terraform init` |
|
||||
| `tfiu` | `terraform init -upgrade` |
|
||||
| `tfo` | `terraform output` |
|
||||
| `tfp` | `terraform plan` |
|
||||
| `tfv` | `terraform validate` |
|
||||
| `tfs` | `terraform state` |
|
||||
| `tft` | `terraform test` |
|
||||
| `tfsh` | `terraform show` |
|
||||
| Alias | Command |
|
||||
|---------|----------------------------------|
|
||||
| `tf` | `terraform` |
|
||||
| `tfa` | `terraform apply` |
|
||||
| `tfaa` | `terraform apply -auto-approve` |
|
||||
| `tfc` | `terraform console` |
|
||||
| `tfd` | `terraform destroy` |
|
||||
| `tff` | `terraform fmt` |
|
||||
| `tffr` | `terraform fmt -recursive` |
|
||||
| `tfi` | `terraform init` |
|
||||
| `tfiu` | `terraform init -upgrade` |
|
||||
| `tfo` | `terraform output` |
|
||||
| `tfp` | `terraform plan` |
|
||||
| `tfv` | `terraform validate` |
|
||||
| `tfs` | `terraform state` |
|
||||
| `tft` | `terraform test` |
|
||||
| `tfsh` | `terraform show` |
|
||||
|
||||
|
||||
## Prompt function
|
||||
|
|
|
@ -17,6 +17,7 @@ function tf_version_prompt_info() {
|
|||
|
||||
alias tf='terraform'
|
||||
alias tfa='terraform apply'
|
||||
alias tfaa='terraform apply -auto-approve'
|
||||
alias tfc='terraform console'
|
||||
alias tfd='terraform destroy'
|
||||
alias tff='terraform fmt'
|
||||
|
|
|
@ -51,6 +51,7 @@ Available search contexts are:
|
|||
| `packagist` | `https://packagist.org/?query=` |
|
||||
| `gopkg` | `https://pkg.go.dev/search?m=package&q=` |
|
||||
| `chatgpt` | `https://chatgpt.com/?q=` |
|
||||
| `reddit` | `https://www.reddit.com/search/?q=` |
|
||||
|
||||
Also there are aliases for bang-searching DuckDuckGo:
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ function web_search() {
|
|||
packagist "https://packagist.org/?query="
|
||||
gopkg "https://pkg.go.dev/search?m=package&q="
|
||||
chatgpt "https://chatgpt.com/?q="
|
||||
reddit "https://www.reddit.com/search/?q="
|
||||
)
|
||||
|
||||
# check whether the search engine is supported
|
||||
|
@ -85,6 +86,7 @@ alias npmpkg='web_search npmpkg'
|
|||
alias packagist='web_search packagist'
|
||||
alias gopkg='web_search gopkg'
|
||||
alias chatgpt='web_search chatgpt'
|
||||
alias reddit='web_search reddit'
|
||||
|
||||
#add your own !bang searches here
|
||||
alias wiki='web_search duckduckgo \!w'
|
||||
|
|
|
@ -30,8 +30,9 @@ local return_code="%(?..%F{red}%? ↵%f)"
|
|||
local user_host="${PR_USER}%F{cyan}@${PR_HOST}"
|
||||
local current_dir="%B%F{blue}%~%f%b"
|
||||
local git_branch='$(git_prompt_info)'
|
||||
local venv_prompt='$(virtualenv_prompt_info)'
|
||||
|
||||
PROMPT="╭─${user_host} ${current_dir} \$(ruby_prompt_info) ${git_branch}
|
||||
PROMPT="╭─${venv_prompt}${user_host} ${current_dir} \$(ruby_prompt_info) ${git_branch}
|
||||
╰─$PR_PROMPT "
|
||||
RPROMPT="${return_code}"
|
||||
|
||||
|
@ -39,5 +40,7 @@ ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}‹"
|
|||
ZSH_THEME_GIT_PROMPT_SUFFIX="› %f"
|
||||
ZSH_THEME_RUBY_PROMPT_PREFIX="%F{red}‹"
|
||||
ZSH_THEME_RUBY_PROMPT_SUFFIX="›%f"
|
||||
ZSH_THEME_VIRTUALENV_PREFIX="%F{red}("
|
||||
ZSH_THEME_VIRTUALENV_SUFFIX=")%f "
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue