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 c3dbff99edc80d7d142f885390669f350870dd8a

Complete -focus parameter of :split/:vsplit
Should have been done in commit
9835a336d259548f05c9f8f46e0d98cf33f96e29:

Add -focus parameter to :split and :vsplit
Author: xaizek
Author date (UTC): 2026-09-06 09:48
Committer name: xaizek
Committer date (UTC): 2026-09-07 22:01
Parent(s): e05d0b202287a057392dfaf13b2d5affe74514f7
Signing key: 99DC5E4DB05F6BE2
Tree: f379358124545303d3e842b3580ad41833f6a94e
File Lines added Lines deleted
src/cmd_completion.c 19 2
tests/commands/completion.c 43 0
File src/cmd_completion.c changed (mode: 100644) (index f0df55363..a1cf3540a)
... ... path_completion(completion_data_t *data)
417 417 } }
418 418 else if(id == COM_SPLIT || id == COM_VSPLIT) else if(id == COM_SPLIT || id == COM_VSPLIT)
419 419 { {
420 data->start += filename_completion_in_dir(flist_get_dir(curr_view), arg,
421 CT_DIRONLY);
420 if(is_option(data->cmd_info) && arg[0] == '-')
421 {
422 complete_option(id, arg);
423 }
424 else
425 {
426 data->start += filename_completion_in_dir(flist_get_dir(curr_view), arg,
427 CT_DIRONLY);
428 }
422 429 } }
423 430 else if(id == COM_GREP) else if(id == COM_GREP)
424 431 { {
 
... ... complete_option(int cmd_id, const char str[])
1138 1145 { "-skip", "skip files with conflicting names" }, { "-skip", "skip files with conflicting names" },
1139 1146 }; };
1140 1147
1148 static const char *split_lines[][2] = {
1149 { "-focus", "change pane after splitting" },
1150 };
1151
1141 1152 const char *(*opts)[2]; const char *(*opts)[2];
1142 1153 int opt_count; int opt_count;
1143 1154 switch(cmd_id) switch(cmd_id)
1144 1155 { {
1156 case COM_SPLIT:
1157 case COM_VSPLIT:
1158 opts = split_lines;
1159 opt_count = ARRAY_LEN(split_lines);
1160 break;
1161
1145 1162 case COM_COPY: case COM_COPY:
1146 1163 opts = lines; opts = lines;
1147 1164 opt_count = 2; opt_count = 2;
File tests/commands/completion.c changed (mode: 100644) (index 4ad348a3f..24f369e2c)
... ... TEST(wingo_is_completed)
675 675 cfg.shorten_title_paths = 0; cfg.shorten_title_paths = 0;
676 676 } }
677 677
678 TEST(split_vsplit_are_completed)
679 {
680 /* Path. */
681
682 ASSERT_COMPLETION(L"split ", L"split a/");
683 ASSERT_NEXT_MATCH("b/");
684
685 ASSERT_COMPLETION(L"vsplit ", L"vsplit a/");
686 ASSERT_NEXT_MATCH("b/");
687
688 /* Option. */
689
690 ASSERT_COMPLETION(L"split -", L"split -focus");
691 ASSERT_NEXT_MATCH("-focus");
692
693 ASSERT_COMPLETION(L"vsplit -", L"vsplit -focus");
694 ASSERT_NEXT_MATCH("-focus");
695
696 /* Option, twice. */
697
698 ASSERT_COMPLETION(L"split -focus -", L"split -focus -focus");
699 ASSERT_NEXT_MATCH("-focus");
700
701 ASSERT_COMPLETION(L"vsplit -focus -", L"vsplit -focus -focus");
702 ASSERT_NEXT_MATCH("-focus");
703
704 /* Path after an option. */
705
706 ASSERT_COMPLETION(L"split -focus ", L"split -focus a/");
707 ASSERT_NEXT_MATCH("b/");
708
709 ASSERT_COMPLETION(L"vsplit -focus ", L"vsplit -focus a/");
710 ASSERT_NEXT_MATCH("b/");
711
712 /* Path after the option separator. */
713
714 ASSERT_COMPLETION(L"split -- ", L"split -- a/");
715 ASSERT_NEXT_MATCH("b/");
716
717 ASSERT_COMPLETION(L"vsplit -- ", L"vsplit -- a/");
718 ASSERT_NEXT_MATCH("b/");
719 }
720
678 721 static void static void
679 722 dummy_handler(OPT_OP op, optval_t val) dummy_handler(OPT_OP op, optval_t val)
680 723 { {
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