Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Binding ¶
type Binding struct { // Keyboard shortcut, e.g. `ctrl-n`. Keys string // fzf action, see `man fzf`. Action string // Description which will be displayed as a fzf header if not empty. Description string }
Binding represents a keyboard shortcut bound to an action in fzf.
type Fzf ¶
type Fzf struct {
// contains filtered or unexported fields
}
Fzf filters a set of fields using fzf.
After adding all the fields with Add, use Selection to get the filtered results.
func New ¶
New runs a fzf instance.
To show a preview of each line, provide a previewCmd which will be executed by fzf.
type NoteFinder ¶
type NoteFinder struct {
// contains filtered or unexported fields
}
NoteFinder wraps a note.Finder and filters its result interactively using fzf.
func NewNoteFinder ¶
func NewNoteFinder(opts NoteFinderOpts, finder note.Finder, terminal *term.Terminal) *NoteFinder
func (*NoteFinder) Find ¶
func (f *NoteFinder) Find(opts note.FinderOpts) ([]note.Match, error)
type NoteFinderOpts ¶
type NoteFinderOpts struct { // Indicates whether fzf is opened for every query, even if empty. AlwaysFilter bool // Preview command to run when selecting a note. PreviewCmd opt.String // When non nil, a "create new note from query" binding will be added to // fzf to create a note in this directory. NewNoteDir *zk.Dir // Absolute path to the notebook. BasePath string // Path to the working directory. CurrentPath string }
NoteFinderOpts holds the configuration for the fzf notes finder.
The absolute path to the notebook (BasePath) and the working directory (CurrentPath) are used to make the path of each note relative to the working directory.
type Opts ¶
type Opts struct { // Preview command executed by fzf when hovering a line. PreviewCmd opt.String // Amount of space between two non-empty fields. Padding int // Delimiter used by fzf between fields. Delimiter string // List of key bindings enabled in fzf. Bindings []Binding }
Opts holds the options used to run fzf.