Commit Diff


commit - 584ee48a8771c1bdc65e10fbdfb6c7edbd894ec9
commit + e03d121935fa33b6f6b81bc71cdf9e27aa8f9c22
blob - def8b1ca881f807ca4c779e1842b3e15aaf7c11b
blob + dddd04b2e566fe3f0e11435b41a61e393b89aeb2
--- fm.1
+++ fm.1
@@ -94,6 +94,8 @@ Paste path
 .Pq goto previously copied path.
 .It ^L
 Refresh and redraw screen.
+.It ^M
+Spawn a shell
 .It q
 Quit
 .Nm .
blob - 698a0466de91d0b89624251ead2e47351a9efebf
blob + 48d3e05d6ca1293c889cbac15fcf6f1efc96e0d7
--- fm.c
+++ fm.c
@@ -27,6 +27,10 @@
 #include <wchar.h>
 #include <wctype.h>
 
+#ifndef FM_SHELL
+#define FM_SHELL "/bin/sh"
+#endif
+
 #include "config.h"
 
 struct option opts[] = {
@@ -1324,6 +1328,16 @@ cmd_reload(void)
 }
 
 static void
+cmd_shell(void)
+{
+	const char *shell;
+
+	if ((shell = getenv("SHELL")) == NULL)
+		shell = FM_SHELL;
+	spawn(shell, NULL);
+}
+
+static void
 loop(void)
 {
 	int meta, ch, c;
@@ -1359,6 +1373,7 @@ loop(void)
 		{'l',		K_CTRL,	cmd_reload,		X_UPDV},
 		{'n',		0,	cmd_down,		X_UPDV},
 		{'n',		K_CTRL,	cmd_down,		X_UPDV},
+		{'m',		K_CTRL,	cmd_shell,		X_UPDV},
 		{'p',		0,	cmd_up,			X_UPDV},
 		{'p',		K_CTRL,	cmd_up,			X_UPDV},
 		{'q',		0,	NULL,			X_QUIT},