@@ -41,6 +41,9 @@ pub struct Config<'a> {
4141 /// The character width of the terminal
4242 pub term_width: usize,
4343
44+ /// The width of tab characters.
45+ pub tab_width: usize,
46+
4447 /// Whether or not to simply loop through all input (`cat` mode)
4548 pub loop_through: bool,
4649
@@ -276,6 +279,15 @@ impl App {
276279 'unbuffered'). The output is always unbuffered - this option \
277280 is simply ignored.",
278281 ),
282+ ).arg(
283+ Arg::with_name("tabs")
284+ .long("tabs")
285+ .short("t")
286+ .takes_value(true)
287+ .value_name("width")
288+ .help("Sets the tab width.")
289+ .long_help("Sets the tab width. Use a width of 0 to pass tabs through \
290+ directly"),
279291 ).arg(
280292 Arg::with_name("terminal-width")
281293 .long("terminal-width")
@@ -393,6 +405,12 @@ impl App {
393405 || self.matches.value_of("color") == Some("always")
394406 || self.matches.value_of("decorations") == Some("always")),
395407 files,
408+ tab_width: self
409+ .matches
410+ .value_of("tabs")
411+ .and_then(|w| w.parse().ok())
412+ .or_else(|| env::var("BAT_TABS").ok().and_then(|w| w.parse().ok()))
413+ .unwrap_or(8),
396414 theme: self
397415 .matches
398416 .value_of("theme")