1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-10-16 11:40:46 +00:00

Compare commits

...

14 commits

Author SHA1 Message Date
Adam Šír
b6b52f6cd8
Merge 1b4703387d into 9bcafe1c27 2024-09-18 20:37:55 +02:00
Erik Teichmann
9bcafe1c27
feat(functions): add takezip (#12670) 2024-09-18 20:26:38 +02:00
Ruslan Tursunov
3151c9c1a3
fix(git): re-add accidentally removed gcn (#12681) 2024-09-18 12:58:00 +02:00
PukNgae Cryolitia
ac325a7cab
feat(bgnotify): add config to pass extra args (#12679) 2024-09-15 23:20:59 +02:00
dependabot[bot]
ec7d01faf8
chore(deps): bump urllib3 in /.github/workflows/dependencies (#12677)
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.2.2 to 2.2.3.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.2.2...2.2.3)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-15 19:36:24 +02:00
dependabot[bot]
8c13f021bf
chore(deps): bump idna in /.github/workflows/dependencies (#12678)
Bumps [idna](https://github.com/kjd/idna) from 3.8 to 3.9.
- [Release notes](https://github.com/kjd/idna/releases)
- [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.rst)
- [Commits](https://github.com/kjd/idna/compare/v3.8...v3.9)

---
updated-dependencies:
- dependency-name: idna
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-15 19:36:08 +02:00
Marc Cornellà
e3e80b98b5
chore(jsontools): change link to NDJSON spec (#12671)
Fixes #12671
2024-09-15 15:14:38 +02:00
Marc Cornellà
a84bc2dadd
fix(python)!: remove harmful ipython alias (#12676)
BREAKING CHANGE: the `ipython` alias was incorrectly trying to manually call
ipython from the installed module in the virtual environment, when actually
a command already exists when loading the virtual environment. This change
removes the unnecessary alias and allows calling the right command.

Fixes #12676
2024-09-15 15:12:22 +02:00
Saravana J
33ac2ee30f
fix(git): update prefix map for modified files (#12674) 2024-09-15 08:17:43 +02:00
ohmyzsh[bot]
f709cd4548
feat(wd): update to 7054de2b (#12675)
Co-authored-by: ohmyzsh[bot] <54982679+ohmyzsh[bot]@users.noreply.github.com>
2024-09-15 08:16:50 +02:00
Adam Šír
1b4703387d
Merge branch 'ohmyzsh:master' into adamsir/git-checkout-interactive 2024-05-09 12:07:54 +02:00
Adam Šír
2cf9ad072d
Update plugins/git-checkout-interactive/README.md
Co-authored-by: Olivia (Zoe) <zoe.i2k1@gmail.com>
2024-05-09 12:07:06 +02:00
Adam Sir
7ab8271cd9
limit output to 10 last branches; configurable 2024-02-28 11:28:36 +01:00
Adam Sir
09976595be
feat(plugin): git checkout interactive 2023-11-01 12:37:17 +01:00
16 changed files with 108 additions and 37 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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