aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/keys.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/keys.c b/src/keys.c
index 747e5c8..a49aa79 100644
--- a/src/keys.c
+++ b/src/keys.c
@@ -97,6 +97,25 @@ handling_keys(int ch, fm_info *i)
fm_rename(i);
break;
}
+ case 'd': {
+ char path[PATH_MAX] = {0};
+ size_t len = snprintf(path, sizeof(path), "%s/%s", i->cwd,
+ i->cur->items[i->cursor].name);
+
+ if (len >= PATH_MAX) {
+ die("Itmes length error");
+ }
+
+ if (fm_rm(path) == 0) {
+ need_redraw = true;
+ fm_getdir(i->cur, i->cwd);
+ } else {
+ log_write(LOG_ERR, "%s", strerror(errno));
+ }
+
+ break;
+ }
+
default:
return;
}