add plugin and readme

This commit is contained in:
Fabian Dellwing 2020-09-23 09:38:28 +02:00
parent 819cf5dc69
commit d7d5df4f6c
2 changed files with 28 additions and 1 deletions

View File

@ -1 +1,22 @@
# zsh-bat
# zsh-bat
[oh-my-zsh plugin](https://github.com/robbyrussell/oh-my-zsh) for easy integration with [bat](https://github.com/sharkdp/bat).
## Prerequisites
You should have `bat` installed, this plugin will do nothing otherwise.
## Install
Create a new directory in `$ZSH_CUSTOM/plugins` called `zsh-bat` and clone this repo into that directory.
```
git clone https://github.com/fdellwing/zsh-bat.git $ZSH_CUSTOM/plugins/zsh-bat
```
Add `zsh-bat` to your plugin list in `~/.zshrc`.
## Usage
This plugin will replace `cat` with `bat`. To run the real `cat` command, you can use `rcat`. It will also enable syntax highlighting for the `man` command.
For usage help with `bat`, see [sharkdp/bat](https://github.com/sharkdp/bat).

6
zsh-bat.plugin.zsh Normal file
View File

@ -0,0 +1,6 @@
if command -v bat >/dev/null 2>&1; then
alias rcat=$(which cat)
alias cat=$(which bat)
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
fi