~leon_plickat/nfm

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH nfm] Add default keybind '~' to go to home dir

Details
Message ID
<20220531193404.10746-1-mail@hmachet.com>
DKIM signature
pass
Download raw message
Patch: +14 -0
---
 doc/nfm.1                   |  1 +
 example/config.ini          |  1 +
 src/Config.zig              |  2 ++
 src/key-operations/misc.zig | 10 ++++++++++
 4 files changed, 14 insertions(+)

diff --git a/doc/nfm.1 b/doc/nfm.1
index 9435f1445cac..31ffc232bc58 100644
--- a/doc/nfm.1
+++ b/doc/nfm.1
@@ -123,6 +123,7 @@ h, left, C-b@enter-parent-dir
l, right, C-f@commit-file-at-cursor
G, end@cursor-move-to-bottom
g, home@cursor-move-to-top
~@go-home
page-down@cursor-move-page-down
page-up@cursor-move-page-up
enter@commit-marks
diff --git a/example/config.ini b/example/config.ini
index ee92b8f23745..299f100ce064 100644
--- a/example/config.ini
+++ b/example/config.ini
@@ -21,6 +21,7 @@ home = cursor-move-to-top;
end = cursor-move-to-bottom;
page-down = cursor-move-page-down;
page-up = cursor-move-page-up;
~ = go-home;
: = open-cmd;
m = mark-file-at-cursor;
M = open-select;
diff --git a/src/Config.zig b/src/Config.zig
index ac6fb1810bd3..5352ff078231 100644
--- a/src/Config.zig
+++ b/src/Config.zig
@@ -53,6 +53,7 @@ pub const impl = struct {
    pub const @"commit-marks" = @import("key-operations/commit.zig").commitMarks;

    pub const @"enter-parent-dir" = @import("key-operations/misc.zig").enterParentDir;
    pub const @"go-home" = @import("key-operations/misc.zig").goHome;
    pub const @"jump-back" = @import("key-operations/misc.zig").jumpBack;
    pub const @"quit" = @import("key-operations/misc.zig").quit;
    pub const @"run" = @import("key-operations/misc.zig").run;
@@ -116,6 +117,7 @@ pub fn init(self: *Self) !void {
    try self.addBindIfUndefined("f", impl.@"toggle-view-filesystems", null);
    try self.addBindIfUndefined("b", impl.@"toggle-view-bookmarks", null);
    try self.addBindIfUndefined("escape", impl.@"set-view-files", null);
    try self.addBindIfUndefined("~", impl.@"go-home", null);

    // Make the emacs people happy
    try self.addBindIfUndefined("C-n", impl.@"cursor-move-down", null);
diff --git a/src/key-operations/misc.zig b/src/key-operations/misc.zig
index 12568696c0af..3d08c495db29 100644
--- a/src/key-operations/misc.zig
+++ b/src/key-operations/misc.zig
@@ -32,6 +32,16 @@ pub fn enterParentDir(_: *const KeyOperation) !void {
    try context.setCwd("..");
}

pub fn goHome(_: *const KeyOperation) !void {
    if (context.view != .nav) {
        context.mode.setMessage(.err, "Operation not supported in this view");
        return;
    }

    context.mode.setNav();
    try context.setCwd("~");
}

pub fn jumpBack(_: *const KeyOperation) !void {
    if (context.view != .nav) {
        context.mode.setMessage(.err, "Operation not supported in this view");
-- 
2.36.1

[nfm/patches] build failed

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CKE76IJB7IVL.SOQA8ZMJTN4C@cirno2>
In-Reply-To
<20220531193404.10746-1-mail@hmachet.com> (view parent)
DKIM signature
missing
Download raw message
nfm/patches: FAILED in 52s

[Add default keybind '~' to go to home dir][0] from [Hugo Machet][1]

[0]: https://lists.sr.ht/~leon_plickat/nfm/patches/32657
[1]: mail@hmachet.com

✓ #771297 SUCCESS nfm/patches/alpine.yml  https://builds.sr.ht/~leon_plickat/job/771297
✗ #771298 FAILED  nfm/patches/freebsd.yml https://builds.sr.ht/~leon_plickat/job/771298
Reply to thread Export thread (mbox)