1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2026-01-05 20:57:46 +08:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Surya
ce56a84e79
Merge b25811450c into f84341c574 2025-12-12 12:00:13 +05:30
tDwtp
f84341c574
fix(git): git_status_prompt should respect spaces in prefixes (#13478) 2025-12-11 15:05:23 +01:00
Surya
b25811450c zsh-interactive-cd: add option to include hidden directories
Signed-off-by: Surya <SuryaGopisetty30@gmail.com>
2025-09-21 22:00:08 +05:30
3 changed files with 27 additions and 12 deletions

View File

@ -117,7 +117,7 @@ function _omz_git_prompt_status() {
fi
# For each status prefix, do a regex comparison
for status_prefix in ${(k)prefix_constant_map}; do
for status_prefix in "${(@k)prefix_constant_map}"; do
local status_constant="${prefix_constant_map[$status_prefix]}"
local status_regex=$'(^|\n)'"$status_prefix"

View File

@ -19,3 +19,14 @@ This plugin provides an interactive way to change directories in zsh using fzf.
## Usage
Press tab for completion as usual, it'll launch fzf automatically. Check fzfs [readme](https://github.com/junegunn/fzf#search-syntax) for more search syntax usage.
### Hidden Directories
By default, `zsh-interactive-cd` hides directories that start with `.` (dotfolders).
You can enable hidden directories in the suggestion list by setting:
```zsh
# Show hidden directories in interactive cd
export ZIC_SHOW_HIDDEN=true
```

View File

@ -24,8 +24,11 @@ __zic_matched_subdir_list() {
fi
find -L "$dir" -mindepth 1 -maxdepth 1 -type d 2>/dev/null \
| cut -b $(( ${length} + 2 ))- | command sed '/^$/d' | while read -r line; do
if [[ "${line[1]}" == "." ]]; then
continue
# Skip hidden dirs unless explicitly allowed
if [[ -z "$ZIC_SHOW_HIDDEN" || "$ZIC_SHOW_HIDDEN" != "true" ]]; then
if [[ "${line[1]}" == "." ]]; then
continue
fi
fi
echo "$line"
done
@ -40,8 +43,11 @@ __zic_matched_subdir_list() {
find -L "$dir" -mindepth 1 -maxdepth 1 -type d \
2>/dev/null | cut -b $(( ${length} + 2 ))- | command sed '/^$/d' \
| while read -r line; do
if [[ "${seg[1]}" != "." && "${line[1]}" == "." ]]; then
continue
# Skip hidden dirs unless explicitly allowed
if [[ -z "$ZIC_SHOW_HIDDEN" || "$ZIC_SHOW_HIDDEN" != "true" ]]; then
if [[ "${seg[1]}" != "." && "${line[1]}" == "." ]]; then
continue
fi
fi
if [ "$zic_case_insensitive" = "true" ]; then
if [[ "$line:u" == "$seg:u"* ]]; then
@ -60,8 +66,11 @@ __zic_matched_subdir_list() {
find -L "$dir" -mindepth 1 -maxdepth 1 -type d \
2>/dev/null | cut -b $(( ${length} + 2 ))- | command sed '/^$/d' \
| while read -r line; do
if [[ "${seg[1]}" != "." && "${line[1]}" == "." ]]; then
continue
# Skip hidden dirs unless explicitly allowed
if [[ -z "$ZIC_SHOW_HIDDEN" || "$ZIC_SHOW_HIDDEN" != "true" ]]; then
if [[ "${seg[1]}" != "." && "${line[1]}" == "." ]]; then
continue
fi
fi
if [ "$zic_case_insensitive" = "true" ]; then
if [[ "$line:u" == *"$seg:u"* ]]; then
@ -164,11 +173,6 @@ zic-completion() {
[ -z "$__zic_default_completion" ] && {
binding=$(bindkey '^I')
# $binding[(s: :w)2]
# The command substitution and following word splitting to determine the
# default zle widget for ^I formerly only works if the IFS parameter contains
# a space via $binding[(w)2]. Now it specifically splits at spaces, regardless
# of IFS.
[[ $binding =~ 'undefined-key' ]] || __zic_default_completion=$binding[(s: :w)2]
unset binding
}