Support for custom syntaxes, add 'Markdown extended' theme, closes #10

This commit is contained in:
sharkdp 2018-04-24 00:44:39 +02:00
parent 38762c34d9
commit a7232a6ecc
2 changed files with 16 additions and 4 deletions

View file

@ -19,10 +19,17 @@
## Installation
```
``` bash
cargo install bat
mkdir -p ~/.config/bat/themes
cd ~/.config/bat/themes
wget https://raw.githubusercontent.com/cj/sublime/master/Color%20Scheme%20-%20Default/Monokai.tmTheme
git clone https://github.com/jonschlinkert/sublime-monokai-extended
ln -s "sublime-monokai-extended/Monokai Extended.tmTheme" Default.tmTheme
mkdir -p ~/.config/bat/syntax
cd ~/.config/bat/syntax
git clone https://github.com/sublimehq/Packages/
rm -rf Packages/Markdown
git clone https://github.com/jonschlinkert/sublime-markdown-extended
```

View file

@ -186,9 +186,14 @@ fn run(matches: &ArgMatches) -> Result<()> {
let theme_dir = home_dir.join(".config").join("bat").join("themes");
let theme_set = ThemeSet::load_from_folder(theme_dir)
.map_err(|_| io::Error::new(ErrorKind::Other, "Could not load themes"))?;
let theme = &theme_set.themes["Monokai"];
let theme = &theme_set.themes["Default"];
let syntax_set = SyntaxSet::load_defaults_nonewlines();
// TODO: let mut syntax_set = SyntaxSet::load_defaults_nonewlines();
let mut syntax_set = SyntaxSet::new();
let syntax_dir = home_dir.join(".config").join("bat").join("syntax");
let _ = syntax_set.load_syntaxes(syntax_dir, false);
syntax_set.load_plain_text_syntax();
syntax_set.link_syntaxes();
if let Some(files) = matches.values_of("FILE") {
for file in files {