fzy

terminal fuzzy finder picker

git clone https://9o.is/git/fzy.git

commit 97a31ca045c1c440fadc3d9443fd78a3524f4a9b
parent f19221eb41577425d0780d12aa625a13ae6338fa
Author: John Hawthorn <john@hawthorn.email>
Date:   Sun, 13 Jan 2019 21:17:04 -0800

Set default options in config.def.h

Diffstat:
Msrc/config.def.h | 5+++++
Msrc/options.c | 20+++++++++++---------
2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/src/config.def.h b/src/config.def.h @@ -11,3 +11,8 @@ /* Time (in ms) to wait for additional bytes of an escape sequence */ #define KEYTIMEOUT 25 + +#define DEFAULT_TTY "/dev/tty" +#define DEFAULT_PROMPT "> " +#define DEFAULT_NUM_LINES 10 +#define DEFAULT_WORKERS 0 diff --git a/src/options.c b/src/options.c @@ -6,6 +6,8 @@ #include "options.h" +#include "../config.h" + static const char *usage_str = "" "Usage: fzy [OPTION]...\n" @@ -37,15 +39,15 @@ static struct option longopts[] = {{"show-matches", required_argument, NULL, 'e' void options_init(options_t *options) { /* set defaults */ - options->benchmark = 0; - options->filter = NULL; - options->init_search = NULL; - options->tty_filename = "/dev/tty"; - options->show_scores = 0; - options->num_lines = 10; - options->scrolloff = 1; - options->prompt = "> "; - options->workers = 0; + options->benchmark = 0; + options->filter = NULL; + options->init_search = NULL; + options->show_scores = 0; + options->scrolloff = 1; + options->tty_filename = DEFAULT_TTY; + options->num_lines = DEFAULT_NUM_LINES; + options->prompt = DEFAULT_PROMPT; + options->workers = DEFAULT_WORKERS; } void options_parse(options_t *options, int argc, char *argv[]) {