|
|
@ -57,7 +57,7 @@ const usage = `usage: fzf [options]
|
|
|
|
--layout=LAYOUT Choose layout: [default|reverse|reverse-list]
|
|
|
|
--layout=LAYOUT Choose layout: [default|reverse|reverse-list]
|
|
|
|
--border Draw border above and below the finder
|
|
|
|
--border Draw border above and below the finder
|
|
|
|
--margin=MARGIN Screen margin (TRBL / TB,RL / T,RL,B / T,R,B,L)
|
|
|
|
--margin=MARGIN Screen margin (TRBL / TB,RL / T,RL,B / T,R,B,L)
|
|
|
|
--inline-info Display finder info inline with the query
|
|
|
|
--info=STYLE Finder info style [default|inline|hidden]
|
|
|
|
--prompt=STR Input prompt (default: '> ')
|
|
|
|
--prompt=STR Input prompt (default: '> ')
|
|
|
|
--header=STR String to print as header
|
|
|
|
--header=STR String to print as header
|
|
|
|
--header-lines=N The first N lines of the input are treated as header
|
|
|
|
--header-lines=N The first N lines of the input are treated as header
|
|
|
@ -142,6 +142,14 @@ const (
|
|
|
|
layoutReverseList
|
|
|
|
layoutReverseList
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type infoStyle int
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
|
|
|
infoDefault infoStyle = iota
|
|
|
|
|
|
|
|
infoInline
|
|
|
|
|
|
|
|
infoHidden
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
type previewOpts struct {
|
|
|
|
type previewOpts struct {
|
|
|
|
command string
|
|
|
|
command string
|
|
|
|
position windowPosition
|
|
|
|
position windowPosition
|
|
|
@ -177,7 +185,7 @@ type Options struct {
|
|
|
|
Hscroll bool
|
|
|
|
Hscroll bool
|
|
|
|
HscrollOff int
|
|
|
|
HscrollOff int
|
|
|
|
FileWord bool
|
|
|
|
FileWord bool
|
|
|
|
InlineInfo bool
|
|
|
|
InfoStyle infoStyle
|
|
|
|
JumpLabels string
|
|
|
|
JumpLabels string
|
|
|
|
Prompt string
|
|
|
|
Prompt string
|
|
|
|
Query string
|
|
|
|
Query string
|
|
|
@ -230,7 +238,7 @@ func defaultOptions() *Options {
|
|
|
|
Hscroll: true,
|
|
|
|
Hscroll: true,
|
|
|
|
HscrollOff: 10,
|
|
|
|
HscrollOff: 10,
|
|
|
|
FileWord: false,
|
|
|
|
FileWord: false,
|
|
|
|
InlineInfo: false,
|
|
|
|
InfoStyle: infoDefault,
|
|
|
|
JumpLabels: defaultJumpLabels,
|
|
|
|
JumpLabels: defaultJumpLabels,
|
|
|
|
Prompt: "> ",
|
|
|
|
Prompt: "> ",
|
|
|
|
Query: "",
|
|
|
|
Query: "",
|
|
|
@ -904,6 +912,20 @@ func parseLayout(str string) layoutType {
|
|
|
|
return layoutDefault
|
|
|
|
return layoutDefault
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func parseInfoStyle(str string) infoStyle {
|
|
|
|
|
|
|
|
switch str {
|
|
|
|
|
|
|
|
case "default":
|
|
|
|
|
|
|
|
return infoDefault
|
|
|
|
|
|
|
|
case "inline":
|
|
|
|
|
|
|
|
return infoInline
|
|
|
|
|
|
|
|
case "hidden":
|
|
|
|
|
|
|
|
return infoHidden
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
errorExit("invalid info style (expected: default / inline / hidden)")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return infoDefault
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func parsePreviewWindow(opts *previewOpts, input string) {
|
|
|
|
func parsePreviewWindow(opts *previewOpts, input string) {
|
|
|
|
// Default
|
|
|
|
// Default
|
|
|
|
opts.position = posRight
|
|
|
|
opts.position = posRight
|
|
|
@ -1109,10 +1131,15 @@ func parseOptions(opts *Options, allArgs []string) {
|
|
|
|
opts.FileWord = true
|
|
|
|
opts.FileWord = true
|
|
|
|
case "--no-filepath-word":
|
|
|
|
case "--no-filepath-word":
|
|
|
|
opts.FileWord = false
|
|
|
|
opts.FileWord = false
|
|
|
|
|
|
|
|
case "--info":
|
|
|
|
|
|
|
|
opts.InfoStyle = parseInfoStyle(
|
|
|
|
|
|
|
|
nextString(allArgs, &i, "info style required"))
|
|
|
|
|
|
|
|
case "--no-info":
|
|
|
|
|
|
|
|
opts.InfoStyle = infoHidden
|
|
|
|
case "--inline-info":
|
|
|
|
case "--inline-info":
|
|
|
|
opts.InlineInfo = true
|
|
|
|
opts.InfoStyle = infoInline
|
|
|
|
case "--no-inline-info":
|
|
|
|
case "--no-inline-info":
|
|
|
|
opts.InlineInfo = false
|
|
|
|
opts.InfoStyle = infoDefault
|
|
|
|
case "--jump-labels":
|
|
|
|
case "--jump-labels":
|
|
|
|
opts.JumpLabels = nextString(allArgs, &i, "label characters required")
|
|
|
|
opts.JumpLabels = nextString(allArgs, &i, "label characters required")
|
|
|
|
validateJumpLabels = true
|
|
|
|
validateJumpLabels = true
|
|
|
@ -1220,6 +1247,8 @@ func parseOptions(opts *Options, allArgs []string) {
|
|
|
|
opts.MinHeight = atoi(value)
|
|
|
|
opts.MinHeight = atoi(value)
|
|
|
|
} else if match, value := optString(arg, "--layout="); match {
|
|
|
|
} else if match, value := optString(arg, "--layout="); match {
|
|
|
|
opts.Layout = parseLayout(value)
|
|
|
|
opts.Layout = parseLayout(value)
|
|
|
|
|
|
|
|
} else if match, value := optString(arg, "--info="); match {
|
|
|
|
|
|
|
|
opts.InfoStyle = parseInfoStyle(value)
|
|
|
|
} else if match, value := optString(arg, "--toggle-sort="); match {
|
|
|
|
} else if match, value := optString(arg, "--toggle-sort="); match {
|
|
|
|
parseToggleSort(opts.Keymap, value)
|
|
|
|
parseToggleSort(opts.Keymap, value)
|
|
|
|
} else if match, value := optString(arg, "--expect="); match {
|
|
|
|
} else if match, value := optString(arg, "--expect="); match {
|
|
|
|