1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2026-01-22 01:07:36 +08:00

Compare commits

..

4 Commits

Author SHA1 Message Date
Carlo Sala
aca048814b
fix(theme-and-appearance): avoid infinite recursion 2023-02-22 15:35:12 +01:00
冯不游
a24e91908a
feat(marked): remove unnecessary code 2023-02-22 12:14:29 +01:00
冯不游
221eb9b90a
feat(marktext): add plugin
Closes #11507
2023-02-22 12:14:22 +01:00
Filippo Bonazzi
a4f08ad238
feat(extract): support obscpio format (#11511)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
2023-02-22 10:16:28 +01:00
7 changed files with 36 additions and 16 deletions

View File

@ -47,7 +47,7 @@ fi
# enable diff color if possible.
if command diff --color /dev/null /dev/null &>/dev/null; then
function color-diff {
diff --color $@
command diff --color $@
}
alias diff="color-diff"
compdef _diff color-diff # compdef is already loaded by this point

View File

@ -1,10 +1,10 @@
# extract plugin
This plugin defines a function called `extract` that extracts the archive file
you pass it, and it supports a wide variety of archive filetypes.
This plugin defines a function called `extract` that extracts the archive file you pass it, and it supports a
wide variety of archive filetypes.
This way you don't have to know what specific command extracts a file, you just
do `extract <filename>` and the function takes care of the rest.
This way you don't have to know what specific command extracts a file, you just do `extract <filename>` and
the function takes care of the rest.
To use it, add `extract` to the plugins array in your zshrc file:
@ -15,7 +15,7 @@ plugins=(... extract)
## Supported file extensions
| Extension | Description |
|:------------------|:-------------------------------------|
| :---------------- | :----------------------------------- |
| `7z` | 7zip file |
| `Z` | Z archive (LZW) |
| `apk` | Android app file |
@ -32,6 +32,7 @@ plugins=(... extract)
| `lrz` | LRZ archive |
| `lz4` | LZ4 archive |
| `lzma` | LZMA archive |
| `obscpio` | cpio archive used on OBS |
| `rar` | WinRAR archive |
| `rpm` | RPM package |
| `sublime-package` | Sublime Text package |
@ -57,5 +58,5 @@ plugins=(... extract)
| `zst` | Zstandard file (zstd) |
| `zpaq` | Zpaq file |
See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for
more information regarding archive formats.
See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for more information
regarding archive formats.

View File

@ -3,5 +3,5 @@
_arguments \
'(-r --remove)'{-r,--remove}'[Remove archive.]' \
"*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|cab|cpio|deb|ear|gz|ipa|ipsw|jar|lrz|lz4|lzma|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lrz|tar.lz|tar.lz4|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst|zpaq)(-.)'" \
"*::archive file:_files -g '(#i)*.(7z|Z|apk|aar|bz2|cab|cpio|deb|ear|gz|ipa|ipsw|jar|lrz|lz4|lzma|obscpio|rar|rpm|sublime-package|tar|tar.bz2|tar.gz|tar.lrz|tar.lz|tar.lz4|tar.xz|tar.zma|tar.zst|tbz|tbz2|tgz|tlz|txz|tzst|war|whl|xpi|xz|zip|zst|zpaq)(-.)'" \
&& return 0

View File

@ -72,7 +72,7 @@ EOF
builtin cd -q ..; command rm *.tar.* debian-binary ;;
(*.zst) unzstd "$file" ;;
(*.cab) cabextract -d "$extract_dir" "$file" ;;
(*.cpio) cpio -idmvF "$file" ;;
(*.cpio|*.obscpio) cpio -idmvF "$file" ;;
(*.zpaq) zpaq x "$file" ;;
(*)
echo "extract: '$file' cannot be extracted" >&2

View File

@ -3,10 +3,5 @@
# If marked is passed a file, open it in Marked
#
function marked() {
if [ "$1" ]
then
open -a "marked 2.app" "$1"
else
open -a "marked 2.app"
fi
open -a "marked 2.app" "$1"
}

View File

@ -0,0 +1,17 @@
## marktext
Plugin for MarkText, a previewer for Markdown files on Mac OS X
### Requirements
* [MarkText](https://github.com/marktext/marktext)
### Usage
* If `marktext` is called without an argument, open MarkText
* If `marktext` is passed a file, open it in MarkText
### Credits
* just copied from plugins/marked2, all credits to marked2 plugin author

View File

@ -0,0 +1,7 @@
#
# If marktext is called without an argument, open MarkText
# If marktext is passed a file, open it in MarkText
#
function marktext() {
open -a "MarkText.app" "$1"
}