mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-10-16 19:50:09 +00:00
Compare commits
14 commits
5d719fcf96
...
b6b52f6cd8
Author | SHA1 | Date | |
---|---|---|---|
|
b6b52f6cd8 | ||
|
9bcafe1c27 | ||
|
3151c9c1a3 | ||
|
ac325a7cab | ||
|
ec7d01faf8 | ||
|
8c13f021bf | ||
|
e3e80b98b5 | ||
|
a84bc2dadd | ||
|
33ac2ee30f | ||
|
f709cd4548 | ||
|
1b4703387d | ||
|
2cf9ad072d | ||
|
7ab8271cd9 | ||
|
09976595be |
16 changed files with 108 additions and 37 deletions
2
.github/dependencies.yml
vendored
2
.github/dependencies.yml
vendored
|
@ -28,7 +28,7 @@ dependencies:
|
|||
plugins/wd:
|
||||
repo: mfaerevaag/wd
|
||||
branch: master
|
||||
version: tag:v0.7.1
|
||||
version: tag:v0.9.0
|
||||
precopy: |
|
||||
set -e
|
||||
rm -r test
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
certifi==2024.8.30
|
||||
charset-normalizer==3.3.2
|
||||
idna==3.8
|
||||
idna==3.9
|
||||
PyYAML==6.0.2
|
||||
requests==2.32.3
|
||||
semver==3.0.2
|
||||
urllib3==2.2.2
|
||||
urllib3==2.2.3
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -227,7 +227,7 @@ function _omz_git_prompt_status() {
|
|||
prefix_constant_map=(
|
||||
'\?\? ' 'UNTRACKED'
|
||||
'A ' 'ADDED'
|
||||
'M ' 'ADDED'
|
||||
'M ' 'MODIFIED'
|
||||
'MM ' 'MODIFIED'
|
||||
' M ' 'MODIFIED'
|
||||
'AM ' 'MODIFIED'
|
||||
|
|
|
@ -38,6 +38,7 @@ One can configure a few things:
|
|||
- `bgnotify_bell` enabled or disables the terminal bell (default true)
|
||||
- `bgnotify_threshold` sets the notification threshold time (default 6 seconds)
|
||||
- `function bgnotify_formatted` lets you change the notification. You can for instance customize the message and pass in an icon.
|
||||
- `bgnotify_extraargs` appends extra args to notifier (e.g. `-e` for notify-send to create a transient notification)
|
||||
|
||||
Use these by adding a function definition before the your call to source. Example:
|
||||
|
||||
|
|
|
@ -117,15 +117,15 @@ function bgnotify {
|
|||
local icon="$3"
|
||||
if (( ${+commands[terminal-notifier]} )); then # macOS
|
||||
local term_id=$(bgnotify_programid)
|
||||
terminal-notifier -message "$message" -title "$title" ${=icon:+-appIcon "$icon"} ${=term_id:+-activate "$term_id"} &>/dev/null
|
||||
terminal-notifier -message "$message" -title "$title" ${=icon:+-appIcon "$icon"} ${=term_id:+-activate "$term_id"} ${=bgnotify_extraargs:-} &>/dev/null
|
||||
elif (( ${+commands[growlnotify]} )); then # macOS growl
|
||||
growlnotify -m "$title" "$message"
|
||||
growlnotify -m "$title" "$message" ${=bgnotify_extraargs:-}
|
||||
elif (( ${+commands[notify-send]} )); then
|
||||
notify-send "$title" "$message" ${=icon:+--icon "$icon"}
|
||||
notify-send "$title" "$message" ${=icon:+--icon "$icon"} ${=bgnotify_extraargs:-}
|
||||
elif (( ${+commands[kdialog]} )); then # KDE
|
||||
kdialog --title "$title" --passivepopup "$message" 5
|
||||
kdialog --title "$title" --passivepopup "$message" 5 ${=bgnotify_extraargs:-}
|
||||
elif (( ${+commands[notifu]} )); then # cygwin
|
||||
notifu /m "$message" /p "$title" ${=icon:+/i "$icon"}
|
||||
notifu /m "$message" /p "$title" ${=icon:+/i "$icon"} ${=bgnotify_extraargs:-}
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
15
plugins/git-checkout-interactive/README.md
Normal file
15
plugins/git-checkout-interactive/README.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
# lol
|
||||
|
||||
This plugin adds a command that lets you interactively switch between branches.
|
||||
|
||||
To use it, add `git-checkout-interactive` to the plugins array in your `.zshrc` file:
|
||||
|
||||
```zsh
|
||||
plugins=(... git-checkout-interactive)
|
||||
```
|
||||
|
||||
## Usage Examples
|
||||
|
||||
```sh
|
||||
gci
|
||||
```
|
|
@ -0,0 +1,57 @@
|
|||
#######################################
|
||||
# git checkout interactive #
|
||||
#######################################
|
||||
|
||||
function git-checkout-interactive() {
|
||||
local ITEMS_TO_SHOW=10
|
||||
# Get all branches sorted by committer date, along with their last commit hash
|
||||
local branches
|
||||
branches=$(git for-each-ref --count="$ITEMS_TO_SHOW" --sort=-committerdate --format='%(refname:short) %(objectname:short)' refs/heads/)
|
||||
|
||||
# Parse branches
|
||||
local branch_list=()
|
||||
local current_branch
|
||||
current_branch=$(git rev-parse --abbrev-ref HEAD)
|
||||
if [[ "$current_branch" == "" ]]; then
|
||||
return 0
|
||||
fi
|
||||
while read -r branch hash; do
|
||||
if [[ "$branch" == "$current_branch" ]]; then
|
||||
echo "On branch $branch \n"
|
||||
else
|
||||
branch_list+=("$branch ($hash)")
|
||||
fi
|
||||
done <<< "$branches"
|
||||
|
||||
if (( ${#branch_list} == 0 )); then
|
||||
echo "No other branches available."
|
||||
return 0
|
||||
else
|
||||
echo "Select a branch to switch to:\n"
|
||||
fi
|
||||
|
||||
# Display menu
|
||||
local i=1
|
||||
for branch in "${branch_list[@]}"; do
|
||||
echo "($i) $branch"
|
||||
((i++))
|
||||
done
|
||||
echo -n "\nPlease enter your choice: "
|
||||
|
||||
# Handle user input
|
||||
while :; do
|
||||
local choice
|
||||
read -r choice
|
||||
if (( choice > 0 && choice <= ${#branch_list[@]} )); then
|
||||
local selected_branch="${branch_list[$((choice))]}"
|
||||
local target_branch="${selected_branch//->}"
|
||||
target_branch="${target_branch%% *}"
|
||||
git checkout "$target_branch"
|
||||
break
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
alias gci="git-checkout-interactive || return 0"
|
|
@ -73,6 +73,7 @@ plugins=(... git)
|
|||
| `gcans!` | `git commit --verbose --all --signoff --no-edit --amend` |
|
||||
| `gcann!` | `git commit --verbose --all --date=now --no-edit --amend` |
|
||||
| `gc!` | `git commit --verbose --amend` |
|
||||
| `gcn` | `git commit --verbose --no-edit` |
|
||||
| `gcn!` | `git commit --verbose --no-edit --amend` |
|
||||
| `gcs` | `git commit -S` |
|
||||
| `gcss` | `git commit -S -s` |
|
||||
|
|
|
@ -197,6 +197,7 @@ alias gcan!='git commit --verbose --all --no-edit --amend'
|
|||
alias gcans!='git commit --verbose --all --signoff --no-edit --amend'
|
||||
alias gcann!='git commit --verbose --all --date=now --no-edit --amend'
|
||||
alias gc!='git commit --verbose --amend'
|
||||
alias gcn='git commit --verbose --no-edit'
|
||||
alias gcn!='git commit --verbose --no-edit --amend'
|
||||
alias gcf='git config --list'
|
||||
alias gdct='git describe --tags $(git rev-list --tags --max-count=1)'
|
||||
|
|
|
@ -19,7 +19,7 @@ Usage is simple... just take your json data and pipe it into the appropriate jso
|
|||
|
||||
### Supports NDJSON (Newline Delimited JSON)
|
||||
|
||||
The plugin also supports [NDJSON](http://ndjson.org/) input, which means all functions
|
||||
The plugin also supports [NDJSON](https://github.com/ndjson/ndjson-spec) input, which means all functions
|
||||
have an alternative function that reads and processes the input line by line. These
|
||||
functions have the same name except using `ndjson` instead of `json`:
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ plugins=(... python)
|
|||
| Command | Description |
|
||||
| ---------------- | -------------------------------------------------------------------------------------- |
|
||||
| `py` | Runs `python3`. Only set if `py` is not installed. |
|
||||
| `ipython` | Runs the appropriate `ipython` version according to the activated virtualenv |
|
||||
| `pyfind` | Finds .py files recursively in the current directory |
|
||||
| `pyclean [dirs]` | Deletes byte-code and cache files from a list of directories or the current one |
|
||||
| `pygrep <text>` | Looks for `text` in `*.py` files in the current directory, recursively |
|
||||
|
|
|
@ -43,9 +43,6 @@ function pyuserpaths() {
|
|||
# Grep among .py files
|
||||
alias pygrep='grep -nr --include="*.py"'
|
||||
|
||||
# Run proper IPython regarding current virtualenv (if any)
|
||||
alias ipython='python3 -c "import sys; del sys.path[0]; import IPython; sys.exit(IPython.start_ipython())"'
|
||||
|
||||
# Share local directory as a HTTP server
|
||||
alias pyserver="python3 -m http.server"
|
||||
|
||||
|
|
|
@ -115,9 +115,11 @@ wd() {
|
|||
|
||||
3. Install manpage (optional):
|
||||
|
||||
Move manpage into an appropriate directory, then trigger `mandb` to discover it
|
||||
|
||||
```zsh
|
||||
sudo cp ~/.local/wd/wd.1 /usr/share/man/man1/wd.1
|
||||
sudo chmod 644 /usr/share/man/man1/wd.1
|
||||
sudo install -m 644 ~/.local/wd/wd.1 /usr/share/man/man1/wd.1
|
||||
sudo mandb /usr/share/man/man1
|
||||
```
|
||||
|
||||
**Note:** when pulling and updating `wd`, you'll need to repeat step 3 should the manpage change
|
||||
|
@ -139,10 +141,11 @@ 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`:
|
||||
`wd` comes with an `fzf`-powered browse feature to fuzzy search through all your warp points. It's available through the `wd browse` command. For quick access you can set up an alias or keybind in your `.zshrc`:
|
||||
|
||||
```zsh
|
||||
bindkey ${FZF_WD_BINDKEY:-'^B'} fuzzy_wd_widget
|
||||
# ctrl-b to open the fzf browser
|
||||
bindkey ${FZF_WD_BINDKEY:-'^B'} wd_browse_widget
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
@ -255,12 +258,6 @@ wd --version
|
|||
wd --config ./file <command>
|
||||
```
|
||||
|
||||
* Force `exit` with return code after running. This is not default, as it will *exit your terminal*, though required for testing/debugging.
|
||||
|
||||
```zsh
|
||||
wd --debug <command>
|
||||
```
|
||||
|
||||
* Silence all output:
|
||||
|
||||
```zsh
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/zsh
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# WARP DIRECTORY
|
||||
# ==============
|
||||
|
@ -18,4 +18,3 @@ 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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/zsh
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# WARP DIRECTORY
|
||||
# ==============
|
||||
|
@ -8,7 +8,7 @@
|
|||
# @github.com/mfaerevaag/wd
|
||||
|
||||
# version
|
||||
readonly WD_VERSION=0.7.0
|
||||
readonly WD_VERSION=0.9.0
|
||||
|
||||
# colors
|
||||
readonly WD_BLUE="\033[96m"
|
||||
|
@ -90,7 +90,6 @@ Commands:
|
|||
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)
|
||||
-c | --config Specify config file (default ~/.warprc)
|
||||
-q | --quiet Suppress all output
|
||||
-f | --force Allows overwriting without warning (for add & clean)
|
||||
|
@ -426,7 +425,6 @@ wd_export_static_named_directories() {
|
|||
WD_CONFIG=${WD_CONFIG:-$HOME/.warprc}
|
||||
local WD_QUIET=0
|
||||
local WD_EXIT_CODE=0
|
||||
local WD_DEBUG=0
|
||||
|
||||
# Parse 'meta' options first to avoid the need to have them before
|
||||
# other commands. The `-D` flag consumes recognized options so that
|
||||
|
@ -436,7 +434,6 @@ zparseopts -D -E \
|
|||
c:=wd_alt_config -config:=wd_alt_config \
|
||||
q=wd_quiet_mode -quiet=wd_quiet_mode \
|
||||
v=wd_print_version -version=wd_print_version \
|
||||
d=wd_debug_mode -debug=wd_debug_mode \
|
||||
f=wd_force_mode -force=wd_force_mode
|
||||
|
||||
if [[ ! -z $wd_print_version ]]
|
||||
|
@ -583,9 +580,4 @@ unset args
|
|||
unset points
|
||||
unset val &> /dev/null # fixes issue #1
|
||||
|
||||
if [[ -n $wd_debug_mode ]]
|
||||
then
|
||||
exit $WD_EXIT_CODE
|
||||
else
|
||||
unset wd_debug_mode
|
||||
fi
|
||||
return $WD_EXIT_CODE
|
||||
|
|
Loading…
Reference in a new issue