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 bea7bba0487993809c960ed5b315f7169ae67917

Add gl normal mode key (MS-Windows only)
Author: xaizek
Author date (UTC): 2011-09-25 18:19
Committer name: xaizek
Committer date (UTC): 2011-09-25 18:19
Parent(s): 825519599b3a03f9966a04b07cc0f2f1efbea8f9
Signing key:
Tree: e5a3724dcc3fff897466a9d8171dbbcbfddc2357
File Lines added Lines deleted
ChangeLog 2 0
src/fileops.c 21 1
src/normal.c 20 1
src/status.c 4 0
src/status.h 4 0
src/vifm.1 5 0
src/vim/doc/vifm.txt 5 0
File ChangeLog changed (mode: 100644) (index ca12d59ce..8a4571b05)
153 153
154 154 Added :messages command. Added :messages command.
155 155
156 Added gl normal mode key (only for MS-Windows).
157
156 158 Now spaces between option name and '?' or '!' are allowed in :set command. Now spaces between option name and '?' or '!' are allowed in :set command.
157 159
158 160 Handle multi line output of :set command (for example, Handle multi line output of :set command (for example,
File src/fileops.c changed (mode: 100644) (index 73afe6eb0..960cf14f3)
29 29 #include <sys/types.h> /* waitpid() */ #include <sys/types.h> /* waitpid() */
30 30 #ifndef _WIN32 #ifndef _WIN32
31 31 #include <sys/wait.h> /* waitpid() */ #include <sys/wait.h> /* waitpid() */
32 #else
33 #include <windows.h>
34 #include <shellapi.h>
32 35 #endif #endif
33 36 #include <unistd.h> #include <unistd.h>
34 37
 
... ... handle_file(FileView *view, int dont_execute, int force_follow)
932 935 #ifndef _WIN32 #ifndef _WIN32
933 936 shellout(buf, 1); shellout(buf, 1);
934 937 #else #else
935 system(buf);
938 if(curr_stats.as_admin)
939 {
940 SHELLEXECUTEINFOA sei;
941 memset(&sei, 0, sizeof(sei));
942 sei.cbSize = sizeof(sei);
943 sei.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NOCLOSEPROCESS;
944 sei.lpVerb = "runas";
945 sei.lpFile = buf;
946 sei.lpParameters = NULL;
947 sei.nShow = SW_SHOWNORMAL;
948
949 if(ShellExecuteEx(&sei))
950 CloseHandle(sei.hProcess);
951 }
952 else
953 {
954 exec_program(buf);
955 }
936 956 #endif #endif
937 957 } }
938 958 else if(runnable) else if(runnable)
File src/normal.c changed (mode: 100644) (index f983f1f43..a0ebb777f)
... ... static void cmd_gA(struct key_info, struct keys_info *);
118 118 static void cmd_ga(struct key_info, struct keys_info *); static void cmd_ga(struct key_info, struct keys_info *);
119 119 static void cmd_gf(struct key_info, struct keys_info *); static void cmd_gf(struct key_info, struct keys_info *);
120 120 static void cmd_gg(struct key_info, struct keys_info *); static void cmd_gg(struct key_info, struct keys_info *);
121 #ifdef _WIN32
122 static void cmd_gl(struct key_info, struct keys_info *);
123 #endif
121 124 static void cmd_gs(struct key_info, struct keys_info *); static void cmd_gs(struct key_info, struct keys_info *);
122 125 static void cmd_gU(struct key_info, struct keys_info *); static void cmd_gU(struct key_info, struct keys_info *);
123 126 static void cmd_gUgg(struct key_info, struct keys_info *); static void cmd_gUgg(struct key_info, struct keys_info *);
 
... ... static struct keys_add_info builtin_cmds[] = {
222 225 {L"ga", {BUILDIN_KEYS, FOLLOWED_BY_NONE, {.handler = cmd_ga}}}, {L"ga", {BUILDIN_KEYS, FOLLOWED_BY_NONE, {.handler = cmd_ga}}},
223 226 {L"gf", {BUILDIN_KEYS, FOLLOWED_BY_NONE, {.handler = cmd_gf}}}, {L"gf", {BUILDIN_KEYS, FOLLOWED_BY_NONE, {.handler = cmd_gf}}},
224 227 {L"gg", {BUILDIN_KEYS, FOLLOWED_BY_NONE, {.handler = cmd_gg}}}, {L"gg", {BUILDIN_KEYS, FOLLOWED_BY_NONE, {.handler = cmd_gg}}},
228 #ifdef _WIN32
229 {L"gl", {BUILDIN_KEYS, FOLLOWED_BY_NONE, {.handler = cmd_gl}}},
230 #endif
225 231 {L"gs", {BUILDIN_KEYS, FOLLOWED_BY_NONE, {.handler = cmd_gs}}}, {L"gs", {BUILDIN_KEYS, FOLLOWED_BY_NONE, {.handler = cmd_gs}}},
226 232 {L"gU", {BUILDIN_WAIT_POINT, FOLLOWED_BY_SELECTOR, {.handler = cmd_gU}}}, {L"gU", {BUILDIN_WAIT_POINT, FOLLOWED_BY_SELECTOR, {.handler = cmd_gU}}},
227 233 {L"gUgU", {BUILDIN_KEYS, FOLLOWED_BY_NONE, {.handler = cmd_gU}}}, {L"gUgU", {BUILDIN_KEYS, FOLLOWED_BY_NONE, {.handler = cmd_gU}}},
 
... ... cmd_gg(struct key_info key_info, struct keys_info *keys_info)
800 806 move_to_list_pos(curr_view, key_info.count - 1); move_to_list_pos(curr_view, key_info.count - 1);
801 807 } }
802 808
809 #ifdef _WIN32
810 static void
811 cmd_gl(struct key_info key_info, struct keys_info *keys_info)
812 {
813 curr_stats.as_admin = 1;
814 handle_file(curr_view, 0, 0);
815 curr_stats.as_admin = 0;
816 clean_selected_files(curr_view);
817 draw_dir_list(curr_view, curr_view->top_line);
818 move_to_list_pos(curr_view, curr_view->list_pos);
819 }
820 #endif
821
803 822 static void static void
804 823 cmd_gs(struct key_info key_info, struct keys_info *keys_info) cmd_gs(struct key_info key_info, struct keys_info *keys_info)
805 824 { {
 
... ... cmd_ZZ(struct key_info key_info, struct keys_info *keys_info)
997 1016 comm_quit(1); comm_quit(1);
998 1017 } }
999 1018
1000 /* Mark. */
1019 /* Goto mark. */
1001 1020 static void static void
1002 1021 cmd_quote(struct key_info key_info, struct keys_info *keys_info) cmd_quote(struct key_info key_info, struct keys_info *keys_info)
1003 1022 { {
File src/status.c changed (mode: 100644) (index 36650ad74..786d7c2a6)
... ... init_status(void)
60 60 curr_stats.msg_head = 0; curr_stats.msg_head = 0;
61 61 curr_stats.msg_tail = 0; curr_stats.msg_tail = 0;
62 62 curr_stats.save_msg_in_list = 1; curr_stats.save_msg_in_list = 1;
63
64 #ifdef _WIN32
65 curr_stats.as_admin = 0;
66 #endif
63 67 } }
64 68
65 69 /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */ /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */
File src/status.h changed (mode: 100644) (index 6faf63513..b0b0b6ed9)
... ... typedef struct
78 78 int msg_head, msg_tail; int msg_head, msg_tail;
79 79 char *msgs[51]; char *msgs[51];
80 80 int save_msg_in_list; int save_msg_in_list;
81
82 #ifdef _WIN32
83 int as_admin;
84 #endif
81 85 }Status; }Status;
82 86
83 87 extern Status curr_stats; extern Status curr_stats;
File src/vifm.1 changed (mode: 100644) (index de053dcbe..7a1d81490)
... ... like ga, but force update.
269 269 find link destination (like l with 'followlinks' off, but also finds find link destination (like l with 'followlinks' off, but also finds
270 270 directories). directories).
271 271 .TP .TP
272 .BI gl
273 only for MS-Windows
274 .br
275 same as l key, but tries to run program with administrative privileges.
276 .TP
272 277 .BI gv .BI gv
273 278 go to visual mode restoring last selection. go to visual mode restoring last selection.
274 279 .TP .TP
File src/vim/doc/vifm.txt changed (mode: 100644) (index ed075b053..fed567706)
... ... gA - like ga, but force update.
174 174 gf - find link destination (like l with |vifm-'followlinks'| off, but also gf - find link destination (like l with |vifm-'followlinks'| off, but also
175 175 finds directories). finds directories).
176 176
177
178 {only for MS-Windows}
179 gl - same as l key, but tries to run program with administrative
180 privileges.
181
177 182 gv - go to visual mode restoring last selection. gv - go to visual mode restoring last selection.
178 183 gs - restore last t selection, like gv for visual mode selection. gs - restore last t selection, like gv for visual mode selection.
179 184
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