mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-05 01:46:46 +01:00
Merge b25811450c into e9fc134236
This commit is contained in:
commit
884da71343
2 changed files with 26 additions and 11 deletions
|
|
@ -19,3 +19,14 @@ This plugin provides an interactive way to change directories in zsh using fzf.
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Press tab for completion as usual, it'll launch fzf automatically. Check fzf’s [readme](https://github.com/junegunn/fzf#search-syntax) for more search syntax usage.
|
Press tab for completion as usual, it'll launch fzf automatically. Check fzf’s [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
|
||||||
|
```
|
||||||
|
|
@ -24,8 +24,11 @@ __zic_matched_subdir_list() {
|
||||||
fi
|
fi
|
||||||
find -L "$dir" -mindepth 1 -maxdepth 1 -type d 2>/dev/null \
|
find -L "$dir" -mindepth 1 -maxdepth 1 -type d 2>/dev/null \
|
||||||
| cut -b $(( ${length} + 2 ))- | command sed '/^$/d' | while read -r line; do
|
| cut -b $(( ${length} + 2 ))- | command sed '/^$/d' | while read -r line; do
|
||||||
if [[ "${line[1]}" == "." ]]; then
|
# Skip hidden dirs unless explicitly allowed
|
||||||
continue
|
if [[ -z "$ZIC_SHOW_HIDDEN" || "$ZIC_SHOW_HIDDEN" != "true" ]]; then
|
||||||
|
if [[ "${line[1]}" == "." ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
echo "$line"
|
echo "$line"
|
||||||
done
|
done
|
||||||
|
|
@ -40,8 +43,11 @@ __zic_matched_subdir_list() {
|
||||||
find -L "$dir" -mindepth 1 -maxdepth 1 -type d \
|
find -L "$dir" -mindepth 1 -maxdepth 1 -type d \
|
||||||
2>/dev/null | cut -b $(( ${length} + 2 ))- | command sed '/^$/d' \
|
2>/dev/null | cut -b $(( ${length} + 2 ))- | command sed '/^$/d' \
|
||||||
| while read -r line; do
|
| while read -r line; do
|
||||||
if [[ "${seg[1]}" != "." && "${line[1]}" == "." ]]; then
|
# Skip hidden dirs unless explicitly allowed
|
||||||
continue
|
if [[ -z "$ZIC_SHOW_HIDDEN" || "$ZIC_SHOW_HIDDEN" != "true" ]]; then
|
||||||
|
if [[ "${seg[1]}" != "." && "${line[1]}" == "." ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$zic_case_insensitive" = "true" ]; then
|
if [ "$zic_case_insensitive" = "true" ]; then
|
||||||
if [[ "$line:u" == "$seg:u"* ]]; then
|
if [[ "$line:u" == "$seg:u"* ]]; then
|
||||||
|
|
@ -60,8 +66,11 @@ __zic_matched_subdir_list() {
|
||||||
find -L "$dir" -mindepth 1 -maxdepth 1 -type d \
|
find -L "$dir" -mindepth 1 -maxdepth 1 -type d \
|
||||||
2>/dev/null | cut -b $(( ${length} + 2 ))- | command sed '/^$/d' \
|
2>/dev/null | cut -b $(( ${length} + 2 ))- | command sed '/^$/d' \
|
||||||
| while read -r line; do
|
| while read -r line; do
|
||||||
if [[ "${seg[1]}" != "." && "${line[1]}" == "." ]]; then
|
# Skip hidden dirs unless explicitly allowed
|
||||||
continue
|
if [[ -z "$ZIC_SHOW_HIDDEN" || "$ZIC_SHOW_HIDDEN" != "true" ]]; then
|
||||||
|
if [[ "${seg[1]}" != "." && "${line[1]}" == "." ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$zic_case_insensitive" = "true" ]; then
|
if [ "$zic_case_insensitive" = "true" ]; then
|
||||||
if [[ "$line:u" == *"$seg:u"* ]]; then
|
if [[ "$line:u" == *"$seg:u"* ]]; then
|
||||||
|
|
@ -164,11 +173,6 @@ zic-completion() {
|
||||||
|
|
||||||
[ -z "$__zic_default_completion" ] && {
|
[ -z "$__zic_default_completion" ] && {
|
||||||
binding=$(bindkey '^I')
|
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]
|
[[ $binding =~ 'undefined-key' ]] || __zic_default_completion=$binding[(s: :w)2]
|
||||||
unset binding
|
unset binding
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue