]> Sergey Matveev's repositories - nnn.git/commitdiff
Set detail view mode as default, introduce light mode
authorArun Prakash Jana <engineerarun@gmail.com>
Tue, 6 Jun 2017 15:31:28 +0000 (21:01 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Tue, 6 Jun 2017 15:31:28 +0000 (21:01 +0530)
README.md
config.def.h
misc/quitcd/quitcd.bash
misc/quitcd/quitcd.fish
misc/quitcd/quitcd.zsh
nnn.1
nnn.c

index 401ebd2c87c3ce4de5a25955d4b72425dd56b2c9..1d62caf27c06f1a66ae1a4baef669aed13c159d9 100644 (file)
--- a/README.md
+++ b/README.md
@@ -96,7 +96,7 @@ Have fun with it! PRs are welcome. Check out [#1](https://github.com/jarun/nnn/i
 ```
   PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 22515 vaio      20   0   60348  48712   2240 S   0.0  0.6   0:01.11 ncdu /
-22574 vaio      20   0   17588   4320   2584 S   0.0  0.1   0:00.44 nnn -d /
+22574 vaio      20   0   17588   4320   2584 S   0.0  0.1   0:00.44 nnn /
 ```
 
 `nnn` vs. mc vs. ranger memory usage while viewing a directory with 11244 files, sorted by size:
@@ -128,7 +128,7 @@ Have fun with it! PRs are welcome. Check out [#1](https://github.com/jarun/nnn/i
 
 #### Cmdline options
 
-    usage: nnn [-d] [-S] [-v] [h] [PATH]
+    usage: nnn [-l] [-i] [-p custom_nlay] [-S] [-v] [-h] [PATH]
 
     The missing terminal file browser for X.
 
@@ -136,7 +136,7 @@ Have fun with it! PRs are welcome. Check out [#1](https://github.com/jarun/nnn/i
       PATH           directory to open [default: current dir]
 
     optional arguments:
-      -d             start in detail view mode
+      -l             start in light mode (fewer details)
       -i             start in navigate-as-you-type mode
       -p             path to custom nlay
       -S             start in disk usage analyzer mode
@@ -233,13 +233,16 @@ To lookup keyboard shortcuts at runtime, press <kbd>?</kbd>.
 
 Add the following to your shell's rc file for the best experience:
 
-1. Always open `nnn` in detail mode:
+1. Use a shorter and sweeter alias:
 
-        alias n='nnn -d'
-2. Set a desktop file manager to open directories with (if you need one). E.g.:
+        alias n=nnn
+2. Optionally open all text files in EDITOR (fallback vi):
+
+        export NNN_USE_EDITOR=1
+3. Set a desktop file manager to open directories with (if you ever need to). E.g.:
 
         export NNN_DE_FILE_MANAGER=thunar
-3. Start `nnn`.
+4. Start `nnn`.
 
         n
 
index 1560636cc2191cfcb50c023cefac52db4e0b059e..747de2e12d778db22f18804fe26e08f843680a41 100644 (file)
@@ -9,7 +9,7 @@ static int sizeorder   = 0; /* Set to 1 to sort by file size */
 static int bsizeorder  = 0; /* Set to 1 to sort by blocks used including content */
 static int idletimeout = 0; /* Screensaver timeout in seconds, 0 to disable */
 static int showhidden  = 0; /* Set to 1 to show hidden files by default */
-static int showdetail  = 0; /* Set to show additional file info */
+static int showdetail  = 1; /* Set to 0 to show fewer file info */
 
 static struct assoc assocs[] = {
        { "\\.(c|cpp|h|log|md|py|sh|txt)$", "text" },
index 71abf1fd5f910f733755fc7f219a3e690f5b31cb..5248036ed742d84c70bae02fc20b34c9ab76c446 100644 (file)
@@ -3,9 +3,9 @@ export NNN_TMPFILE="/tmp/nnn"
 n()
 {
         if [ -n "$1" ]; then
-                nnn -d "$1"
+                nnn "$1"
         else
-                nnn -d
+                nnn
         fi
 
         if [ -f $NNN_TMPFILE ]; then
index f4380099117ade73032c11a139fd6c7cb4356bc9..59a7f1bcb40d582f1b8c3fe023051d3569a2f0e0 100644 (file)
@@ -1,7 +1,7 @@
 export NNN_TMPFILE="/tmp/nnn"
 
 function n --description 'support nnn quit and change directory'
-        nnn -d $argv[1]
+        nnn $argv[1]
 
         if test -e $NNN_TMPFILE
                 . $NNN_TMPFILE
index 71abf1fd5f910f733755fc7f219a3e690f5b31cb..5248036ed742d84c70bae02fc20b34c9ab76c446 100644 (file)
@@ -3,9 +3,9 @@ export NNN_TMPFILE="/tmp/nnn"
 n()
 {
         if [ -n "$1" ]; then
-                nnn -d "$1"
+                nnn "$1"
         else
-                nnn -d
+                nnn
         fi
 
         if [ -f $NNN_TMPFILE ]; then
diff --git a/nnn.1 b/nnn.1
index c89348e078e0cc83b5b794f8aaad82eb4145d066..d929fdce8c11ea67f28c7edd979a9182be986aa9 100644 (file)
--- a/nnn.1
+++ b/nnn.1
@@ -6,7 +6,7 @@
 .Nd the missing terminal file browser for X
 .Sh SYNOPSIS
 .Nm
-.Op Ar -d
+.Op Ar -l
 .Op Ar -i
 .Op Ar -p custom_nlay
 .Op Ar -S
@@ -99,8 +99,8 @@ directory you came out of.
 .Nm
 supports the following options:
 .Pp
-.Fl d
-        start in detail view mode
+.Fl l
+        start in light mode (fewer details)
 .Pp
 .Fl i
         start in navigate-as-you-type mode
diff --git a/nnn.c b/nnn.c
index 61f1e917d56bff36a42f6aab0d6efa0871e27ace..7af3c4ddd3dcdd1b85c25c15a61b657e15282008 100644 (file)
--- a/nnn.c
+++ b/nnn.c
@@ -898,8 +898,6 @@ printent(struct entry *ent, int active)
        printw("%s\n", g_buf);
 }
 
-static void (*printptr)(struct entry *ent, int active) = &printent;
-
 static char*
 coolsize(off_t size)
 {
@@ -1007,6 +1005,8 @@ printent_long(struct entry *ent, int active)
                attroff(A_REVERSE);
 }
 
+static void (*printptr)(struct entry *ent, int active) = &printent_long;
+
 static char
 get_fileind(mode_t mode, char *desc)
 {
@@ -2090,12 +2090,12 @@ nochange:
 static void
 usage(void)
 {
-       fprintf(stdout, "usage: nnn [-d] [-i] [-p custom_nlay] [-S] [-v] [-h] [PATH]\n\n\
+       fprintf(stdout, "usage: nnn [-l] [-i] [-p custom_nlay] [-S] [-v] [-h] [PATH]\n\n\
 The missing terminal file browser for X.\n\n\
 positional arguments:\n\
   PATH           directory to open [default: current dir]\n\n\
 optional arguments:\n\
-  -d             start in detail view mode\n\
+  -l             start in light mode (fewer details)\n\
   -i             start in navigate-as-you-type mode\n\
   -p             path to custom nlay\n\
   -S             start in disk usage analyzer mode\n\
@@ -2121,14 +2121,14 @@ main(int argc, char *argv[])
                exit(1);
        }
 
-       while ((opt = getopt(argc, argv, "dSip:vh")) != -1) {
+       while ((opt = getopt(argc, argv, "dlSip:vh")) != -1) {
                switch (opt) {
                case 'S':
-                       bsizeorder = 1; // fallthrough
-               case 'd':
-                       /* Open in detail mode, if set */
-                       showdetail = 1;
-                       printptr = &printent_long;
+                       bsizeorder = 1;
+                       break;
+               case 'l':
+                       showdetail = 0;
+                       printptr = &printent;
                        break;
                case 'i':
                        filtermode = 1;
@@ -2139,6 +2139,9 @@ main(int argc, char *argv[])
                case 'v':
                        fprintf(stdout, "%s\n", VERSION);
                        return 0;
+               case 'd':
+                       fprintf(stderr, "option -d is deprecated, detail view mode is default now.\n");
+                       break;
                case 'h': // fallthrough
                default:
                        usage();