shithub: nc

Download patch

ref: 585bff5ec0ebd75c2adba9d45c581c8cd7c3722d
parent: 6fcb098dfe49b63e06c2a48f363902f0a6379f31
author: phil9 <telephil9@gmail.com>
date: Tue Dec 27 15:05:30 EST 2022

add command to change other panel's directory

--- a/dirviewcmd.c
+++ b/dirviewcmd.c
@@ -181,6 +181,19 @@
 }
 
 static void
+cmdcdo(void)
+{
+	Dirpanel *p;
+	char buf[1024] = {0};
+
+	p = dirviewotherpanel(dview);
+	if(input("go to directory:", buf, sizeof buf, mc, kc) <= 0)
+		return;
+	dirpanelresetcursor(p);
+	dirmodelcd(p->model, buf);
+}
+
+static void
 cmdcdmatch(void)
 {
 	Dirpanel *o;
@@ -393,6 +406,7 @@
 	{ '\t',		cmdswitchfocus },
 	{ 'r',		cmdreload },
 	{ 'c',		cmdcd },
+	{ 'C',		cmdcdo },
 	{ '=',		cmdcdmatch },
 	{ '\n',		cmdview },
 	{ '+',		cmdselectgroup },
--- a/help.c
+++ b/help.c
@@ -44,6 +44,7 @@
 	"Key bindings:\n"
 	"  Enter - view file content or visit directory.\n"
 	"  c     - change current directory (accepts relative or absolute paths).\n"
+	"  C     - change current directory of other panel.\n"
 	"  =     - change other panel directory to current one.\n"
 	"  F1    - this help screen.\n"
 	"  F3    - view file content or visit directory.\n"