diff options
author | eth-p <32112321+eth-p@users.noreply.github.com> | 2018-09-14 09:11:40 -0700 |
---|---|---|
committer | David Peter <sharkdp@users.noreply.github.com> | 2018-09-14 18:30:43 +0200 |
commit | 254efac9c26ab6ca924ccb6a5a89f1ef3789b460 (patch) | |
tree | a029e91c9a46c960b5e2af569f552deeac732e05 | |
parent | dcec32211707946cc81abfc9d33dda53650899dc (diff) |
Added section to README on using Cygwin.
-rw-r--r-- | README.md | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -288,6 +288,26 @@ well as in newer versions of bash. On earlier versions of Windows, you can use don’t have any other pagers installed, you can disable paging entirely by passing `--paging=never` or by setting `BAT_PAGER` to an empty string. +### Cygwin + +`bat` on Windows does not natively support Cygwin's unix-style paths (`/cygdrive/*`). When passed an absolute cygwin path as an argument, `bat` will encounter the following error: `The system cannot find the path specified. (os error 3)` + +This can be solved by creating a wrapper or adding the following function to your `.bash_profile` file: + +```shell +bat() { + local index + local args=("$@") + for index in $(seq 0 ${#args[@]}) ; do + case "${args[index]}" in + -*) continue;; + *) [ -e "${args[index]}" ] && args[index]="$(cygpath --windows "${args[index]}")";; + esac + done + command bat "${args[@]}" +} +``` + ## Troubleshooting ### Terminals & colors |