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 329dd823978be3bed5a97dcfbaa1c7acd5b02d2b

Make left panel active with one path passed
E.g. on
vifm /usr
or vifm --remote /home
Author: xaizek
Author date (UTC): 2012-02-19 12:00
Committer name: xaizek
Committer date (UTC): 2012-02-19 12:00
Parent(s): 98f76bb4843c745f48ba55c24b4db8398557b9c3
Signing key:
Tree: bda787ed1216ad1589fe831bd6290824b18f16f9
File Lines added Lines deleted
ChangeLog 4 0
TODO 0 1
src/ipc.c 6 1
src/log.h 1 1
src/vifm.c 17 7
File ChangeLog changed (mode: 100644) (index a2a2a89a9..99ddf9015)
40 40
41 41 Added :windo and :winrun commands. Added :windo and :winrun commands.
42 42
43 Added 'trashdir' option.
44
43 45 Restore terminal title on exit. Restore terminal title on exit.
44 46
45 47 Reset dot and filename filters if they hide bookmarked file. Reset dot and filename filters if they hide bookmarked file.
 
76 78
77 79 Allowed using of macros with :clone command. Allowed using of macros with :clone command.
78 80
81 Set left panel as active with one path passed as an argument.
82
79 83 Fixed bug with fixed-length buffer for :grep command (when many files are Fixed bug with fixed-length buffer for :grep command (when many files are
80 84 selected). selected).
81 85
File TODO changed (mode: 100644) (index 18602389f..611a93bad)
... ... Basic things that need to be done.
14 14 IPC among all running vifm instances (share settings among instances). IPC among all running vifm instances (share settings among instances).
15 15 Write script to export aliases and function from sh to ~/.vifm/scripts/ Write script to export aliases and function from sh to ~/.vifm/scripts/
16 16 Make status bar able to display error and info messages at the same time. Make status bar able to display error and info messages at the same time.
17 Set left panel as active with one path passed as an argument.
18 17 Command to create multiple copies of selected one with ability to rename Command to create multiple copies of selected one with ability to rename
19 18 it (e.g. a -> :hub b c -> a b c, a -> :hub! b c -> b c). it (e.g. a -> :hub b c -> a b c, a -> :hub! b c -> b c).
20 19
File src/ipc.c changed (mode: 100644) (index 7272b57ea..53c0c9b0a)
28 28 #include <unistd.h> /* getcwd() */ #include <unistd.h> /* getcwd() */
29 29
30 30 #include <assert.h> #include <assert.h>
31 #include <errno.h>
31 32 #include <stdlib.h> #include <stdlib.h>
32 33
33 34 #include "log.h" #include "log.h"
 
37 38
38 39 #include "ipc.h" #include "ipc.h"
39 40
40 #define PORT 31231
41 #define PORT 31230
41 42
42 43 static void cleanup_on_exit(void); static void cleanup_on_exit(void);
43 44 static void try_become_a_server(void); static void try_become_a_server(void);
 
... ... try_become_a_server(void)
135 136 addr.sin_addr.s_addr = inet_addr("127.0.0.1"); addr.sin_addr.s_addr = inet_addr("127.0.0.1");
136 137 addr.sin_port = htons(PORT); addr.sin_port = htons(PORT);
137 138 server = bind(sock, (struct sockaddr *)&addr, sizeof(addr)) != -1; server = bind(sock, (struct sockaddr *)&addr, sizeof(addr)) != -1;
139 if(!server)
140 {
141 LOG_SERROR_MSG(errno, "Can't become an IPC sever");
142 }
138 143 } }
139 144
140 145 static void static void
File src/log.h changed (mode: 100644) (index 49084991b..c87d63bc0)
38 38 log_msg((msg), ## args); \ log_msg((msg), ## args); \
39 39 } }
40 40
41 #define LOG_SERROR(no) log_error(__FILE__, __FUNCTION__, __LINE__, (no))
41 #define LOG_SERROR(no) log_serror(__FILE__, __FUNCTION__, __LINE__, (no))
42 42 #define LOG_SERROR_MSG(no, msg, args...) \ #define LOG_SERROR_MSG(no, msg, args...) \
43 43 { \ { \
44 44 log_serror(__FILE__, __FUNCTION__, __LINE__, (no)); \ log_serror(__FILE__, __FUNCTION__, __LINE__, (no)); \
File src/vifm.c changed (mode: 100644) (index a5e717e1b..495853fde)
... ... exclude_file_name(char *path)
328 328 break_atr(path, '/'); break_atr(path, '/');
329 329 } }
330 330
331 /* Sets view's current directory from path value. */
332 static void
331 /* Sets view's current directory from path value.
332 * Returns non-zero if view's directory was changed. */
333 static int
333 334 set_path(FileView *view, const char *path) set_path(FileView *view, const char *path)
334 335 { {
335 336 if(!check_path(view, path)) if(!check_path(view, path))
336 return;
337 return 0;
337 338
338 339 strcpy(view->curr_dir, path); strcpy(view->curr_dir, path);
339 340 exclude_file_name(view->curr_dir); exclude_file_name(view->curr_dir);
341 return 1;
340 342 } }
341 343
342 344 static void static void
 
... ... main(int argc, char *argv[])
434 436 int old_config; int old_config;
435 437 int i; int i;
436 438 int no_configs; int no_configs;
439 int lcd, rcd;
437 440
438 441 init_config(); init_config();
439 442
 
... ... main(int argc, char *argv[])
528 531
529 532 parse_args(argc, argv, dir, lwin_path, rwin_path, &lwin_handle, &rwin_handle); parse_args(argc, argv, dir, lwin_path, rwin_path, &lwin_handle, &rwin_handle);
530 533
531 set_path(&lwin, lwin_path);
532 set_path(&rwin, rwin_path);
534 lcd = set_path(&lwin, lwin_path);
535 rcd = set_path(&rwin, rwin_path);
536
537 if(lcd && !rcd && curr_view != &lwin)
538 change_window();
533 539
534 540 load_initial_directory(&lwin, dir); load_initial_directory(&lwin, dir);
535 541 load_initial_directory(&rwin, dir); load_initial_directory(&rwin, dir);
 
... ... parse_recieved_arguments(char *args[])
640 646 char rwin_path[PATH_MAX] = ""; char rwin_path[PATH_MAX] = "";
641 647 int lwin_handle = 0, rwin_handle = 0; int lwin_handle = 0, rwin_handle = 0;
642 648 int argc = 0; int argc = 0;
649 int lcd, rcd;
643 650
644 651 while(args[argc] != NULL) while(args[argc] != NULL)
645 652 argc++; argc++;
 
... ... parse_recieved_arguments(char *args[])
657 664 SetForegroundWindow(GetConsoleWindow()); SetForegroundWindow(GetConsoleWindow());
658 665 #endif #endif
659 666
660 if(check_path(&lwin, lwin_path))
667 if((lcd = check_path(&lwin, lwin_path)))
661 668 remote_cd(&lwin, lwin_path, lwin_handle); remote_cd(&lwin, lwin_path, lwin_handle);
662 669
663 if(check_path(&rwin, rwin_path))
670 if((rcd = check_path(&rwin, rwin_path)))
664 671 remote_cd(&rwin, rwin_path, rwin_handle); remote_cd(&rwin, rwin_path, rwin_handle);
665 672
673 if(lcd && !rcd && curr_view != &lwin)
674 change_window();
675
666 676 clean_status_bar(); clean_status_bar();
667 677 curr_stats.save_msg = 0; curr_stats.save_msg = 0;
668 678 } }
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