mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-10-16 19:50:09 +00:00
Compare commits
1 commit
e13a3b4390
...
74e86cd739
Author | SHA1 | Date | |
---|---|---|---|
|
74e86cd739 |
7 changed files with 17 additions and 49 deletions
|
@ -57,16 +57,6 @@ function takeurl() {
|
||||||
cd "$thedir"
|
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() {
|
function takegit() {
|
||||||
git clone "$1"
|
git clone "$1"
|
||||||
cd "$(basename ${1%%.git})"
|
cd "$(basename ${1%%.git})"
|
||||||
|
@ -75,8 +65,6 @@ function takegit() {
|
||||||
function take() {
|
function take() {
|
||||||
if [[ $1 =~ ^(https?|ftp).*\.(tar\.(gz|bz2|xz)|tgz)$ ]]; then
|
if [[ $1 =~ ^(https?|ftp).*\.(tar\.(gz|bz2|xz)|tgz)$ ]]; then
|
||||||
takeurl "$1"
|
takeurl "$1"
|
||||||
elif [[ $1 =~ ^(https?|ftp).*\.(zip)$ ]]; then
|
|
||||||
takezip "$1"
|
|
||||||
elif [[ $1 =~ ^([A-Za-z0-9]\+@|https?|git|ssh|ftps?|rsync).*\.git/?$ ]]; then
|
elif [[ $1 =~ ^([A-Za-z0-9]\+@|https?|git|ssh|ftps?|rsync).*\.git/?$ ]]; then
|
||||||
takegit "$1"
|
takegit "$1"
|
||||||
else
|
else
|
||||||
|
|
12
lib/git.zsh
12
lib/git.zsh
|
@ -162,18 +162,6 @@ function git_current_branch() {
|
||||||
echo ${ref#refs/heads/}
|
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
|
# Gets the number of commits ahead from remote
|
||||||
function git_commits_ahead() {
|
function git_commits_ahead() {
|
||||||
|
|
|
@ -15,23 +15,22 @@ plugins=(... terraform)
|
||||||
|
|
||||||
## Aliases
|
## Aliases
|
||||||
|
|
||||||
| Alias | Command |
|
| Alias | Command |
|
||||||
|---------|----------------------------------|
|
|--------|----------------------------|
|
||||||
| `tf` | `terraform` |
|
| `tf` | `terraform` |
|
||||||
| `tfa` | `terraform apply` |
|
| `tfa` | `terraform apply` |
|
||||||
| `tfaa` | `terraform apply -auto-approve` |
|
| `tfc` | `terraform console` |
|
||||||
| `tfc` | `terraform console` |
|
| `tfd` | `terraform destroy` |
|
||||||
| `tfd` | `terraform destroy` |
|
| `tff` | `terraform fmt` |
|
||||||
| `tff` | `terraform fmt` |
|
| `tffr` | `terraform fmt -recursive` |
|
||||||
| `tffr` | `terraform fmt -recursive` |
|
| `tfi` | `terraform init` |
|
||||||
| `tfi` | `terraform init` |
|
| `tfiu` | `terraform init -upgrade` |
|
||||||
| `tfiu` | `terraform init -upgrade` |
|
| `tfo` | `terraform output` |
|
||||||
| `tfo` | `terraform output` |
|
| `tfp` | `terraform plan` |
|
||||||
| `tfp` | `terraform plan` |
|
| `tfv` | `terraform validate` |
|
||||||
| `tfv` | `terraform validate` |
|
| `tfs` | `terraform state` |
|
||||||
| `tfs` | `terraform state` |
|
| `tft` | `terraform test` |
|
||||||
| `tft` | `terraform test` |
|
| `tfsh` | `terraform show` |
|
||||||
| `tfsh` | `terraform show` |
|
|
||||||
|
|
||||||
|
|
||||||
## Prompt function
|
## Prompt function
|
||||||
|
|
|
@ -17,7 +17,6 @@ function tf_version_prompt_info() {
|
||||||
|
|
||||||
alias tf='terraform'
|
alias tf='terraform'
|
||||||
alias tfa='terraform apply'
|
alias tfa='terraform apply'
|
||||||
alias tfaa='terraform apply -auto-approve'
|
|
||||||
alias tfc='terraform console'
|
alias tfc='terraform console'
|
||||||
alias tfd='terraform destroy'
|
alias tfd='terraform destroy'
|
||||||
alias tff='terraform fmt'
|
alias tff='terraform fmt'
|
||||||
|
|
|
@ -51,7 +51,6 @@ Available search contexts are:
|
||||||
| `packagist` | `https://packagist.org/?query=` |
|
| `packagist` | `https://packagist.org/?query=` |
|
||||||
| `gopkg` | `https://pkg.go.dev/search?m=package&q=` |
|
| `gopkg` | `https://pkg.go.dev/search?m=package&q=` |
|
||||||
| `chatgpt` | `https://chatgpt.com/?q=` |
|
| `chatgpt` | `https://chatgpt.com/?q=` |
|
||||||
| `reddit` | `https://www.reddit.com/search/?q=` |
|
|
||||||
|
|
||||||
Also there are aliases for bang-searching DuckDuckGo:
|
Also there are aliases for bang-searching DuckDuckGo:
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ function web_search() {
|
||||||
packagist "https://packagist.org/?query="
|
packagist "https://packagist.org/?query="
|
||||||
gopkg "https://pkg.go.dev/search?m=package&q="
|
gopkg "https://pkg.go.dev/search?m=package&q="
|
||||||
chatgpt "https://chatgpt.com/?q="
|
chatgpt "https://chatgpt.com/?q="
|
||||||
reddit "https://www.reddit.com/search/?q="
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# check whether the search engine is supported
|
# check whether the search engine is supported
|
||||||
|
@ -86,7 +85,6 @@ alias npmpkg='web_search npmpkg'
|
||||||
alias packagist='web_search packagist'
|
alias packagist='web_search packagist'
|
||||||
alias gopkg='web_search gopkg'
|
alias gopkg='web_search gopkg'
|
||||||
alias chatgpt='web_search chatgpt'
|
alias chatgpt='web_search chatgpt'
|
||||||
alias reddit='web_search reddit'
|
|
||||||
|
|
||||||
#add your own !bang searches here
|
#add your own !bang searches here
|
||||||
alias wiki='web_search duckduckgo \!w'
|
alias wiki='web_search duckduckgo \!w'
|
||||||
|
|
|
@ -30,9 +30,8 @@ local return_code="%(?..%F{red}%? ↵%f)"
|
||||||
local user_host="${PR_USER}%F{cyan}@${PR_HOST}"
|
local user_host="${PR_USER}%F{cyan}@${PR_HOST}"
|
||||||
local current_dir="%B%F{blue}%~%f%b"
|
local current_dir="%B%F{blue}%~%f%b"
|
||||||
local git_branch='$(git_prompt_info)'
|
local git_branch='$(git_prompt_info)'
|
||||||
local venv_prompt='$(virtualenv_prompt_info)'
|
|
||||||
|
|
||||||
PROMPT="╭─${venv_prompt}${user_host} ${current_dir} \$(ruby_prompt_info) ${git_branch}
|
PROMPT="╭─${user_host} ${current_dir} \$(ruby_prompt_info) ${git_branch}
|
||||||
╰─$PR_PROMPT "
|
╰─$PR_PROMPT "
|
||||||
RPROMPT="${return_code}"
|
RPROMPT="${return_code}"
|
||||||
|
|
||||||
|
@ -40,7 +39,5 @@ ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}‹"
|
||||||
ZSH_THEME_GIT_PROMPT_SUFFIX="› %f"
|
ZSH_THEME_GIT_PROMPT_SUFFIX="› %f"
|
||||||
ZSH_THEME_RUBY_PROMPT_PREFIX="%F{red}‹"
|
ZSH_THEME_RUBY_PROMPT_PREFIX="%F{red}‹"
|
||||||
ZSH_THEME_RUBY_PROMPT_SUFFIX="›%f"
|
ZSH_THEME_RUBY_PROMPT_SUFFIX="›%f"
|
||||||
ZSH_THEME_VIRTUALENV_PREFIX="%F{red}("
|
|
||||||
ZSH_THEME_VIRTUALENV_SUFFIX=")%f "
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue