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 53899f6c0452c991e07795b4ab6f3d54d9a4ee3e

Add %o macro to 'statusline'
It expands to Unix permissions in octal form (and to nothing on
Windows).

Thanks to iSeeU816.

Closes #707 on GitHub.
Author: xaizek
Author date (UTC): 2022-06-26 11:51
Committer name: xaizek
Committer date (UTC): 2022-06-26 11:51
Parent(s): 75a42908958b782ece17cccfcea4ddea7a408ca4
Signing key: 99DC5E4DB05F6BE2
Tree: ac27022d6f95277cea029ddc0d756d0eaa25bf2a
File Lines added Lines deleted
ChangeLog 3 0
data/man/vifm.1 3 1
data/vim/doc/app/vifm-app.txt 2 1
src/ui/statusline.c 6 1
tests/misc/expand_status_line_macros.c 7 2
File ChangeLog changed (mode: 100644) (index 9d22e3a93..a629e6b0a)
52 52 Added "maxtreedepth" value to 'previewoptions' option, which allows Added "maxtreedepth" value to 'previewoptions' option, which allows
53 53 limiting depths of the displayed tree. Thanks to Afz. limiting depths of the displayed tree. Thanks to Afz.
54 54
55 Added %o macro to 'statusline', which expands to Unix permissions in octal
56 form (and to nothing on Windows). Thanks to iSeeU816.
57
55 58 Extended optimizations for globs to cover `something*` and `some*thing` Extended optimizations for globs to cover `something*` and `some*thing`
56 59 cases. cases.
57 60
File data/man/vifm.1 changed (mode: 100644) (index cc8ab7fd4..b8b67102f)
1 .TH VIFM 1 "June 19, 2022" "vifm 0.12"
1 .TH VIFM 1 "June 26, 2022" "vifm 0.12"
2 2 .\" --------------------------------------------------------------------------- .\" ---------------------------------------------------------------------------
3 3 .SH NAME .SH NAME
4 4 .\" --------------------------------------------------------------------------- .\" ---------------------------------------------------------------------------
 
... ... are supported:
4832 4832 .IP \- 2 .IP \- 2
4833 4833 %A \- file attributes (permissions on *nix or properties on Windows) %A \- file attributes (permissions on *nix or properties on Windows)
4834 4834 .IP \- 2 .IP \- 2
4835 %o \- file permissions in octal form on *nix (nothing on Windows)
4836 .IP \- 2
4835 4837 %u \- user name or uid (if it cannot be resolved) %u \- user name or uid (if it cannot be resolved)
4836 4838 .IP \- 2 .IP \- 2
4837 4839 %g \- group name or gid (if it cannot be resolved) %g \- group name or gid (if it cannot be resolved)
File data/vim/doc/app/vifm-app.txt changed (mode: 100644) (index 8485ae6f0..75a1f2635)
1 *vifm-app.txt* For Vifm version 0.12 Last change: 2022 June 19
1 *vifm-app.txt* For Vifm version 0.12 Last change: 2022 June 26
2 2
3 3 Email for bugs and suggestions: <xaizek@posteo.net> Email for bugs and suggestions: <xaizek@posteo.net>
4 4
 
... ... are supported:
4062 4062 %T - symbolic link target (empty for other filetypes) %T - symbolic link target (empty for other filetypes)
4063 4063 %f - file name relative to current directory (considers 'classify') %f - file name relative to current directory (considers 'classify')
4064 4064 %A - file attributes (permissions on *nix or properties on Windows) %A - file attributes (permissions on *nix or properties on Windows)
4065 %o - file permissions in octal form on *nix (nothing on Windows)
4065 4066 %u - user name or uid (if it cannot be resolved) %u - user name or uid (if it cannot be resolved)
4066 4067 %g - group name or gid (if it cannot be resolved) %g - group name or gid (if it cannot be resolved)
4067 4068 %s - file size in human readable format %s - file size in human readable format
File src/ui/statusline.c changed (mode: 100644) (index 2322cab90..058e56fd0)
... ... static const char * format_job_bar(void);
71 71 static char ** take_job_descr_snapshot(void); static char ** take_job_descr_snapshot(void);
72 72
73 73 /* List of macros that are expanded in the status line. */ /* List of macros that are expanded in the status line. */
74 static const char STATUS_LINE_MACROS[] = "tTfacAugsEdD-xlLPSz%[]{*";
74 static const char STATUS_LINE_MACROS[] = "tTfacAugsEdD-xlLoPSz%[]{*";
75 75
76 76 /* Number of background jobs. */ /* Number of background jobs. */
77 77 static size_t nbar_jobs; static size_t nbar_jobs;
 
... ... parse_view_macros(view_t *view, const char **format, const char macros[],
381 381 get_perm_string(buf, sizeof(buf), curr->mode); get_perm_string(buf, sizeof(buf), curr->mode);
382 382 #else #else
383 383 copy_str(buf, sizeof(buf), attr_str_long(curr->attrs)); copy_str(buf, sizeof(buf), attr_str_long(curr->attrs));
384 #endif
385 break;
386 case 'o':
387 #ifndef _WIN32
388 snprintf(buf, sizeof(buf), "%03o", curr->mode & 0777);
384 389 #endif #endif
385 390 break; break;
386 391 case 'u': case 'u':
File tests/misc/expand_status_line_macros.c changed (mode: 100644) (index 67e7cbd5b..71d20410b)
... ... TEST(A_macro_expanded)
136 136 ASSERT_EXPANDED("%A"); ASSERT_EXPANDED("%A");
137 137 } }
138 138
139 TEST(o_macro_expanded)
140 {
141 ASSERT_EXPANDED("%o");
142 }
143
139 144 TEST(u_macro_expanded) TEST(u_macro_expanded)
140 145 { {
141 146 ASSERT_EXPANDED("%u"); ASSERT_EXPANDED("%u");
 
... ... TEST(percent_macro_expanded)
222 227
223 228 TEST(wrong_macros_ignored) TEST(wrong_macros_ignored)
224 229 { {
225 static const char STATUS_CHARS[] = "tTfacAugsEdD-xlLPS%[]z{*";
230 static const char STATUS_CHARS[] = "tTfacAugsEdD-xlLoPS%[]z{*";
226 231 int i; int i;
227 232
228 233 for(i = 1; i <= 255; ++i) for(i = 1; i <= 255; ++i)
 
... ... TEST(wrong_macros_ignored)
237 242
238 243 TEST(wrong_macros_with_width_field_ignored) TEST(wrong_macros_with_width_field_ignored)
239 244 { {
240 static const char STATUS_CHARS[] = "tTfacAugsEdD-xlLPS%[]z{*";
245 static const char STATUS_CHARS[] = "tTfacAugsEdD-xlLoPS%[]z{*";
241 246 int i; int i;
242 247
243 248 for(i = 1; i <= 255; ++i) for(i = 1; i <= 255; ++i)
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