1
0
mirror of https://github.com/robbyrussell/oh-my-zsh.git synced 2026-02-16 14:20:59 +01:00

11 Commits

Author SHA1 Message Date
Adil Erchouk
ac1335125c feat(macos): add support for Ghostty (#12890) 2025-03-20 20:36:07 +01:00
Marc Cornellà
407be8f036 feat(dirhistory): preserve forward directories with cde alias (#9328)
Closes #11954

Co-authored-by: Jeff Williams <jeffsmessages@gmail.com>
2025-03-20 20:29:47 +01:00
Gurram Siddarth Reddy
22ec00d1f6 chore(install): option case matching (#12881) 2025-03-20 20:29:33 +01:00
Carlo Sala
0c8c7bf2a8 docs(tmux): add note to README for #5282 2025-03-20 20:26:18 +01:00
Xin Li
ec07c79d7e feat(tmux): refresh global environments automatically (#5282) 2025-03-20 20:25:40 +01:00
Marc Cornellà
068299685c fix(dirhistory): support iTerm2 natural text key bindings (#11026)
Fixes #11026
Fixes #11407
2025-03-20 20:10:04 +01:00
Carlo Sala
5eaebdf0fe fix(termsupport): ensure ohmyzsh can run with set -eu
Closes #12870
2025-03-20 20:02:34 +01:00
Kristijan
85d60d489c feat(dirhistory): add support for ghostty (#12868) 2025-03-20 19:47:01 +01:00
bretello
070f823a84 feat(uv): alias uv with noglob (#12866) 2025-03-20 19:44:01 +01:00
Ken van der Eerden
6591606d56 feat(jira): add project command to open project (#12851) 2025-03-20 19:43:08 +01:00
Hong Xu
da2510c199 fix(nicoluaj): avoid overriding customization params (#12859) 2025-03-20 19:41:27 +01:00
14 changed files with 114 additions and 13 deletions

View File

@@ -26,7 +26,7 @@ autoload -Uz is-at-least
# This API is subject to change and optimization. Rely on it at your own risk. # This API is subject to change and optimization. Rely on it at your own risk.
function _omz_register_handler { function _omz_register_handler {
setopt localoptions noksharrays setopt localoptions noksharrays unset
typeset -ga _omz_async_functions typeset -ga _omz_async_functions
# we want to do nothing if there's no $1 function or we already set it up # we want to do nothing if there's no $1 function or we already set it up
if [[ -z "$1" ]] || (( ! ${+functions[$1]} )) \ if [[ -z "$1" ]] || (( ! ${+functions[$1]} )) \
@@ -44,6 +44,7 @@ function _omz_register_handler {
# Set up async handlers and callbacks # Set up async handlers and callbacks
function _omz_async_request { function _omz_async_request {
setopt localoptions noksharrays unset
local -i ret=$? local -i ret=$?
typeset -gA _OMZ_ASYNC_FDS _OMZ_ASYNC_PIDS _OMZ_ASYNC_OUTPUT typeset -gA _OMZ_ASYNC_FDS _OMZ_ASYNC_PIDS _OMZ_ASYNC_OUTPUT

View File

@@ -47,7 +47,7 @@ fi
# Runs before showing the prompt # Runs before showing the prompt
function omz_termsupport_precmd { function omz_termsupport_precmd {
[[ "${DISABLE_AUTO_TITLE:-}" != true ]] || return [[ "${DISABLE_AUTO_TITLE:-}" != true ]] || return 0
title "$ZSH_THEME_TERM_TAB_TITLE_IDLE" "$ZSH_THEME_TERM_TITLE_IDLE" title "$ZSH_THEME_TERM_TAB_TITLE_IDLE" "$ZSH_THEME_TERM_TITLE_IDLE"
} }
@@ -145,6 +145,7 @@ esac
# Identifies the directory using a file: URI scheme, including # Identifies the directory using a file: URI scheme, including
# the host name to disambiguate local vs. remote paths. # the host name to disambiguate local vs. remote paths.
function omz_termsupport_cwd { function omz_termsupport_cwd {
setopt localoptions unset
# Percent-encode the host and path names. # Percent-encode the host and path names.
local URL_HOST URL_PATH local URL_HOST URL_PATH
URL_HOST="$(omz_urlencode -P $HOST)" || return 1 URL_HOST="$(omz_urlencode -P $HOST)" || return 1

View File

@@ -60,3 +60,46 @@ to `/usr` again.
After that, <kbd>Alt</kbd> + <kbd>Down</kbd> will probably go to `/usr/bin` if `bin` is the first directory in alphabetical After that, <kbd>Alt</kbd> + <kbd>Down</kbd> will probably go to `/usr/bin` if `bin` is the first directory in alphabetical
order (depends on your `/usr` folder structure). <kbd>Alt</kbd> + <kbd>Up</kbd> will return to `/usr`, and once more will get order (depends on your `/usr` folder structure). <kbd>Alt</kbd> + <kbd>Up</kbd> will return to `/usr`, and once more will get
you to the root folder (`/`). you to the root folder (`/`).
### cde
This plugin also provides a `cde` alias that allows you to change to a directory without clearing the next directory stack.
This changes the default behavior of `dirhistory`, which is to clear the next directory stack when changing directories.
For example, if the shell was started, and the following commands were entered:
```shell
cd ~
cd /usr
cd share
cd doc
# <Alt + Left>
# <Alt + Left>
```
The directory stack would look like this:
```sh
➜ /usr typeset -pm dirhistory_\*
typeset -ax dirhistory_past=( /home/user /usr )
typeset -ax dirhistory_future=( /usr/share/doc /usr/share )
```
This means that pressing <kbd>Alt</kbd> + <kbd>Right</kbd>, you'd go to `/usr/share` and `/usr/share/doc` (the "future" directories).
If you run `cd /usr/bin`, the "future" directories will be removed, and you won't be able to access them with <kbd>Alt</kbd> + <kbd>Right</kbd>:
```sh
➜ /u/bin typeset -pm dirhistory_\*
typeset -ax dirhistory_past=( /home/user /usr )
typeset -ax dirhistory_future=( /usr/bin )
```
If you instead run `cde /usr/bin`, the "future" directories will be preserved:
```sh
➜ /u/bin typeset -pm dirhistory_\*
typeset -ax dirhistory_past=( /home/user /usr /usr/bin )
typeset -ax dirhistory_future=( /usr/share/doc /usr/share )
```

View File

@@ -11,9 +11,10 @@ dirhistory_past=($PWD)
dirhistory_future=() dirhistory_future=()
export dirhistory_past export dirhistory_past
export dirhistory_future export dirhistory_future
export DIRHISTORY_SIZE=30 export DIRHISTORY_SIZE=30
alias cde='dirhistory_cd'
# Pop the last element of dirhistory_past. # Pop the last element of dirhistory_past.
# Pass the name of the variable to return the result in. # Pass the name of the variable to return the result in.
# Returns the element if the array was not empty, # Returns the element if the array was not empty,
@@ -136,7 +137,11 @@ for keymap in emacs vicmd viins; do
case "$TERM_PROGRAM" in case "$TERM_PROGRAM" in
Apple_Terminal) bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back ;; # Terminal.app Apple_Terminal) bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back ;; # Terminal.app
iTerm.app) bindkey -M $keymap "^[^[[D" dirhistory_zle_dirhistory_back ;; # iTerm2 ghostty) bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back ;; # ghostty
iTerm.app)
bindkey -M $keymap "^[^[[D" dirhistory_zle_dirhistory_back
bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back
;;
esac esac
if (( ${+terminfo[kcub1]} )); then if (( ${+terminfo[kcub1]} )); then
@@ -151,7 +156,11 @@ for keymap in emacs vicmd viins; do
case "$TERM_PROGRAM" in case "$TERM_PROGRAM" in
Apple_Terminal) bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future ;; # Terminal.app Apple_Terminal) bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future ;; # Terminal.app
iTerm.app) bindkey -M $keymap "^[^[[C" dirhistory_zle_dirhistory_future ;; # iTerm2 ghostty) bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future ;; # ghostty
iTerm.app)
bindkey -M $keymap "^[^[[C" dirhistory_zle_dirhistory_future
bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future
;;
esac esac
if (( ${+terminfo[kcuf1]} )); then if (( ${+terminfo[kcuf1]} )); then
@@ -200,6 +209,7 @@ for keymap in emacs vicmd viins; do
case "$TERM_PROGRAM" in case "$TERM_PROGRAM" in
Apple_Terminal) bindkey -M $keymap "^[[A" dirhistory_zle_dirhistory_up ;; # Terminal.app Apple_Terminal) bindkey -M $keymap "^[[A" dirhistory_zle_dirhistory_up ;; # Terminal.app
iTerm.app) bindkey -M $keymap "^[^[[A" dirhistory_zle_dirhistory_up ;; # iTerm2 iTerm.app) bindkey -M $keymap "^[^[[A" dirhistory_zle_dirhistory_up ;; # iTerm2
ghostty) bindkey -M $keymap "^[[1;3A" dirhistory_zle_dirhistory_up ;; # ghostty
esac esac
if (( ${+terminfo[kcuu1]} )); then if (( ${+terminfo[kcuu1]} )); then
@@ -215,6 +225,7 @@ for keymap in emacs vicmd viins; do
case "$TERM_PROGRAM" in case "$TERM_PROGRAM" in
Apple_Terminal) bindkey -M $keymap "^[[B" dirhistory_zle_dirhistory_down ;; # Terminal.app Apple_Terminal) bindkey -M $keymap "^[[B" dirhistory_zle_dirhistory_down ;; # Terminal.app
iTerm.app) bindkey -M $keymap "^[^[[B" dirhistory_zle_dirhistory_down ;; # iTerm2 iTerm.app) bindkey -M $keymap "^[^[[B" dirhistory_zle_dirhistory_down ;; # iTerm2
ghostty) bindkey -M $keymap "^[[1;3B" dirhistory_zle_dirhistory_down ;; # ghostty
esac esac
if (( ${+terminfo[kcud1]} )); then if (( ${+terminfo[kcud1]} )); then

View File

@@ -26,6 +26,7 @@ This plugin supplies one command, `jira`, through which all its features are exp
| `jira new` | Opens a new Jira issue dialogue | | `jira new` | Opens a new Jira issue dialogue |
| `jira ABC-123` | Opens an existing issue | | `jira ABC-123` | Opens an existing issue |
| `jira ABC-123 m` | Opens an existing issue for adding a comment | | `jira ABC-123 m` | Opens an existing issue for adding a comment |
| `jira project ABC` | Opens JIRA project summary |
| `jira dashboard [rapid_view]` | Opens your JIRA dashboard | | `jira dashboard [rapid_view]` | Opens your JIRA dashboard |
| `jira mine` | Queries for your own issues | | `jira mine` | Queries for your own issues |
| `jira tempo` | Opens your JIRA Tempo | | `jira tempo` | Opens your JIRA Tempo |

View File

@@ -5,6 +5,7 @@ local -a _1st_arguments
_1st_arguments=( _1st_arguments=(
'new:create a new issue' 'new:create a new issue'
'mine:open my issues' 'mine:open my issues'
'project:open the project'
'dashboard:open the dashboard' 'dashboard:open the dashboard'
'tempo:open the tempo' 'tempo:open the tempo'
'reported:search for issues reported by a user' 'reported:search for issues reported by a user'

View File

@@ -8,6 +8,7 @@ jira Performs the default action
jira new Opens a new Jira issue dialogue jira new Opens a new Jira issue dialogue
jira ABC-123 Opens an existing issue jira ABC-123 Opens an existing issue
jira ABC-123 m Opens an existing issue for adding a comment jira ABC-123 m Opens an existing issue for adding a comment
jira project ABC Opens JIRA project summary
jira dashboard [rapid_view] Opens your JIRA dashboard jira dashboard [rapid_view] Opens your JIRA dashboard
jira mine Queries for your own issues jira mine Queries for your own issues
jira tempo Opens your JIRA Tempo jira tempo Opens your JIRA Tempo
@@ -88,6 +89,9 @@ function jira() {
elif [[ "$action" == "mine" ]]; then elif [[ "$action" == "mine" ]]; then
echo "Opening my issues" echo "Opening my issues"
open_command "${jira_url}/issues/?filter=-1" open_command "${jira_url}/issues/?filter=-1"
elif [[ "$action" == "project" ]]; then
echo "Opening project"
open_command "${jira_url}/jira/software/c/projects/${2}/summary"
elif [[ "$action" == "dashboard" ]]; then elif [[ "$action" == "dashboard" ]]; then
echo "Opening dashboard" echo "Opening dashboard"
if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then

View File

@@ -13,6 +13,7 @@ plugins=(... macos)
- [iTerm2](https://iterm2.com/) - [iTerm2](https://iterm2.com/)
- [Hyper](https://hyper.is/) - [Hyper](https://hyper.is/)
- [Tabby](https://tabby.sh/) - [Tabby](https://tabby.sh/)
- [Ghostty](https://ghostty.org)
## Commands ## Commands

View File

@@ -85,6 +85,12 @@ EOF
tell application "System Events" tell application "System Events"
tell process "Tabby" to keystroke "t" using command down tell process "Tabby" to keystroke "t" using command down
end tell end tell
EOF
elif [[ "$the_app" == 'ghostty' ]]; then
osascript >/dev/null <<EOF
tell application "System Events"
tell process "Ghostty" to keystroke "t" using command down
end tell
EOF EOF
else else
echo "$0: unsupported terminal app: $the_app" >&2 echo "$0: unsupported terminal app: $the_app" >&2
@@ -139,6 +145,12 @@ EOF
tell application "System Events" tell application "System Events"
tell process "Tabby" to keystroke "D" using command down tell process "Tabby" to keystroke "D" using command down
end tell end tell
EOF
elif [[ "$the_app" == 'ghostty' ]]; then
osascript >/dev/null <<EOF
tell application "System Events"
tell process "Ghostty" to keystroke "D" using command down
end tell
EOF EOF
else else
echo "$0: unsupported terminal app: $the_app" >&2 echo "$0: unsupported terminal app: $the_app" >&2
@@ -194,6 +206,12 @@ EOF
tell application "System Events" tell application "System Events"
tell process "Tabby" to keystroke "d" using command down tell process "Tabby" to keystroke "d" using command down
end tell end tell
EOF
elif [[ "$the_app" == 'ghostty' ]]; then
osascript >/dev/null <<EOF
tell application "System Events"
tell process "Ghostty" to keystroke "d" using command down
end tell
EOF EOF
else else
echo "$0: unsupported terminal app: $the_app" >&2 echo "$0: unsupported terminal app: $the_app" >&2

View File

@@ -31,6 +31,7 @@ The plugin also supports the following:
| Variable | Description | | Variable | Description |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `ZSH_TMUX_AUTOREFRESH` | Automatically refresh global environments (default: `true`) |
| `ZSH_TMUX_AUTOSTART` | Automatically starts tmux (default: `false`) | | `ZSH_TMUX_AUTOSTART` | Automatically starts tmux (default: `false`) |
| `ZSH_TMUX_AUTOSTART_ONCE` | Autostart only if tmux hasn't been started previously (default: `true`) | | `ZSH_TMUX_AUTOSTART_ONCE` | Autostart only if tmux hasn't been started previously (default: `true`) |
| `ZSH_TMUX_AUTOCONNECT` | Automatically connect to a previous session if it exits (default: `true`) | | `ZSH_TMUX_AUTOCONNECT` | Automatically connect to a previous session if it exits (default: `true`) |

View File

@@ -15,6 +15,8 @@ fi
: ${ZSH_TMUX_AUTOQUIT:=$ZSH_TMUX_AUTOSTART} : ${ZSH_TMUX_AUTOQUIT:=$ZSH_TMUX_AUTOSTART}
# Automatically name the new session based on the basename of PWD # Automatically name the new session based on the basename of PWD
: ${ZSH_TMUX_AUTONAME_SESSION:=false} : ${ZSH_TMUX_AUTONAME_SESSION:=false}
# Automatically pick up tmux environments
: ${ZSH_TMUX_AUTOREFRESH:=true}
# Set term to screen or screen-256color based on current terminal support # Set term to screen or screen-256color based on current terminal support
: ${ZSH_TMUX_DETACHED:=false} : ${ZSH_TMUX_DETACHED:=false}
# Set detached mode # Set detached mode
@@ -158,6 +160,15 @@ function _zsh_tmux_plugin_run() {
fi fi
} }
# Refresh tmux environment variables.
function _zsh_tmux_plugin_preexec()
{
local -a tmux_cmd
tmux_cmd=(command tmux)
eval $($tmux_cmd show-environment -s)
}
# Use the completions for tmux for our function # Use the completions for tmux for our function
compdef _tmux _zsh_tmux_plugin_run compdef _tmux _zsh_tmux_plugin_run
# Alias tmux to our wrapper function. # Alias tmux to our wrapper function.
@@ -184,3 +195,9 @@ if [[ -z "$TMUX" && "$ZSH_TMUX_AUTOSTART" == "true" && -z "$INSIDE_EMACS" && -z
_zsh_tmux_plugin_run _zsh_tmux_plugin_run
fi fi
fi fi
# Automatically refresh tmux environments if tmux is running.
if [[ -n "$TMUX" && "$ZSH_TMUX_AUTOREFRESH" == "true" ]] && tmux ls >/dev/null 2>/dev/null; then
autoload -U add-zsh-hook
add-zsh-hook preexec _zsh_tmux_plugin_preexec
fi

View File

@@ -3,6 +3,8 @@ if (( ! ${+commands[uv]} )); then
return return
fi fi
alias uv="noglob uv"
alias uva='uv add' alias uva='uv add'
alias uvexp='uv export --format requirements-txt --no-hashes --output-file requirements.txt --quiet' alias uvexp='uv export --format requirements-txt --no-hashes --output-file requirements.txt --quiet'
alias uvl='uv lock' alias uvl='uv lock'

12
themes/nicoulaj.zsh-theme Normal file → Executable file
View File

@@ -12,12 +12,12 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Customizable parameters. # Customizable parameters.
PROMPT_PATH_MAX_LENGTH=30 PROMPT_PATH_MAX_LENGTH=${PROMPT_PATH_MAX_LENGTH:-30}
PROMPT_DEFAULT_END= PROMPT_DEFAULT_END=${PROMPT_DEFAULT_END:-}
PROMPT_ROOT_END= PROMPT_ROOT_END=${PROMPT_ROOT_END:-}
PROMPT_SUCCESS_COLOR=$FG[071] PROMPT_SUCCESS_COLOR=${PROMPT_SUCCESS_COLOR:-$FG[071]}
PROMPT_FAILURE_COLOR=$FG[124] PROMPT_FAILURE_COLOR=${PROMPT_FAILURE_COLOR:-$FG[124]}
PROMPT_VCS_INFO_COLOR=$FG[242] PROMPT_VCS_INFO_COLOR=${PROMPT_VCS_INFO_COLOR:-$FG[242]}
# Set required options. # Set required options.
setopt promptsubst setopt promptsubst

View File

@@ -399,8 +399,8 @@ EOF
"$FMT_YELLOW" "$FMT_RESET" "$FMT_YELLOW" "$FMT_RESET"
read -r opt read -r opt
case $opt in case $opt in
y*|Y*|"") ;; [Yy]*|"") ;;
n*|N*) echo "Shell change skipped."; return ;; [Nn]*) echo "Shell change skipped."; return ;;
*) echo "Invalid choice. Shell change skipped."; return ;; *) echo "Invalid choice. Shell change skipped."; return ;;
esac esac