]> Sergey Matveev's repositories - nnn.git/commitdiff
Keybind changes
authorArun Prakash Jana <engineerarun@gmail.com>
Tue, 14 Jan 2020 15:31:59 +0000 (21:01 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Tue, 14 Jan 2020 15:50:57 +0000 (21:20 +0530)
plugins/README.md
src/nnn.c
src/nnn.h

index 1433e11fc695a57cff9c3cf39c6bcd653c0a3446..507572cdd87cb55eda9167db532ead87cd27bce6 100644 (file)
@@ -65,7 +65,7 @@ Plugins are installed to `${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins`.
 
 ## Invoking a plugin
 
-Use the plugin shortcut (<kbd>;key</kbd> or <kbd>^Pkey</kbd>) to list the defined plugin keys and press the required key. E.g., with the below config:
+Use the plugin shortcut (<kbd>;key</kbd> or <kbd>^Skey</kbd>) to list the defined plugin keys and press the required key. E.g., with the below config:
 
     export NNN_PLUG='o:fzopen;p:mocplay;d:diffs;m:nmount;n:notes;v:imgviu;t:imgthumb'
 
index e4e282008da8659650863b4a6a5b0c4242041dbc..fdc1c22862fc3a73b32a8f2d32a7b1ed4a643ced 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -1571,7 +1571,7 @@ static bool cpmvrm_selection(enum action sel, char *path, int *presel)
                        return FALSE;
                }
                break;
-       default: /* SEL_RMMUL */
+       default: /* SEL_RM */
                rmmulstr(g_buf);
                break;
        }
@@ -3606,7 +3606,7 @@ static void show_help(const char *path)
               "9Up k  Up%-16cPgUp ^U  Scroll up\n"
               "9Dn j  Down%-14cPgDn ^D  Scroll down\n"
               "9Lt h  Parent%-12c~ ` @ -  HOME, /, start, last\n"
-          "5Ret Rt l  Open%-20cf  First file\n"
+          "5Ret Rt l  Open%-20c'  First file\n"
               "9g ^A  Top%-21c.  Toggle hidden\n"
               "9G ^E  End%-21c0  Lock terminal\n"
               "9b ^/  Bookmark key%-12c,  Pin CWD\n"
@@ -3616,20 +3616,19 @@ static void show_help(const char *path)
                  "c?  Help, conf%-13c^G  QuitCD\n"
               "9Q ^Q  Quit%-20cq  Quit context\n"
                "1FILES\n"
-                "b^O  Open with...%-12cn  Create new/link\n"
-                "b^F  File details%-12cd  Detail view toggle\n"
+              "9o ^O  Open with...%-12cn  Create new/link\n"
+              "9f ^F  File details%-12cd  Detail view toggle\n"
                 "b^R  Rename/dup%-14cr  Batch rename\n"
-                 "cz  Archive entry%-11c*  Toggle exe\n"
+                 "cz  Archive%-17c*  Toggle exe\n"
           "5Space ^J  (Un)select%-11cm ^K  Mark range/clear\n"
-                 "cp  Copy sel here%-11ca  Select all\n"
-                 "cv  Move sel here%-10c^V  Copy/move sel as\n"
-                 "cx  Delete sel%-13c^X  Delete entry\n"
-              "9o ^T  Sort toggles%-12ce  Edit sel\n"
+                 "9p ^P  Copy sel here%-11ca  Select all\n"
+                 "9v ^V  Move sel here%-8cw ^W  Copy/move sel as\n"
+                 "9x ^X  Delete%-18ce  Edit sel\n"
                "1MISC\n"
-              "9; ^P  Plugin%-18c=  Launch app\n"
+              "9; ^S  Select plugin%-11c=  Launch app\n"
               "9! ^]  Shell%-19c]  Cmd prompt\n"
-                 "cs  Manage session%-10cu  Unmount\n"
-                 "cc  Connect remote%-0c\n"
+                 "cc  Connect remote%-10cu  Unmount\n"
+              "9t ^T  Sort toggles%-12cs  Manage session\n"
        };
 
        fd = create_tmp_file();
@@ -5240,8 +5239,30 @@ nochange:
                case SEL_CP: // fallthrough
                case SEL_MV: // fallthrough
                case SEL_CPMVAS: // fallthrough
-               case SEL_RMMUL:
+               case SEL_RM:
                {
+                       if (sel == SEL_RM) {
+                               r = get_cur_or_sel();
+                               if (!r) {
+                                       statusbar(path);
+                                       goto nochange;
+                               }
+
+                               if (r == 'c') {
+                                       mkpath(path, dents[cur].name, newpath);
+                                       xrm(newpath);
+
+                                       if (cur && access(newpath, F_OK) == -1) {
+                                               move_cursor(cur - 1, 0);
+                                               copycurname();
+                                       }
+
+                                       if (cfg.filtermode)
+                                               presel = FILTER;
+                                       goto begin;
+                               }
+                       }
+
                        endselection();
 
                        if (!cpmvrm_selection(sel, path, &presel))
@@ -5257,25 +5278,6 @@ nochange:
                                copycurname();
                        goto begin;
                }
-               case SEL_RM:
-               {
-                       if (!ndents)
-                               break;
-
-                       mkpath(path, dents[cur].name, newpath);
-                       xrm(newpath);
-
-                       if (cur && access(newpath, F_OK) == -1)
-                               move_cursor(cur - 1, 0);
-
-                       /* We reduce cur only if it is > 0, so it's at least 0 */
-                       copycurname();
-
-                       if (cfg.filtermode)
-                               presel = FILTER;
-
-                       goto begin;
-               }
                case SEL_ARCHIVE: // fallthrough
                case SEL_OPENWITH: // fallthrough
                case SEL_NEW: // fallthrough
index d5f353d6e882f7cb461f3e5a5337dd148d17f3cb..d65febf204933fff017a1452b639fbd669d25a88 100644 (file)
--- a/src/nnn.h
+++ b/src/nnn.h
@@ -76,7 +76,6 @@ enum action {
        SEL_CP,
        SEL_MV,
        SEL_CPMVAS,
-       SEL_RMMUL,
        SEL_RM,
        SEL_OPENWITH,
        SEL_NEW,
@@ -136,7 +135,7 @@ static struct key bindings[] = {
        { 'G',            SEL_END },
        { CONTROL('E'),   SEL_END },
        /* Go to first file */
-       { 'f',            SEL_FIRST },
+       { '\'',           SEL_FIRST },
        /* HOME */
        { '~',            SEL_CDHOME },
        /* Initial directory */
@@ -168,13 +167,14 @@ static struct key bindings[] = {
        /* Detailed listing */
        { 'd',            SEL_DETAIL },
        /* File details */
+       { 'f',            SEL_STATS },
        { CONTROL('F'),   SEL_STATS },
        /* Toggle executable status */
        { '*',            SEL_CHMODX },
        /* Create archive */
        { 'z',            SEL_ARCHIVE },
-       /* Order toggle */
-       { 'o',            SEL_ORDER },
+       /* Sort toggles */
+       { 't',            SEL_ORDER },
        { CONTROL('T'),   SEL_ORDER },
        /* Redraw window */
        { CONTROL('L'),   SEL_REDRAW },
@@ -190,15 +190,18 @@ static struct key bindings[] = {
        { 'e',            SEL_SELEDIT },
        /* Copy from selection buffer */
        { 'p',            SEL_CP },
+       { CONTROL('P'),   SEL_CP },
        /* Move from selection buffer */
        { 'v',            SEL_MV },
+       { CONTROL('V'),   SEL_MV },
        /* Copy/move from selection buffer and rename */
-       { CONTROL('V'),   SEL_CPMVAS },
+       { 'w',            SEL_CPMVAS },
+       { CONTROL('W'),   SEL_CPMVAS },
        /* Delete from selection buffer */
-       { 'x',            SEL_RMMUL },
-       /* Delete currently selected */
+       { 'x',            SEL_RM },
        { CONTROL('X'),   SEL_RM },
        /* Open in a custom application */
+       { 'o',            SEL_OPENWITH },
        { CONTROL('O'),   SEL_OPENWITH },
        /* Create a new file */
        { 'n',            SEL_NEW },
@@ -214,7 +217,7 @@ static struct key bindings[] = {
        { '?',            SEL_HELP },
        /* Run a plugin */
        { ';',            SEL_PLUGIN },
-       { CONTROL('P'),   SEL_PLUGIN },
+       { CONTROL('S'),   SEL_PLUGIN },
        /* Run command */
        { '!',            SEL_SHELL },
        { CONTROL(']'),   SEL_SHELL },