bat
bat copied to clipboard
Tab's not shown with -d --tabs 0
IIUC in diff -d
mode if I pass --tabs 0
it should display tabs as it is but in my terminals (iTerm2 and Terminal) its converting those to spaces. This (--tabs = 0
) is also what delta
uses to display tabs and it seems to have the same problem.
I can verify my file has tabs by using cat
or bat -A
as you can see in the attached image.
I know bat is printing spaces because if I copy the content of my terminal after bat
prints it and past it into sublime text, I can see the spaces. Attached image for reference.
Side note: it's good that you've ruled out your terminal converting tabs to spaces when copying, as some of them do that.
Indeed. I have been looking through iTerm settings. There are a few things related to tabs stops but AFAICT I couldn’t find anything that talks about conversion. And either way it won’t just apply to bat
.
It might also be the pager (less
) which converts tabs. Can you try with --paging=never
/-P
?
I don't think this is related to -d
/--diff
--paging=never
and -P
doesn't help.
I can not reproduce this. Works for me with -P
.
Can you please post the output of bat --diagnostic
in order for us to get more information about your system?
Software version
bat 0.20.0
Operating system
macOS 11.6.5 (Darwin 20.6.0)
Command-line
bat --diagnostic
Environment variables
SHELL=/bin/zsh
PAGER=less
LESS=-R
LANG=en_GB.UTF-8
LC_ALL=<not set>
BAT_PAGER=<not set>
BAT_CACHE_PATH=<not set>
BAT_CONFIG_PATH=<not set>
BAT_OPTS=<not set>
BAT_STYLE=<not set>
BAT_TABS=0
BAT_THEME=<not set>
XDG_CONFIG_HOME=<not set>
XDG_CACHE_HOME=<not set>
COLORTERM=truecolor
NO_COLOR=<not set>
MANPAGER=<not set>
Config file
Could not read contents of '/Users/abbaswasim/.config/bat/config': No such file or directory (os error 2).
Compile time information
- Profile: release
- Target triple: x86_64-apple-darwin
- Family: unix
- OS: macos
- Architecture: x86_64
- Pointer width: 64
- Endian: little
- CPU features: fxsr,sse,sse2,sse3,ssse3
- Host: x86_64-apple-darwin
Less version
> less --version
less 487 (POSIX regular expressions)
Copyright (C) 1984-2016 Mark Nudelman
less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Homepage: http://www.greenwoodsoftware.com/less
By the way I have also tried it in bash
same behaviour.
--paging=never
and-P
doesn't help.
Okay. And does it only happen with -d
/--diff
?
No just bat
has the same behavior. I originally saw this while using delta
And then I thought delta must be using ‘bat’s diff version so tried that. But as you said in one of your earlier comments it’s not diff
Related
Actually scratch that. The reason I was using diff with tabs 0
Is because just bat on its own always prints spaces and that’s the default behavior it prints tabs only with ‘-A` AFAIK
@abbaswasim Can you please summarize the current state? is this still a problem?
@sharkdp the status hasn't changed. The issue is still there. Its a problem for me because I can't see tab to spaces or spaces to tabs changes in my git diffs.
In summary:
bat --tabs 0
shouldn't convert tabs
in a file to spaces and it does.