All Projects → chinanf-boy → bat-zh

chinanf-boy / bat-zh

Licence: other
🇨🇳翻译: <bat> 一个`cat(1)`克隆与语法高亮和Git集成 ❤️ 校对 ✅

Projects that are alternatives of or similar to bat-zh

tokei-zh
🇨🇳翻译: <tokei> 代码信息的统计程序 ❤️ 校对 ✅
Stars: ✭ 92 (-28.68%)
Mutual labels:  docs, zh
mdBook-zh
中文翻译:<mdBook> 一个从 Markdown 文件创建现代在线书籍的实用程序 ❤️ 更新 ✅ 2022-1-8
Stars: ✭ 24 (-81.4%)
Mutual labels:  docs, zh
ripgrep-zh
中文翻译:<BurntSushi/ripgrep> 一个面向行的搜索工具 ❤️ 校对 ✅
Stars: ✭ 82 (-36.43%)
Mutual labels:  docs, zh
V-zh
中文翻译:<vlang-io/V> V 编程语言(未发布,但从数据看,值得了解一下) ❤️ ❤️
Stars: ✭ 12 (-90.7%)
Mutual labels:  docs, zh
laravel-openapi
Generate OpenAPI specification for Laravel Applications
Stars: ✭ 269 (+108.53%)
Mutual labels:  docs
jx-docs
Source code used to build the Jenkins X documentation and website
Stars: ✭ 86 (-33.33%)
Mutual labels:  docs
flutter-docs-ptbr
Documentação do Flutter em pt-BR
Stars: ✭ 20 (-84.5%)
Mutual labels:  docs
chm-documentation
chm documentation PostgreSQL pgadmin3 SQLAlchemy Django Flask jinja2 webpy doc chm compiled html help Postgres Postgre документация russian
Stars: ✭ 17 (-86.82%)
Mutual labels:  docs
db-doc
📝一款生成在线/离线数据库文档的小工具
Stars: ✭ 98 (-24.03%)
Mutual labels:  docs
gorgonia.github.io
The source code (and website) for gorgonia.org
Stars: ✭ 12 (-90.7%)
Mutual labels:  docs
unicode-programming
Unicode programming examples
Stars: ✭ 33 (-74.42%)
Mutual labels:  docs
nakama-docs
Documentation for Nakama social and realtime server.
Stars: ✭ 44 (-65.89%)
Mutual labels:  docs
linter-alex
📝Sensitive, considerate writing before you merge your Pull Requests
Stars: ✭ 67 (-48.06%)
Mutual labels:  docs
resharper-devguide
Developer guide for the ReSharper Platform
Stars: ✭ 65 (-49.61%)
Mutual labels:  docs
Cat-Face-Detector-with-OpenCV-and-JavaFX
📹 A Small OpenCV (Open Source Computer Vision) Example, who has the ability to detect multiple cat faces at the same time 🐱
Stars: ✭ 24 (-81.4%)
Mutual labels:  cat
go-logsink
the multi machine cat over protocol buffers and websocket
Stars: ✭ 34 (-73.64%)
Mutual labels:  cat
docs
The Form Tools documentation.
Stars: ✭ 15 (-88.37%)
Mutual labels:  docs
plugin.video.tv3.cat
Kodi addon
Stars: ✭ 16 (-87.6%)
Mutual labels:  cat
lunarvim.org
Website for LunarVim
Stars: ✭ 70 (-45.74%)
Mutual labels:  docs
cpeditor.github.io
The official website of CP Editor 📝
Stars: ✭ 17 (-86.82%)
Mutual labels:  docs

bat translate-svg

「 一个cat(1)克隆,搭配语法高亮和Git集成。 」

中文 | english


更新

翻译的原文 与日期 最新更新 更多
commit 2018 8.30 last 中文翻译

贡献

欢迎 👏 勘误/校对/更新贡献 😊 具体贡献请看

生活

If help, buy me coffee —— 营养跟不上了,给我来瓶营养快线吧! 💰


bat - a cat clone with wings
Build Status license Version info
一个 cat(1) 克隆与语法高亮和Git集成。.

目录

语法高亮显示

bat支持大量编程和mark**语言的语法高亮显示:

Syntax highlighting example

Git集成

batgit沟通,显示关于修改的索引 (参见左侧栏) :

Git integration example

自动分页

如果输出对于一个屏幕来说太大,bat可以less控制自己的输出管道,.

文件串联

哦..你也可以用它来串联文件 😉 . 每当bat检测到非交互式终端,它将回退到打印普通文件内容.

如何使用

在终端上显示单个文件

> bat README.md

一次显示多个文件

> bat src/*.rs

从stdin读取,指定明确语言

> yaml2json .travis.yml | json_pp | bat -l json
> curl -s https://raw.githubusercontent.com/sharkdp/bat/master/src/main.rs | bat -l rs

作为cat的替代品:

bat > note.md  # 快速 创建一个新文件

bat header.md content.md footer.md > document.md

bat -n main.rs  # 展示行数 (only)

bat f - g  # 先输出 'f', 之后是 stdin, 之后是 'g'.

安装

Ubuntu

一些和其他基于Debian的Linux发行版.

releases页面,下载最新的.deb包裹,并通过以下方式安装:

sudo dpkg -i bat_0.6.0_amd64.deb  # adapt version number and architecture

Arch Linux

你可以安装bat,官方来源:

pacman -S bat

Void Linux

你可以通过xbps-install安装bat:

xbps-install -S bat

FreeBSD

您可以用pkg安装预编译的bat:

pkg install bat

或者在FreeBSD上,自己构建它:

cd /usr/ports/textproc/bat
make install

macOS

你可以安装bat,通过brew:

brew install bat

二进制文件

releases页面,其中预建版本的bat,有许多不同的架构, 要看清楚啦.

源项目

如果你想建立bat的源代码,您需要Rust 1.26或更高版本. 然后你可以使用cargo建立一切:

cargo install bat

在macOS上,您可能必须安装cmake (brew install cmake) 以便构建一些依赖项.

定制

高亮主题

使用bat --list-themes获取语​​法高亮显示的所有可用主题的列表. 选择TwoDark主题,运行bat--theme=TwoDark选项,或设置BAT_THEME环境变量为TwoDark. 在你的shell启动文件中使用export BAT_THEME="TwoDark",使更改永久化.

输出风格

你可以使用--style这个外观的选项,控制bat输出. 您可以使用--style=numbers,changes例如,仅显示Git更改和行号 ,但没有网格和文件头.

添加新语法/语言定义

bat使用优秀的语法高亮的库syntect. syntect可以阅读任何Sublime Text的.sublime-syntax文件和主题. 要添加新语法定义,请执行以下操作.

使用语法定义文件创建一个文件夹:

BAT_CONFIG_DIR="$(bat cache --config-dir)"

mkdir -p "$BAT_CONFIG_DIR/syntaxes"
cd "$BAT_CONFIG_DIR/syntaxes"

# 把 '.sublime-syntax' 语言定义文件 放到
# 这个syntaxes目录 (or 它的 子目录), 例如:
git clone https://github.com/tellnobody1/sublime-purescript-syntax

现在使用以下命令将这些文件解析为二进制缓存:

bat cache --init

最后,使用bat --list-languages检查新语言是否可用.

如果您想要返回默认设置,请使用:

bat cache --clear

添加新主题

这与我们添加新语法定义的方式非常相似.

首先,使用新语法高亮显示主题创建一个文件夹:

BAT_CONFIG_DIR="$(bat cache --config-dir)"

mkdir -p "$BAT_CONFIG_DIR/themes"
cd "$BAT_CONFIG_DIR/themes"

# 下载一个主题是 '.tmTheme' 格式, for example:
git clone https://github.com/greggb/sublime-snazzy

# 更新缓存
bat cache --init

最后,使用bat --list-themes检查新主题是否可用.

使用不同的页面方式

bat使用在PAGER环境变量中,指定的页面方式. 如果未设置此变量,less就是默认使用的. 如果要使用其他页面方式,可以修改PAGER变量或设置BAT_PAGER环境变量,以覆盖在PAGER中指定的内容. 如果要将命令行参数传递给页面方式,则需要创建一个 小的shell脚本 作为包装器,例如:

#!/bin/bash

less --tabs 4 -RF "$@"

故障排除

终端和颜色

bat控制终端还是没有真彩色支持. 但是,语法高亮主题中的颜色未针对8位颜色进行优化,因此强烈建议您使用具有24位真彩色支持的终端 (terminator,konsole,iTerm2,...) . 看看本文了解更多详情和完整的支持truecolor的终端列表.

确保你的truecolor终端,设置了COLORTERM变量到truecolor或者24bit. 除此以外,bat将无法确定是否支持24位转义序列 (并回退到8位颜色) .

开发

# Recursive clone to retrieve all submodules
git clone --recursive https://github.com/sharkdp/bat

# Build (debug version)
cd bat
cargo build

# Run unit tests and integration tests
cargo test

# Install (release version)
cargo install

# 构建 bat 二进制文件, 若修改了的语法和主题
bash assets/create.sh
cargo install -f

项目目标和替代方案

bat试图实现以下目标:

  • 提供美观,高级的语法高亮
  • 与Git集成以显示文件修改
  • 是 (POSIX)cat 的直接替代品
  • 提供用户友好的命令行界面

如果你正在寻找类似的程序,有很多选择. 看这个文件进行比较.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].