Makefile | 5 +++++ src/nnn.c | 15 ++++++++++++++- diff --git a/Makefile b/Makefile index c6edbfa39cc0ea65e04860cc931d2fee745e52fa..7bd84f6901349863f06ef91ee37c616a3f8a5fdf 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,7 @@ O_NOSSN := 0 # disable session support O_NOUG := 0 # disable user, group name in status bar O_NOX11 := 0 # disable X11 integration O_MATCHFLTR := 0 # allow filters without matches +O_FILEINFO := 0 # show file informaiton in info line # User patches O_GITSTATUS := 0 # add git status to detail view @@ -119,6 +120,10 @@ endif ifeq ($(strip $(O_MATCHFLTR)),1) CPPFLAGS += -DMATCHFLTR +endif + +ifeq ($(strip $(O_FILEINFO)),1) + CPPFLAGS += -DFILEINFO endif ifeq ($(shell $(PKG_CONFIG) ncursesw && echo 1),1) diff --git a/src/nnn.c b/src/nnn.c index b06c99871ce4cc92adf2e2a79d57bc78ea9c91fe..b686310a7d77992a631e539a236574a0d0a78cb9 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -847,6 +847,7 @@ static void move_cursor(int target, int ignore_scrolloff); static char *load_input(int fd, const char *path); static int set_sort_flags(int r); static void statusbar(char *path); +static bool get_output(char *file, char *arg1, char *arg2, int fdout, bool multi, bool page); #ifndef NOFIFO static void notify_fifo(bool force); #endif @@ -3156,6 +3157,10 @@ (cfg.regex ? "reg" : "str"), ((fnstrstr == &strcasestr) ? "ic" : "noic")); clearinfoln(); +#ifdef FILEINFO + if (ndents && get_output("file", "-b", pdents[cur].name, -1, FALSE, FALSE)) + mvaddstr(xlines - 2, 2, g_buf); +#endif mvaddstr(xlines - 2, xcols - xstrlen(info), info); } @@ -6167,8 +6172,14 @@ ptr = "\b"; } else ptr = "\b"; - tolastln(); attron(COLOR_PAIR(cfg.curctx + 1)); + +#ifdef FILEINFO + if (get_output("file", "-b", pdents[cur].name, -1, FALSE, FALSE)) + mvaddstr(xlines - 2, 2, g_buf); +#endif + + tolastln(); printw("%d/%s ", cur + 1, xitoa(ndents)); @@ -6215,6 +6226,7 @@ addch(' '); } #endif if (S_ISLNK(pent->mode)) { +#ifndef FILEINFO i = readlink(pent->name, g_buf, PATH_MAX); addstr(coolsize(i >= 0 ? i : pent->size)); /* Show symlink size */ if (i > 1) { /* Show symlink target */ @@ -6226,6 +6238,7 @@ i = MIN(i, xcols - y); g_buf[i] = '\0'; addstr(g_buf); } +#endif } else { addstr(coolsize(pent->size)); addch(' ');