Created
April 1, 2011 20:23
-
-
Save slumos/898784 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ l # => ls | |
| $ l /dir # => ls /dir | |
| $ l file.txt # => less file.txt | |
| $ l file.gz # => less with auto-decompress (bzip too) | |
| $ l file.png # => quicklook file.png | |
| $ l file1 file2... # => ls file1 file2... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function l { | |
| if [[ $# -eq 1 && -f "$1" ]]; then | |
| pager "$1" | |
| else | |
| ls -CFL $* | |
| fi | |
| } | |
| function pager { | |
| case "$1" in | |
| *gz) | |
| LESSOPEN='|gzip -cdfq -- %s' "$PAGER" "$1" | |
| ;; | |
| *bz|*bz2) | |
| LESSOPEN='|bzip2 -cdfq -- %s' "$PAGER" "$1" | |
| ;; | |
| *pdf|*png|*jpg) | |
| ql "$1" | |
| ;; | |
| *) | |
| "$PAGER" "$1" | |
| ;; | |
| esac | |
| } | |
| function ql { | |
| # Open QuickLook on file (OSX) | |
| qlmanage -p $* | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment