Skip to content

Commit 668bebe

Browse files
Merge pull request #294 from wesQ3/custom-ruler-width
Add config for file header ruler width (rulerWidth)
2 parents 1e68aa6 + c31ce93 commit 668bebe

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ By default the separator for the file header uses Unicode line drawing character
7272
git config --bool --global diff-so-fancy.useUnicodeRuler false
7373
```
7474

75+
### rulerWidth
76+
77+
By default the separator for the file header spans the full width of the terminal. Use this setting to set the width of the file header manually.
78+
```
79+
git config --global diff-so-fancy.rulerWidth 47 # git log's commit header width
80+
```
81+
7582
## Contributing
7683

7784
Pull requests are quite welcome, and should target the [`next` branch](https://github.com/so-fancy/diff-so-fancy/tree/next). We are also looking for any feedback or ideas on how to make diff-so-fancy even *fancier*.

diff-so-fancy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ my $change_hunk_indicators = git_config_boolean("diff-so-fancy.changeHunkInd
2222
my $strip_leading_indicators = git_config_boolean("diff-so-fancy.stripLeadingSymbols","true");
2323
my $mark_empty_lines = git_config_boolean("diff-so-fancy.markEmptyLines","true");
2424
my $use_unicode_dash_for_ruler = git_config_boolean("diff-so-fancy.useUnicodeRuler","true");
25+
my $ruler_width = git_config("diff-so-fancy.rulerWidth", undef);
2526
my $git_strip_prefix = git_config_boolean("diff.noprefix","false");
2627
my $has_stdin = has_stdin();
2728

@@ -557,7 +558,7 @@ sub trim {
557558
# Print a line of em-dash or line-drawing chars the full width of the screen
558559
sub horizontal_rule {
559560
my $color = $_[0] || "";
560-
my $width = `tput cols`;
561+
my $width = $ruler_width || `tput cols`;
561562

562563
if (is_windows()) {
563564
$width--;

0 commit comments

Comments
 (0)