From 11dac5e3db997c633e1a8ebd096655191c7580f3 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sat, 24 Feb 2018 21:43:41 +0530 Subject: Add shortcut ^G to quit and cd --- CHANGELOG | 2 ++ README.md | 5 +++-- nnn.1 | 2 +- nnn.c | 3 ++- nnn.h | 1 + 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 225f412..bf3fe8c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -13,6 +13,7 @@ What's in? - ^J - toggle du mode - R - batch rename files in vidir - ^F - extract archive (replaces ^X) + - ^G - quit nnn and change dir - ^X - quit nnn (replaces ^Q) - Extra shortcuts enabled in nav-as-you-type mode: - ^K, ^Y (file path copy) @@ -25,6 +26,7 @@ What's in? - ^/ (open desktop opener) - ^F (extract archive) - ^L (refresh) + - ^G (quit nnn and change dir) - ^X (quit nnn) ------------------------------------------------------------------------------- diff --git a/README.md b/README.md index 6cebcf3..3ca1082 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,6 @@ Have fun with it! PRs are welcome. Check out [#1](https://github.com/jarun/nnn/i - Terminal screensaver (default vlock, customizable) integration - Unicode support - Highly optimized code, minimal resource usage -- Minimal dependencies ### Performance @@ -254,7 +253,7 @@ optional arguments: ^T | Toggle path quote ^L | Redraw, clear prompt ? | Help, settings - Q | Quit and cd + Q, ^G | Quit and cd q, ^X | Quit ``` @@ -331,6 +330,8 @@ Add the following to your shell's rc file for the best experience: 5. Set `NNN_NOWAIT`, if nnn [blocks on your desktop environment](#nnn-blocks-on-opening-files) when a file is open. +6. Press ? for help on keyboard shortcuts anytime. + ### How to #### add bookmarks diff --git a/nnn.1 b/nnn.1 index 9308f77..df5cc45 100644 --- a/nnn.1 +++ b/nnn.1 @@ -112,7 +112,7 @@ Toggle path quote Force a redraw, clear rename or filter prompt .It Ic \&? Toggle help and settings screen -.It Ic Q +.It Ic Q, ^G Quit and change directory .It Ic q, ^X Quit diff --git a/nnn.c b/nnn.c index 6a11fa7..9dfad66 100644 --- a/nnn.c +++ b/nnn.c @@ -1141,6 +1141,7 @@ filterentries(char *path) case CONTROL('B'): // fallthrough case CONTROL('V'): // fallthrough case CONTROL('J'): // fallthrough + case CONTROL('G'): // fallthrough case CONTROL('X'): // fallthrough case CONTROL('F'): // fallthrough case CONTROL('T'): @@ -1891,7 +1892,7 @@ show_help(char *path) "d^T | Toggle path quote\n" "d^L | Redraw, clear prompt\n" "e? | Help, settings\n" - "eQ | Quit and cd\n" + "aQ, ^G | Quit and cd\n" "aq, ^X | Quit\n\n"); if (fd == -1) diff --git a/nnn.h b/nnn.h index 8ab8657..60e277d 100644 --- a/nnn.h +++ b/nnn.h @@ -170,6 +170,7 @@ static struct key bindings[] = { { 'p', SEL_RUNARG, "less", "PAGER" }, /* Change dir on quit */ { 'Q', SEL_CDQUIT, "", "" }, + { CONTROL('G'), SEL_CDQUIT, "", "" }, /* Quit */ { 'q', SEL_QUIT, "", "" }, { CONTROL('X'), SEL_QUIT, "", "" }, -- cgit v1.2.3-70-g09d2