summaryrefslogtreecommitdiff
path: root/src/options.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2024-10-01 19:15:17 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2024-10-01 19:15:17 +0900
commit1a32220ca94ae897cab408a9eeaed094a8a739f1 (patch)
treeeac828f9fbc416c7d19fb74bc65e8e45d01b4786 /src/options.go
parent4161403a1d6286f6ba7898b1f22f30d01d85b8dc (diff)
downloadfzf-1a32220ca94ae897cab408a9eeaed094a8a739f1.tar.gz
Add --gap option to put empty lines between items
Diffstat (limited to 'src/options.go')
-rw-r--r--src/options.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/options.go b/src/options.go
index 62c8c0c3..b0ab6b1d 100644
--- a/src/options.go
+++ b/src/options.go
@@ -56,6 +56,7 @@ Usage: fzf [options]
--wrap Enable line wrap
--wrap-sign=STR Indicator for wrapped lines
--no-multi-line Disable multi-line display of items when using --read0
+ --gap[=N] Render empty lines between each item
--keep-right Keep the right end of the line visible on overflow
--scroll-off=LINES Number of screen lines to keep above or below when
scrolling to the top or to the bottom (default: 0)
@@ -473,6 +474,7 @@ type Options struct {
Header []string
HeaderLines int
HeaderFirst bool
+ Gap int
Ellipsis *string
Scrollbar *string
Margin [4]sizeSpec
@@ -579,6 +581,7 @@ func defaultOptions() *Options {
Header: make([]string, 0),
HeaderLines: 0,
HeaderFirst: false,
+ Gap: 0,
Ellipsis: nil,
Scrollbar: nil,
Margin: defaultMargin(),
@@ -2343,6 +2346,12 @@ func parseOptions(index *int, opts *Options, allArgs []string) error {
opts.HeaderFirst = true
case "--no-header-first":
opts.HeaderFirst = false
+ case "--gap":
+ if opts.Gap, err = optionalNumeric(allArgs, &i, 1); err != nil {
+ return err
+ }
+ case "--no-gap":
+ opts.Gap = 0
case "--ellipsis":
str, err := nextString(allArgs, &i, "ellipsis string required")
if err != nil {
@@ -2630,6 +2639,10 @@ func parseOptions(index *int, opts *Options, allArgs []string) error {
if opts.HeaderLines, err = atoi(value); err != nil {
return err
}
+ } else if match, value := optString(arg, "--gap="); match {
+ if opts.Gap, err = atoi(value); err != nil {
+ return err
+ }
} else if match, value := optString(arg, "--ellipsis="); match {
str := firstLine(value)
opts.Ellipsis = &str