diff options
Diffstat (limited to 'plugins/colorize')
-rw-r--r-- | plugins/colorize/README.md | 20 | ||||
-rw-r--r-- | plugins/colorize/colorize.plugin.zsh | 2 |
2 files changed, 13 insertions, 9 deletions
diff --git a/plugins/colorize/README.md b/plugins/colorize/README.md index 8971fa011..d37443011 100644 --- a/plugins/colorize/README.md +++ b/plugins/colorize/README.md @@ -6,12 +6,22 @@ Colorize will highlight the content based on the filename extension. If it can't method for a given extension, it will try to find one by looking at the file contents. If no highlight method is found it will just cat the file normally, without syntax highlighting. -To use it, add colorize to the plugins array of your zshrc file: +## Setup + +To use it, add colorize to the plugins array of your `~/.zshrc` file: ``` plugins=(... colorize) ``` + ## Configuration +### Requirements + +This plugin requires that either of the following tools be installed: + +* Chroma: [https://github.com/alecthomas/chroma](https://github.com/alecthomas/chroma) +* Pygments be installed: [pygments.org](https://pygments.org/) + ### Colorize tool Colorize supports `pygmentize` and `chroma` as syntax highlighter. By default colorize uses `pygmentize` unless it's not installed and `chroma` is. This can be overridden by the `ZSH_COLORIZE_TOOL` environment variable: @@ -30,7 +40,7 @@ ZSH_COLORIZE_STYLE="colorful" ## Usage -* `ccat <file> [files]`: colorize the contents of the file (or files, if more than one are provided). +* `ccat <file> [files]`: colorize the contents of the file (or files, if more than one are provided). If no arguments are passed it will colorize the standard input or stdin. * `cless <file> [files]`: colorize the contents of the file (or files, if more than one are provided) and @@ -40,9 +50,3 @@ Note that `cless` will behave as less when provided more than one file: you have the commands `:n` for next and `:p` for previous. The downside is that less options are not supported. But you can circumvent this by either using the LESS environment variable, or by running `ccat file1 file2|less --opts`. In the latter form, the file contents will be concatenated and presented by less as a single file. - -## Requirements - -You have to either install Pygments: [pygments.org](http://pygments.org/download.html) - -Or install chroma: [https://github.com/alecthomas/chroma](https://github.com/alecthomas/chroma) diff --git a/plugins/colorize/colorize.plugin.zsh b/plugins/colorize/colorize.plugin.zsh index e250397be..3e91a9f46 100644 --- a/plugins/colorize/colorize.plugin.zsh +++ b/plugins/colorize/colorize.plugin.zsh @@ -63,7 +63,7 @@ colorize_via_pygmentize() { colorize_via_pygmentize_less() ( # this function is a subshell so tmp_files can be shared to cleanup function - declare -a tmp_files + declare -a tmp_files cleanup () { [[ ${#tmp_files} -gt 0 ]] && rm -f "${tmp_files[@]}" |