xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit a1793094a395d6b0ec7f39b2298d117f46e24412

Add support for :set all (shows all options)
Author: xaizek
Author date (UTC): 2011-09-25 19:35
Committer name: xaizek
Committer date (UTC): 2011-09-25 19:35
Parent(s): bea7bba0487993809c960ed5b315f7169ae67917
Signing key:
Tree: 730457573451eb4231d0da291f0e58ad74b29cdf
File Lines added Lines deleted
ChangeLog 2 0
src/opt_handlers.c 1 1
src/options.c 28 5
src/vifm.1 3 0
src/vim/doc/vifm.txt 1 0
File ChangeLog changed (mode: 100644) (index 8a4571b05..9d5edac47)
155 155
156 156 Added gl normal mode key (only for MS-Windows). Added gl normal mode key (only for MS-Windows).
157 157
158 Added support for :set all (shows all options).
159
158 160 Now spaces between option name and '?' or '!' are allowed in :set command. Now spaces between option name and '?' or '!' are allowed in :set command.
159 161
160 162 Handle multi line output of :set command (for example, Handle multi line output of :set command (for example,
File src/opt_handlers.c changed (mode: 100644) (index 92b95e5e1..5fc84d02e)
... ... static void wildmenu_handler(enum opt_op op, union optval_t val);
49 49 static void wrap_handler(enum opt_op op, union optval_t val); static void wrap_handler(enum opt_op op, union optval_t val);
50 50
51 51 static int save_msg; static int save_msg;
52 static char print_buf[320];
52 static char print_buf[320*80];
53 53
54 54 static const char * sort_enum[] = { static const char * sort_enum[] = {
55 55 "ext", "ext",
File src/options.c changed (mode: 100644) (index df5ef66f8..c79b90dc0)
... ... static struct opt_t * add_option_inner(const char *name, enum opt_type type,
48 48 static const char * extract_option(const char *cmd, char *buf, int replace); static const char * extract_option(const char *cmd, char *buf, int replace);
49 49 static int process_option(const char *cmd); static int process_option(const char *cmd);
50 50 static const char * skip_alphas(const char *cmd); static const char * skip_alphas(const char *cmd);
51 static void print_options(void);
51 52 static struct opt_t * get_option(const char *option); static struct opt_t * get_option(const char *option);
52 53 static struct opt_t * find_option(const char *option); static struct opt_t * find_option(const char *option);
53 54 static int set_on(struct opt_t *opt); static int set_on(struct opt_t *opt);
 
... ... process_option(const char *cmd)
285 286 p = skip_alphas(cmd); p = skip_alphas(cmd);
286 287
287 288 snprintf(option, p - cmd + 1, "%s", cmd); snprintf(option, p - cmd + 1, "%s", cmd);
289
290 if(strcmp(option, "all") == 0)
291 {
292 print_options();
293 return 0;
294 }
295
288 296 opt = get_option(option); opt = get_option(option);
289 297 if(opt == NULL) if(opt == NULL)
290 298 { {
 
... ... skip_alphas(const char *cmd)
356 364 return cmd; return cmd;
357 365 } }
358 366
367 static void
368 print_options(void)
369 {
370 int i;
371 for(i = 0; i < options_count; i++)
372 {
373 if(options[i].full != NULL)
374 continue;
375 set_print(&options[i]);
376 }
377 }
378
359 379 static struct opt_t * static struct opt_t *
360 380 get_option(const char *option) get_option(const char *option)
361 381 { {
 
... ... set_print(struct opt_t *opt)
724 744 if(opt->type == OPT_BOOL) if(opt->type == OPT_BOOL)
725 745 { {
726 746 snprintf(buf, sizeof(buf), "%s%s", snprintf(buf, sizeof(buf), "%s%s",
727 opt->val.bool_val ? "" : "no", opt->name);
747 opt->val.bool_val ? " " : "no", opt->name);
728 748 } }
729 749 else if(opt->type == OPT_INT) else if(opt->type == OPT_INT)
730 750 { {
731 snprintf(buf, sizeof(buf), "%s=%d", opt->name, opt->val.int_val);
751 snprintf(buf, sizeof(buf), " %s=%d", opt->name, opt->val.int_val);
732 752 } }
733 753 else if(opt->type == OPT_STR || opt->type == OPT_STRLIST) else if(opt->type == OPT_STR || opt->type == OPT_STRLIST)
734 754 { {
735 snprintf(buf, sizeof(buf), "%s=%s", opt->name,
755 snprintf(buf, sizeof(buf), " %s=%s", opt->name,
736 756 opt->val.str_val ? opt->val.str_val : ""); opt->val.str_val ? opt->val.str_val : "");
737 757 } }
738 758 else if(opt->type == OPT_ENUM) else if(opt->type == OPT_ENUM)
739 759 { {
740 snprintf(buf, sizeof(buf), "%s=%s", opt->name, opt->vals[opt->val.enum_item]);
760 snprintf(buf, sizeof(buf), " %s=%s", opt->name,
761 opt->vals[opt->val.enum_item]);
741 762 } }
742 763 else if(opt->type == OPT_SET) else if(opt->type == OPT_SET)
743 764 { {
744 765 int i, first = 1; int i, first = 1;
745 snprintf(buf, sizeof(buf), "%s=", opt->name);
766 snprintf(buf, sizeof(buf), " %s=", opt->name);
746 767 for(i = 0; i < opt->val_count; i++) for(i = 0; i < opt->val_count; i++)
747 768 if(opt->val.set_items & (1 << i)) if(opt->val.set_items & (1 << i))
748 769 { {
 
... ... complete_option(const char *buf, int bool_only)
854 875 } }
855 876
856 877 len = strlen(buf); len = strlen(buf);
878 if(strncmp(buf, "all", len) == 0)
879 add_completion("all");
857 880 for(i = 0; i < options_count; i++) for(i = 0; i < options_count; i++)
858 881 { {
859 882 if(options[i].full != NULL) if(options[i].full != NULL)
File src/vifm.1 changed (mode: 100644) (index 7a1d81490..7711a56b4)
... ... This requires screen version 3.9.9 or newer for the screen -X argument.
1058 1058 .BI :screen? .BI :screen?
1059 1059 shows whether screen program is used. shows whether screen program is used.
1060 1060 .TP .TP
1061 .BI ":se[t] all"
1062 shows all options.
1063 .TP
1061 1064 .BI ":se[t] opt1=val1 opt2='val2' opt3=""val3"" ..." .BI ":se[t] opt1=val1 opt2='val2' opt3=""val3"" ..."
1062 1065 will set options to given values. will set options to given values.
1063 1066 .br .br
File src/vim/doc/vifm.txt changed (mode: 100644) (index fed567706..c3f39adb3)
... ... of the hierarchy and transparency for all others.
792 792 :screen? - shows whether screen program is used. :screen? - shows whether screen program is used.
793 793
794 794 *vifm-:set* *vifm-:se* *vifm-:set* *vifm-:se*
795 :se[t] all - shows all options.
795 796 :se[t] opt1=val1 opt2='val2' opt3="val3" ... - sets given options. :se[t] opt1=val1 opt2='val2' opt3="val3" ... - sets given options.
796 797 You can use following syntax: You can use following syntax:
797 798 - for all options - option, option? and option& - for all options - option, option? and option&
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master