Browse Source

Set detail view mode as default, introduce light mode

master
Arun Prakash Jana 7 years ago
parent
commit
889500b057
No known key found for this signature in database GPG Key ID: A75979F35C080412
7 changed files with 32 additions and 26 deletions
  1. +10
    -7
      README.md
  2. +1
    -1
      config.def.h
  3. +2
    -2
      misc/quitcd/quitcd.bash
  4. +1
    -1
      misc/quitcd/quitcd.fish
  5. +2
    -2
      misc/quitcd/quitcd.zsh
  6. +3
    -3
      nnn.1
  7. +13
    -10
      nnn.c

+ 10
- 7
README.md View File

@@ -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 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 / 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: `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 #### 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. 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] PATH directory to open [default: current dir]


optional arguments: optional arguments:
-d start in detail view mode
-l start in light mode (fewer details)
-i start in navigate-as-you-type mode -i start in navigate-as-you-type mode
-p path to custom nlay -p path to custom nlay
-S start in disk usage analyzer mode -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: 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 export NNN_DE_FILE_MANAGER=thunar
3. Start `nnn`.
4. Start `nnn`.


n n




+ 1
- 1
config.def.h View 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 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 idletimeout = 0; /* Screensaver timeout in seconds, 0 to disable */
static int showhidden = 0; /* Set to 1 to show hidden files by default */ 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[] = { static struct assoc assocs[] = {
{ "\\.(c|cpp|h|log|md|py|sh|txt)$", "text" }, { "\\.(c|cpp|h|log|md|py|sh|txt)$", "text" },


+ 2
- 2
misc/quitcd/quitcd.bash View File

@@ -3,9 +3,9 @@ export NNN_TMPFILE="/tmp/nnn"
n() n()
{ {
if [ -n "$1" ]; then if [ -n "$1" ]; then
nnn -d "$1"
nnn "$1"
else else
nnn -d
nnn
fi fi


if [ -f $NNN_TMPFILE ]; then if [ -f $NNN_TMPFILE ]; then


+ 1
- 1
misc/quitcd/quitcd.fish View File

@@ -1,7 +1,7 @@
export NNN_TMPFILE="/tmp/nnn" export NNN_TMPFILE="/tmp/nnn"


function n --description 'support nnn quit and change directory' function n --description 'support nnn quit and change directory'
nnn -d $argv[1]
nnn $argv[1]


if test -e $NNN_TMPFILE if test -e $NNN_TMPFILE
. $NNN_TMPFILE . $NNN_TMPFILE


+ 2
- 2
misc/quitcd/quitcd.zsh View File

@@ -3,9 +3,9 @@ export NNN_TMPFILE="/tmp/nnn"
n() n()
{ {
if [ -n "$1" ]; then if [ -n "$1" ]; then
nnn -d "$1"
nnn "$1"
else else
nnn -d
nnn
fi fi


if [ -f $NNN_TMPFILE ]; then if [ -f $NNN_TMPFILE ]; then


+ 3
- 3
nnn.1 View File

@@ -6,7 +6,7 @@
.Nd the missing terminal file browser for X .Nd the missing terminal file browser for X
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Ar -d
.Op Ar -l
.Op Ar -i .Op Ar -i
.Op Ar -p custom_nlay .Op Ar -p custom_nlay
.Op Ar -S .Op Ar -S
@@ -99,8 +99,8 @@ directory you came out of.
.Nm .Nm
supports the following options: supports the following options:
.Pp .Pp
.Fl d
start in detail view mode
.Fl l
start in light mode (fewer details)
.Pp .Pp
.Fl i .Fl i
start in navigate-as-you-type mode start in navigate-as-you-type mode


+ 13
- 10
nnn.c View File

@@ -898,8 +898,6 @@ printent(struct entry *ent, int active)
printw("%s\n", g_buf); printw("%s\n", g_buf);
} }


static void (*printptr)(struct entry *ent, int active) = &printent;

static char* static char*
coolsize(off_t size) coolsize(off_t size)
{ {
@@ -1007,6 +1005,8 @@ printent_long(struct entry *ent, int active)
attroff(A_REVERSE); attroff(A_REVERSE);
} }


static void (*printptr)(struct entry *ent, int active) = &printent_long;

static char static char
get_fileind(mode_t mode, char *desc) get_fileind(mode_t mode, char *desc)
{ {
@@ -2090,12 +2090,12 @@ nochange:
static void static void
usage(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\ The missing terminal file browser for X.\n\n\
positional arguments:\n\ positional arguments:\n\
PATH directory to open [default: current dir]\n\n\ PATH directory to open [default: current dir]\n\n\
optional arguments:\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\ -i start in navigate-as-you-type mode\n\
-p path to custom nlay\n\ -p path to custom nlay\n\
-S start in disk usage analyzer mode\n\ -S start in disk usage analyzer mode\n\
@@ -2121,14 +2121,14 @@ main(int argc, char *argv[])
exit(1); exit(1);
} }


while ((opt = getopt(argc, argv, "dSip:vh")) != -1) {
while ((opt = getopt(argc, argv, "dlSip:vh")) != -1) {
switch (opt) { switch (opt) {
case 'S': 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; break;
case 'i': case 'i':
filtermode = 1; filtermode = 1;
@@ -2139,6 +2139,9 @@ main(int argc, char *argv[])
case 'v': case 'v':
fprintf(stdout, "%s\n", VERSION); fprintf(stdout, "%s\n", VERSION);
return 0; return 0;
case 'd':
fprintf(stderr, "option -d is deprecated, detail view mode is default now.\n");
break;
case 'h': // fallthrough case 'h': // fallthrough
default: default:
usage(); usage();


Loading…
Cancel
Save