bat icon indicating copy to clipboard operation
bat copied to clipboard

Print only vertical grid line

Open Aaron-Rumpler opened this issue 3 years ago • 5 comments

At the moment, the only way to get the vertical grid line that separates the line numbers and the actual content seems to be with --style=gird, but this also prints the horizontal grid lines at the top and bottom of the page, like this:

─────┬──────────────────────────────────────────────────────────────────────────
   1 │ This is a test file with a few lines.
   2 │ Here is a line.
   3 │ Here is another line.
   4 │ And this is the last line.
─────┴──────────────────────────────────────────────────────────────────────────

It would be good to be able to print only the vertical line without the horizontal lines, like this:

   1 │ This is a test file with a few lines.
   2 │ Here is a line.
   3 │ Here is another line.
   4 │ And this is the last line.

And ideally, that should also work with --style=rule, to produce something like this when two files are passed in:

   1 │ This is a test file with a few lines.
   2 │ Here is a line.
   3 │ Here is another line.
   4 │ And this is the last line.
─────┼──────────────────────────────────────────────────────────────────────────
   1 │ This is another test file. It has lines in it.
   2 │ This is the second line. The line above was the first.
   3 │ And this is the third and final line.

Aaron-Rumpler avatar Jan 15 '22 13:01 Aaron-Rumpler

Thank you for your feature request. May I ask what your use case is?

sharkdp avatar Jan 28 '22 21:01 sharkdp

Keeping the line numbers of the input matched to the line numbers of the output while still keeping the vertical separator between the line number and the line itself.

Aaron-Rumpler avatar Jan 31 '22 06:01 Aaron-Rumpler

I was just wondering, so let me ask you a simple question. Is it not enough to use nl command? For example, the command bat <filename> | nl -s " | " will print only vertical lines. (Or, does nl command not satisfy your requirements?)

t-mangoe avatar Jun 04 '22 01:06 t-mangoe

I would like something similar to this as well: I'd like a line between the line numbers and file content, and I'd like the line between the header and the file content, and lines between files, but I don't want a line before the first file or after the last file. That would allow more content to fit on one screen, while still keeping things separated.

joshtriplett avatar Aug 26 '22 14:08 joshtriplett

+1 This would be great for fzf preview windows with filename in preview label.

andrevmatos avatar Aug 23 '23 16:08 andrevmatos