mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-12 15:34:50 +08:00
Compare commits
3 Commits
61dccacbd9
...
7ef87c7774
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ef87c7774 | ||
|
|
92aed2e936 | ||
|
|
b25811450c |
@ -77,7 +77,15 @@ EOF
|
|||||||
(*.lzma) unlzma "$full_path" ;;
|
(*.lzma) unlzma "$full_path" ;;
|
||||||
(*.z) uncompress "$full_path" ;;
|
(*.z) uncompress "$full_path" ;;
|
||||||
(*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl|*.vsix|*.crx|*.pk3|*.pk4) unzip "$full_path" ;;
|
(*.zip|*.war|*.jar|*.ear|*.sublime-package|*.ipa|*.ipsw|*.xpi|*.apk|*.aar|*.whl|*.vsix|*.crx|*.pk3|*.pk4) unzip "$full_path" ;;
|
||||||
(*.rar) unrar x -ad "$full_path" ;;
|
(*.rar)
|
||||||
|
if (( $+commands[unrar] )); then
|
||||||
|
unrar x -ad "$full_path"
|
||||||
|
elif (( $+commands[unar] )); then
|
||||||
|
unar -o . "$full_path"
|
||||||
|
else
|
||||||
|
echo "extract: cannot extract RAR files: install unrar or unar" >&2
|
||||||
|
success=1
|
||||||
|
fi ;;
|
||||||
(*.rpm)
|
(*.rpm)
|
||||||
rpm2cpio "$full_path" | cpio --quiet -id ;;
|
rpm2cpio "$full_path" | cpio --quiet -id ;;
|
||||||
(*.7z | *.7z.[0-9]* | *.pk7) 7za x "$full_path" ;;
|
(*.7z | *.7z.[0-9]* | *.pk7) 7za x "$full_path" ;;
|
||||||
|
|||||||
@ -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,9 +24,12 @@ __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
|
||||||
|
# Skip hidden dirs unless explicitly allowed
|
||||||
|
if [[ -z "$ZIC_SHOW_HIDDEN" || "$ZIC_SHOW_HIDDEN" != "true" ]]; then
|
||||||
if [[ "${line[1]}" == "." ]]; then
|
if [[ "${line[1]}" == "." ]]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
echo "$line"
|
echo "$line"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
@ -40,9 +43,12 @@ __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
|
||||||
|
# Skip hidden dirs unless explicitly allowed
|
||||||
|
if [[ -z "$ZIC_SHOW_HIDDEN" || "$ZIC_SHOW_HIDDEN" != "true" ]]; then
|
||||||
if [[ "${seg[1]}" != "." && "${line[1]}" == "." ]]; then
|
if [[ "${seg[1]}" != "." && "${line[1]}" == "." ]]; then
|
||||||
continue
|
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
|
||||||
echo "$line"
|
echo "$line"
|
||||||
@ -60,9 +66,12 @@ __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
|
||||||
|
# Skip hidden dirs unless explicitly allowed
|
||||||
|
if [[ -z "$ZIC_SHOW_HIDDEN" || "$ZIC_SHOW_HIDDEN" != "true" ]]; then
|
||||||
if [[ "${seg[1]}" != "." && "${line[1]}" == "." ]]; then
|
if [[ "${seg[1]}" != "." && "${line[1]}" == "." ]]; then
|
||||||
continue
|
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
|
||||||
echo "$line"
|
echo "$line"
|
||||||
@ -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…
Reference in New Issue
Block a user