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 9dd2a4310a75c565702137d540766e1c0358310f

Add support for :set command without arguments
Author: xaizek
Author date (UTC): 2011-09-25 19:41
Committer name: xaizek
Committer date (UTC): 2011-09-25 19:41
Parent(s): a1793094a395d6b0ec7f39b2298d117f46e24412
Signing key:
Tree: 3e642d465fc68a6c5702448f73e670566c60ca6f
File Lines added Lines deleted
ChangeLog 3 1
src/commands.c 1 1
src/options.c 33 0
src/vifm.1 3 0
src/vim/doc/vifm.txt 1 0
File ChangeLog changed (mode: 100644) (index 9d5edac47..79fda32ec)
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).
158 Added support for :set all.
159
160 Added support for :set command without arguments.
159 161
160 162 Now spaces between option name and '?' or '!' are allowed in :set command. Now spaces between option name and '?' or '!' are allowed in :set command.
161 163
File src/commands.c changed (mode: 100644) (index 53098a471..41a5a7e2d)
... ... static const struct cmd_add commands[] = {
342 342 { .name = "screen", .abbr = NULL, .emark = 0, .id = -1, .range = 0, .bg = 0, .quote = 0, .regexp = 0, { .name = "screen", .abbr = NULL, .emark = 0, .id = -1, .range = 0, .bg = 0, .quote = 0, .regexp = 0,
343 343 .handler = screen_cmd, .qmark = 1, .expand = 0, .cust_sep = 0, .min_args = 0, .max_args = 0, .select = 0, }, .handler = screen_cmd, .qmark = 1, .expand = 0, .cust_sep = 0, .min_args = 0, .max_args = 0, .select = 0, },
344 344 { .name = "set", .abbr = "se", .emark = 0, .id = COM_SET, .range = 0, .bg = 0, .quote = 0, .regexp = 0, { .name = "set", .abbr = "se", .emark = 0, .id = COM_SET, .range = 0, .bg = 0, .quote = 0, .regexp = 0,
345 .handler = set_cmd, .qmark = 0, .expand = 0, .cust_sep = 0, .min_args = 1, .max_args = NOT_DEF, .select = 0, },
345 .handler = set_cmd, .qmark = 0, .expand = 0, .cust_sep = 0, .min_args = 0, .max_args = NOT_DEF, .select = 0, },
346 346 { .name = "shell", .abbr = "sh", .emark = 0, .id = -1, .range = 0, .bg = 0, .quote = 0, .regexp = 0, { .name = "shell", .abbr = "sh", .emark = 0, .id = -1, .range = 0, .bg = 0, .quote = 0, .regexp = 0,
347 347 .handler = shell_cmd, .qmark = 0, .expand = 0, .cust_sep = 0, .min_args = 0, .max_args = 0, .select = 0, }, .handler = shell_cmd, .qmark = 0, .expand = 0, .cust_sep = 0, .min_args = 0, .max_args = 0, .select = 0, },
348 348 { .name = "sort", .abbr = "sor", .emark = 0, .id = -1, .range = 0, .bg = 0, .quote = 0, .regexp = 0, { .name = "sort", .abbr = "sor", .emark = 0, .id = -1, .range = 0, .bg = 0, .quote = 0, .regexp = 0,
File src/options.c changed (mode: 100644) (index c79b90dc0..ec2dbbfa8)
... ... struct opt_t {
45 45
46 46 static struct opt_t * add_option_inner(const char *name, enum opt_type type, static struct opt_t * add_option_inner(const char *name, enum opt_type type,
47 47 int val_count, const char **vals, opt_handler handler); int val_count, const char **vals, opt_handler handler);
48 static void print_changed_options(void);
48 49 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 50 static int process_option(const char *cmd); static int process_option(const char *cmd);
50 51 static const char * skip_alphas(const char *cmd); static const char * skip_alphas(const char *cmd);
 
... ... int
192 193 set_options(const char *cmd) set_options(const char *cmd)
193 194 { {
194 195 int err = 0; int err = 0;
196
197 if(*cmd == '\0')
198 {
199 print_changed_options();
200 return 0;
201 }
202
195 203 while(*cmd != '\0') while(*cmd != '\0')
196 204 { {
197 205 char buf[1024]; char buf[1024];
 
... ... set_options(const char *cmd)
204 212 return err; return err;
205 213 } }
206 214
215 static void
216 print_changed_options(void)
217 {
218 int i;
219 for(i = 0; i < options_count; i++)
220 {
221 struct opt_t *opt = &options[i];
222
223 if(opt->full != NULL)
224 continue;
225
226 if(opt->type == OPT_STR || opt->type == OPT_STRLIST)
227 {
228 if(strcmp(opt->val.str_val, opt->def.str_val) == 0)
229 continue;
230 }
231 else if(opt->val.int_val == opt->def.int_val)
232 {
233 continue;
234 }
235
236 set_print(&options[i]);
237 }
238 }
239
207 240 static const char * static const char *
208 241 extract_option(const char *cmd, char *buf, int replace) extract_option(const char *cmd, char *buf, int replace)
209 242 { {
File src/vifm.1 changed (mode: 100644) (index 7711a56b4..534d27f31)
... ... 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]
1062 shows all options that differ from their default value.
1063 .TP
1061 1064 .BI ":se[t] all" .BI ":se[t] all"
1062 1065 shows all options. shows all options.
1063 1066 .TP .TP
File src/vim/doc/vifm.txt changed (mode: 100644) (index c3f39adb3..aaf0520f2)
... ... 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] - shows all options that differ from their default value.
795 796 :se[t] all - shows all options. :se[t] all - shows all options.
796 797 :se[t] opt1=val1 opt2='val2' opt3="val3" ... - sets given options. :se[t] opt1=val1 opt2='val2' opt3="val3" ... - sets given options.
797 798 You can use following syntax: You can use following syntax:
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