| File src/config.c changed (mode: 100644) (index 6eae071a7..c7a46ac97) |
| ... |
... |
init_config(void) |
| 76 |
76 |
cfg.follow_links = 1; |
cfg.follow_links = 1; |
| 77 |
77 |
cfg.fast_run = 0; |
cfg.fast_run = 0; |
| 78 |
78 |
cfg.confirm = 1; |
cfg.confirm = 1; |
|
79 |
|
cfg.vi_command = strdup("vim"); |
|
80 |
|
cfg.use_trash = 1; |
|
81 |
|
cfg.fuse_home = strdup("/tmp/vifm_FUSE"); |
|
82 |
|
cfg.use_screen = 0; |
|
83 |
|
cfg.history_len = 15; |
|
84 |
|
cfg.use_vim_help = 0; |
| 79 |
85 |
|
|
| 80 |
86 |
/* Maximum argument length to pass to the shell */ |
/* Maximum argument length to pass to the shell */ |
| 81 |
87 |
if((cfg.max_args = sysconf(_SC_ARG_MAX)) == 0) |
if((cfg.max_args = sysconf(_SC_ARG_MAX)) == 0) |
| |
| ... |
... |
create_startup_file(void) |
| 112 |
118 |
file_exec(command); |
file_exec(command); |
| 113 |
119 |
} |
} |
| 114 |
120 |
|
|
| 115 |
|
static void |
|
| 116 |
|
load_view_defaults(FileView *view) |
|
| 117 |
|
{ |
|
| 118 |
|
strncpy(view->regexp, "\\..~$", sizeof(view->regexp) - 1); |
|
| 119 |
|
|
|
| 120 |
|
view->filename_filter = strdup(""); |
|
| 121 |
|
view->prev_filter = strdup(""); |
|
| 122 |
|
view->invert = TRUE; |
|
| 123 |
|
|
|
| 124 |
|
view->sort_type = SORT_BY_NAME; |
|
| 125 |
|
} |
|
| 126 |
|
|
|
| 127 |
121 |
/* This is just a safety check so that vifm will still load and run if |
/* This is just a safety check so that vifm will still load and run if |
| 128 |
122 |
* the configuration file is not present. |
* the configuration file is not present. |
| 129 |
123 |
*/ |
*/ |
| |
| ... |
... |
static void |
| 131 |
125 |
load_default_configuration(void) |
load_default_configuration(void) |
| 132 |
126 |
{ |
{ |
| 133 |
127 |
cfg.using_default_config = 1; |
cfg.using_default_config = 1; |
| 134 |
|
cfg.use_trash = 1; |
|
| 135 |
|
cfg.vi_command = strdup("vim"); |
|
| 136 |
|
cfg.fuse_home = strdup("/tmp/vifm_FUSE"); |
|
| 137 |
|
cfg.use_screen = 0; |
|
| 138 |
|
cfg.history_len = 15; |
|
| 139 |
|
cfg.use_vim_help = 0; |
|
| 140 |
|
|
|
| 141 |
|
load_view_defaults(&lwin); |
|
| 142 |
|
load_view_defaults(&rwin); |
|
| 143 |
128 |
|
|
| 144 |
129 |
read_color_scheme_file(); |
read_color_scheme_file(); |
| 145 |
130 |
} |
} |
| |
| ... |
... |
set_config_dir(void) |
| 185 |
170 |
} |
} |
| 186 |
171 |
} |
} |
| 187 |
172 |
|
|
|
173 |
|
static void |
|
174 |
|
load_view_defaults(FileView *view) |
|
175 |
|
{ |
|
176 |
|
strncpy(view->regexp, "\\..~$", sizeof(view->regexp) - 1); |
|
177 |
|
|
|
178 |
|
view->filename_filter = strdup(""); |
|
179 |
|
view->prev_filter = strdup(""); |
|
180 |
|
view->invert = TRUE; |
|
181 |
|
|
|
182 |
|
view->sort_type = SORT_BY_NAME; |
|
183 |
|
} |
|
184 |
|
|
| 188 |
185 |
/* Returns zero when default configuration is used */ |
/* Returns zero when default configuration is used */ |
| 189 |
186 |
int |
int |
| 190 |
187 |
read_config_file(void) |
read_config_file(void) |
| |
| ... |
... |
read_config_file(void) |
| 202 |
199 |
|
|
| 203 |
200 |
snprintf(config_file, sizeof(config_file), "%s/vifmrc", cfg.config_dir); |
snprintf(config_file, sizeof(config_file), "%s/vifmrc", cfg.config_dir); |
| 204 |
201 |
|
|
|
202 |
|
load_view_defaults(&lwin); |
|
203 |
|
load_view_defaults(&rwin); |
|
204 |
|
|
| 205 |
205 |
if((fp = fopen(config_file, "r")) == NULL) |
if((fp = fopen(config_file, "r")) == NULL) |
| 206 |
206 |
{ |
{ |
| 207 |
207 |
fprintf(stdout, "Unable to find configuration file.\n Using defaults."); |
fprintf(stdout, "Unable to find configuration file.\n Using defaults."); |