mirror of
https://github.com/junegunn/fzf.git
synced 2026-01-26 12:57:03 +08:00
Add --freeze-left=N option to keep the leftmost N fields visible
This commit is contained in:
@@ -104,6 +104,7 @@ Usage: fzf [options]
|
||||
--gap[=N] Render empty lines between each item
|
||||
--gap-line[=STR] Draw horizontal line on each gap using the string
|
||||
(default: '┈' or '-')
|
||||
--freeze-left=N Number of fields to freeze on the left
|
||||
--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)
|
||||
@@ -562,6 +563,7 @@ type Options struct {
|
||||
Case Case
|
||||
Normalize bool
|
||||
Nth []Range
|
||||
FreezeLeft int
|
||||
WithNth func(Delimiter) func([]Token, int32) string
|
||||
AcceptNth func(Delimiter) func([]Token, int32) string
|
||||
Delimiter Delimiter
|
||||
@@ -2695,6 +2697,10 @@ func parseOptions(index *int, opts *Options, allArgs []string) error {
|
||||
if opts.Nth, err = splitNth(str); err != nil {
|
||||
return err
|
||||
}
|
||||
case "--freeze-left":
|
||||
if opts.FreezeLeft, err = nextInt("number of fields required"); err != nil {
|
||||
return err
|
||||
}
|
||||
case "--with-nth":
|
||||
str, err := nextString("nth expression required")
|
||||
if err != nil {
|
||||
@@ -3338,6 +3344,10 @@ func parseOptions(index *int, opts *Options, allArgs []string) error {
|
||||
return errors.New("empty jump labels")
|
||||
}
|
||||
|
||||
if opts.FreezeLeft < 0 {
|
||||
return errors.New("number of fields to freeze must be a non-negative integer")
|
||||
}
|
||||
|
||||
if validateJumpLabels {
|
||||
for _, r := range opts.JumpLabels {
|
||||
if r < 32 || r > 126 {
|
||||
|
||||
Reference in New Issue
Block a user