From 3be2dd839060f49ba506289a26aab96b542c3d1e Mon Sep 17 00:00:00 2001 From: KlzXS Date: Fri, 26 Nov 2021 10:33:11 +0100 Subject: [PATCH 1/9] Remove -E from sed in plugins --- plugins/dups | 16 ++++++++-------- plugins/xdgdefault | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/dups b/plugins/dups index a3fbbc69..27c1807f 100755 --- a/plugins/dups +++ b/plugins/dups @@ -28,17 +28,17 @@ printf "\ " > "$tmpfile" # shellcheck disable=SC2016 -find . -size +0 -type f -printf "%${size_digits}s %p\n" | sort -rn | uniq -w"${size_digits}" -D | sed -E ' -s/^ {,12}([0-9]{,12}) (.*)$/printf "%s %s\\n" "$(md5sum "\2")" "d\1"/ -' | tr '\n' '\0' | xargs -0 -n1 sh -c | sort | { uniq -w32 --all-repeated=separate; echo; } | sed -nE ' +find . -size +0 -type f -printf "%${size_digits}s %p\n" | sort -rn | uniq -w"${size_digits}" -D | sed -e ' +s/^ \{0,12\}\([0-9]\{0,12\}\) \(.*\)$/printf "%s %s\\n" "$(md5sum "\2")" "d\1"/ +' | tr '\n' '\0' | xargs -0 -n1 sh -c | sort | { uniq -w32 --all-repeated=separate; echo; } | sed -ne ' h -s/^(.{32}).* d([0-9]*)$/## md5sum: \1 size: \2 bytes/p +s/^\(.\{32\}\).* d\([0-9]*\)$/## md5sum: \1 size: \2 bytes/p g :loop N /.*\n$/!b loop -p' | sed -E 's/^.{32} (.*) d[0-9]*$/\1/' >> "$tmpfile" +p' | sed -e 's/^.\{32\} \(.*\) d[0-9]*$/\1/' >> "$tmpfile" "$EDITOR" "$tmpfile" @@ -46,7 +46,7 @@ printf "Remove commented files? (yes/no) [default=n]: " read -r commented if [ "$commented" = "y" ]; then - sedcmd="/^(##|[^#]).*/d; /^$/d; s/^# *(.*)$/\1/" + sedcmd="/^##.*/d; /^[^#].*/d; /^$/d; s/^# *\(.*\)$/\1/" else printf "Press any key to exit" read -r _ @@ -58,10 +58,10 @@ read -r force if [ "$force" = "f" ]; then #shellcheck disable=SC2016 - sed -E "$sedcmd" "$tmpfile" | tr '\n' '\0' | xargs -0 -r sh -c 'rm -f "$0" "$@" Date: Tue, 14 Dec 2021 17:16:56 +0100 Subject: [PATCH 2/9] Replace restorepreview workaround --- patches/restorepreview/mainline.diff | 7 +++++-- plugins/preview-tui | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/patches/restorepreview/mainline.diff b/patches/restorepreview/mainline.diff index b0118514..402eeea9 100644 --- a/patches/restorepreview/mainline.diff +++ b/patches/restorepreview/mainline.diff @@ -1,5 +1,8 @@ -# Description: Adds preview pipe to enable closing and re-opening -# the preview pane when running an undetached editor. +# Description: Adds preview pipe to enable closing and re-opening the preview +# pane when running an undetached editor. If you are using vim +# you might experience incorrectly resized window. Consider adding +# the following to your vimrc: +# autocmd VimEnter * :silent exec "!kill -s WINCH $PPID" # # Authors: Luuk van Baal diff --git a/plugins/preview-tui b/plugins/preview-tui index c718af40..6af3d658 100755 --- a/plugins/preview-tui +++ b/plugins/preview-tui @@ -415,7 +415,7 @@ preview_fifo() { if [ -n "$selection" ]; then kill "$(cat "$PREVIEWPID")" [ -p "$FIFO_UEBERZUG" ] && ueberzug_remove - [ "$selection" = "close" ] && sleep 0.15 && pkill -P "$$" && exit + [ "$selection" = "close" ] && break preview_file "$selection" printf "%s" "$selection" > "$CURSEL" fi From 48bcc929e836432fb0634105044b12fe41222c91 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Fri, 17 Dec 2021 12:41:29 +0100 Subject: [PATCH 3/9] Restorepreview when launching subshell --- patches/restorepreview/mainline.diff | 76 ++++++++++++++++------------ 1 file changed, 45 insertions(+), 31 deletions(-) diff --git a/patches/restorepreview/mainline.diff b/patches/restorepreview/mainline.diff index 402eeea9..979f9659 100644 --- a/patches/restorepreview/mainline.diff +++ b/patches/restorepreview/mainline.diff @@ -7,20 +7,20 @@ # Authors: Luuk van Baal diff --git a/src/nnn.c b/src/nnn.c -index c7440149..8ae75614 100644 +index 4243f2cc..b893f573 100644 --- a/src/nnn.c +++ b/src/nnn.c -@@ -368,7 +368,8 @@ typedef struct { - uint_t stayonsel : 1; /* Disable auto-proceed on select */ - uint_t trash : 2; /* Trash method 0: rm -rf, 1: trash-cli, 2: gio trash */ - uint_t uidgid : 1; /* Show owner and group info */ +@@ -370,7 +370,8 @@ typedef struct { + uint_t stayonsel : 1; /* Disable auto-proceed on select */ + uint_t trash : 2; /* Trash method 0: rm -rf, 1: trash-cli, 2: gio trash */ + uint_t uidgid : 1; /* Show owner and group info */ - uint_t reserved : 7; /* Adjust when adding/removing a field */ + uint_t previewer : 1; /* Run state of previewer */ + uint_t reserved : 6; /* Adjust when adding/removing a field */ } runstate; /* Contexts or workspaces */ -@@ -516,6 +517,9 @@ static char g_tmpfpath[TMP_LEN_MAX] __attribute__ ((aligned)); +@@ -518,6 +519,9 @@ static char g_tmpfpath[TMP_LEN_MAX] __attribute__ ((aligned)); /* Buffer to store plugins control pipe location */ static char g_pipepath[TMP_LEN_MAX] __attribute__ ((aligned)); @@ -30,7 +30,7 @@ index c7440149..8ae75614 100644 /* Non-persistent runtime states */ static runstate g_state; -@@ -690,12 +694,13 @@ static const char * const messages[] = { +@@ -692,12 +696,13 @@ static const char * const messages[] = { #define NNN_FCOLORS 5 #define NNNLVL 6 #define NNN_PIPE 7 @@ -50,7 +50,7 @@ index c7440149..8ae75614 100644 static const char * const env_cfg[] = { "NNN_OPTS", -@@ -706,6 +711,7 @@ static const char * const env_cfg[] = { +@@ -708,6 +713,7 @@ static const char * const env_cfg[] = { "NNN_FCOLORS", "NNNLVL", "NNN_PIPE", @@ -58,7 +58,7 @@ index c7440149..8ae75614 100644 "NNN_MCLICK", "NNN_SEL", "NNN_ARCHIVE", -@@ -850,7 +856,7 @@ static int set_sort_flags(int r); +@@ -854,7 +860,7 @@ 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 @@ -67,7 +67,7 @@ index c7440149..8ae75614 100644 #endif /* Functions */ -@@ -3065,7 +3071,7 @@ try_quit: +@@ -3061,7 +3067,7 @@ try_quit: } else { #ifndef NOFIFO if (!g_state.fifomode) @@ -76,7 +76,7 @@ index c7440149..8ae75614 100644 #endif escaped = TRUE; settimeout(); -@@ -5164,15 +5170,20 @@ static bool run_cmd_as_plugin(const char *file, char *runfile, uchar_t flags) +@@ -5160,15 +5166,20 @@ static bool run_cmd_as_plugin(const char *file, char *runfile, uchar_t flags) static bool plctrl_init(void) { @@ -101,7 +101,7 @@ index c7440149..8ae75614 100644 return EXIT_SUCCESS; } -@@ -5201,6 +5212,21 @@ static ssize_t read_nointr(int fd, void *buf, size_t count) +@@ -5197,6 +5208,21 @@ static ssize_t read_nointr(int fd, void *buf, size_t count) return len; } @@ -123,7 +123,7 @@ index c7440149..8ae75614 100644 static char *readpipe(int fd, char *ctxnum, char **path) { char ctx, *nextpath = NULL; -@@ -5864,7 +5890,7 @@ static void populate(char *path, char *lastname) +@@ -5862,7 +5888,7 @@ static void populate(char *path, char *lastname) } #ifndef NOFIFO @@ -132,7 +132,7 @@ index c7440149..8ae75614 100644 { if (!fifopath) return; -@@ -5880,6 +5906,12 @@ static void notify_fifo(bool force) +@@ -5878,6 +5904,12 @@ static void notify_fifo(bool force) } } @@ -145,16 +145,16 @@ index c7440149..8ae75614 100644 static struct entry lastentry; if (!force && !memcmp(&lastentry, &pdents[cur], sizeof(struct entry))) -@@ -5912,7 +5944,7 @@ static void send_to_explorer(int *presel) - if (fd > 1) - close(fd); - } else +@@ -5910,7 +5942,7 @@ static void send_to_explorer(int *presel) + if (fd > 1) + close(fd); + } else - notify_fifo(TRUE); /* Send opened path to NNN_FIFO */ + notify_fifo(TRUE, FALSE); /* Send opened path to NNN_FIFO */ } #endif -@@ -5945,7 +5977,7 @@ static void move_cursor(int target, int ignore_scrolloff) +@@ -5943,7 +5975,7 @@ static void move_cursor(int target, int ignore_scrolloff) #ifndef NOFIFO if (!g_state.fifomode) @@ -163,16 +163,16 @@ index c7440149..8ae75614 100644 #endif } -@@ -6567,7 +6599,7 @@ static bool browse(char *ipath, const char *session, int pkey) +@@ -6565,7 +6597,7 @@ static bool browse(char *ipath, const char *session, int pkey) pEntry pent; enum action sel; struct stat sb; - int r = -1, presel, selstartid = 0, selendid = 0; + int r = -1, presel, selstartid = 0, selendid = 0, previewkey = 0; const uchar_t opener_flags = (cfg.cliopener ? F_CLI : (F_NOTRACE | F_NOSTDIN | F_NOWAIT)); - bool watch = FALSE, cd = TRUE; + bool watch = FALSE, cd = TRUE; ino_t inode = 0; -@@ -6821,7 +6853,7 @@ nochange: +@@ -6819,7 +6851,7 @@ nochange: move_cursor(r, 1); #ifndef NOFIFO else if ((event.bstate == BUTTON1_PRESSED) && !g_state.fifomode) @@ -181,7 +181,7 @@ index c7440149..8ae75614 100644 #endif /* Handle right click selection */ if (event.bstate == BUTTON3_PRESSED) { -@@ -6981,7 +7013,14 @@ nochange: +@@ -6979,7 +7011,14 @@ nochange: && strstr(g_buf, "text") #endif ) { @@ -196,14 +196,14 @@ index c7440149..8ae75614 100644 if (cfg.filtermode) { presel = FILTER; clearfilter(); -@@ -7293,8 +7332,14 @@ nochange: +@@ -7291,8 +7330,14 @@ nochange: copycurname(); goto nochange; case SEL_EDIT: + if (g_state.previewer) + notify_fifo(FALSE, TRUE); - if (!g_state.picker) - spawn(editor, newpath, NULL, NULL, F_CLI); + if (!g_state.picker) + spawn(editor, newpath, NULL, NULL, F_CLI); + if (g_state.previewer) { + pkey = previewkey; + goto run_plugin; @@ -211,15 +211,15 @@ index c7440149..8ae75614 100644 continue; default: /* SEL_LOCK */ lock_terminal(); -@@ -7660,6 +7705,7 @@ nochange: - cd = FALSE; +@@ -7661,6 +7706,7 @@ nochange: + cd = FALSE; goto begin; } +run_plugin: case SEL_PLUGIN: /* Check if directory is accessible */ if (!xdiraccess(plgpath)) { -@@ -7685,6 +7731,12 @@ nochange: +@@ -7686,6 +7732,12 @@ nochange: goto nochange; } @@ -232,7 +232,21 @@ index c7440149..8ae75614 100644 if (tmp[0] == '-' && tmp[1]) { ++tmp; r = FALSE; /* Do not refresh dir after completion */ -@@ -8281,8 +8333,10 @@ static void cleanup(void) +@@ -7740,7 +7792,13 @@ nochange: + case SEL_SHELL: // fallthrough + case SEL_LAUNCH: // fallthrough + case SEL_PROMPT: ++ if (g_state.previewer) ++ notify_fifo(FALSE, TRUE); + r = handle_cmd(sel, newpath); ++ if (g_state.previewer) { ++ pkey = previewkey; ++ goto run_plugin; ++ } + + /* Continue in type-to-nav mode, if enabled */ + if (cfg.filtermode) +@@ -8282,8 +8340,10 @@ static void cleanup(void) if (g_state.autofifo) unlink(fifopath); #endif @@ -244,7 +258,7 @@ index c7440149..8ae75614 100644 #ifdef DEBUG disabledbg(); #endif -@@ -8786,7 +8840,7 @@ int main(int argc, char *argv[]) +@@ -8787,7 +8847,7 @@ int main(int argc, char *argv[]) #ifndef NOFIFO if (!g_state.fifomode) From ac86fbed0f9394c01a883d9ff4eb5fadfa6d1306 Mon Sep 17 00:00:00 2001 From: NRK Date: Wed, 15 Dec 2021 00:45:58 +0600 Subject: [PATCH 4/9] add icon for opus files --- src/icons-nerdfont.h | 1 + src/icons.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/icons-nerdfont.h b/src/icons-nerdfont.h index bda29321..d5316fbe 100644 --- a/src/icons-nerdfont.h +++ b/src/icons-nerdfont.h @@ -187,6 +187,7 @@ /* O */ #define ICON_EXT_O ICON_MANUAL #define ICON_EXT_OGG ICON_MUSICFILE +#define ICON_EXT_OPUS ICON_MUSICFILE #define ICON_EXT_ODOWNLOAD ICON_DOWNLOADS #define ICON_EXT_OUT ICON_LINUX diff --git a/src/icons.h b/src/icons.h index cc5fded2..ca345a45 100644 --- a/src/icons.h +++ b/src/icons.h @@ -223,6 +223,7 @@ static const struct icon_pair icons_ext[] = { /* O */ {"o", FILE_MANPAGE, 0}, {"ogg", FA_FILE_AUDIO_O, COLOR_AUDIO}, + {"opus", FA_FILE_AUDIO_O, COLOR_AUDIO}, {"opdownload", FA_DOWNLOAD, 0}, {"out", FA_LINUX, 0}, @@ -436,6 +437,7 @@ static const struct icon_pair icons_ext[] = { /* O */ {"o", ICON_EXT_O, 0}, {"ogg", ICON_EXT_OGG, COLOR_AUDIO}, + {"opus", ICON_EXT_OPUS, COLOR_AUDIO}, {"opdownload", ICON_EXT_ODOWNLOAD, 0}, {"out", ICON_EXT_OUT, 0}, From a3d660b673ad05da87511dd31c55ceb35993fe8f Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Sat, 18 Dec 2021 22:34:24 +0100 Subject: [PATCH 5/9] Preview-tui fix gif whitespace name --- plugins/preview-tui | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/preview-tui b/plugins/preview-tui index 6af3d658..8b642e35 100755 --- a/plugins/preview-tui +++ b/plugins/preview-tui @@ -339,13 +339,14 @@ generate_preview() { epub) gnome-epub-thumbnailer "$3" "$NNN_PREVIEWDIR/$3.jpg" ;; font) fontpreview -i "$3" -o "$NNN_PREVIEWDIR/$3.jpg" ;; gif) if [ -p "$FIFO_UEBERZUG" ] && exists convert; then + frameprefix="$NNN_PREVIEWDIR/$3/${3##*/}" if [ ! -d "$NNN_PREVIEWDIR/$3" ]; then mkdir -p "$NNN_PREVIEWDIR/$3" - convert -coalesce -resize "$NNN_PREVIEWWIDTH"x"$NNN_PREVIEWHEIGHT"\> "$3" "$NNN_PREVIEWDIR/$3/${3##*/}.jpg" + convert -coalesce -resize "$NNN_PREVIEWWIDTH"x"$NNN_PREVIEWHEIGHT"\> "$3" "$frameprefix.jpg" fi while true; do - for frame in $(find "$NNN_PREVIEWDIR/$3"/*.jpg | sort -V); do - image_preview "$1" "$2" "$frame" + for i in $(seq 0 "$(($(find "$NNN_PREVIEWDIR/$3" | wc -l) - 2))"); do + image_preview "$1" "$2" "$frameprefix-$i.jpg" sleep 0.1 done done & From beafeaaea2551cf089f888dee7f103c672c213a6 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Mon, 20 Dec 2021 02:39:10 +0100 Subject: [PATCH 6/9] Preview-tui fix gif conversion --- plugins/preview-tui | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/plugins/preview-tui b/plugins/preview-tui index 8b642e35..81f9f4fb 100755 --- a/plugins/preview-tui +++ b/plugins/preview-tui @@ -339,19 +339,22 @@ generate_preview() { epub) gnome-epub-thumbnailer "$3" "$NNN_PREVIEWDIR/$3.jpg" ;; font) fontpreview -i "$3" -o "$NNN_PREVIEWDIR/$3.jpg" ;; gif) if [ -p "$FIFO_UEBERZUG" ] && exists convert; then - frameprefix="$NNN_PREVIEWDIR/$3/${3##*/}" + frameprefix="$NNN_PREVIEWDIR/$3/${3##*/}" if [ ! -d "$NNN_PREVIEWDIR/$3" ]; then mkdir -p "$NNN_PREVIEWDIR/$3" - convert -coalesce -resize "$NNN_PREVIEWWIDTH"x"$NNN_PREVIEWHEIGHT"\> "$3" "$frameprefix.jpg" + convert -coalesce -resize "$NNN_PREVIEWWIDTH"x"$NNN_PREVIEWHEIGHT"\> "$3" "$frameprefix.jpg" || + MAGICK_TMPDIR="/tmp" convert -coalesce -resize "$NNN_PREVIEWWIDTH"x"$NNN_PREVIEWHEIGHT"\> "$3" "$frameprefix.jpg" fi - while true; do - for i in $(seq 0 "$(($(find "$NNN_PREVIEWDIR/$3" | wc -l) - 2))"); do - image_preview "$1" "$2" "$frameprefix-$i.jpg" - sleep 0.1 - done - done & - printf "%s" "$!" > "$PREVIEWPID" - return + frames=$(($(find "$NNN_PREVIEWDIR/$3" | wc -l) - 2)) + [ $frames -lt 0 ] && return + while true; do + for i in $(seq 0 $frames); do + image_preview "$1" "$2" "$frameprefix-$i.jpg" + sleep 0.1 + done + done & + printf "%s" "$!" > "$PREVIEWPID" + return else exec >/dev/tty image_preview "$1" "$2" "$3" From b69f838fb8bf4a71147db783bc358348f205eaf0 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Mon, 20 Dec 2021 11:56:54 +0530 Subject: [PATCH 7/9] Update bug report template --- .github/ISSUE_TEMPLATE/bug_report.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 8fb4f8fc..f4bd933e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -36,6 +36,7 @@ If we need more information and there is no communication from the bug reporter - [ ] Custom desktop opener (if applicable): - [ ] Program options used: - [ ] Configuration options set: +- [ ] Plugins are installed - [ ] Issue exists on `nnn` master #### Exact steps to reproduce the issue From 0fb7a25612b2afdf17f82daa68ae7d756dd4e92b Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sat, 25 Dec 2021 07:49:03 +0530 Subject: [PATCH 8/9] Use terms consistent with man page in docs --- README.md | 4 ++-- src/nnn.c | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index cfc48443..20792e65 100644 --- a/README.md +++ b/README.md @@ -58,13 +58,13 @@ Runs on the Pi, [Termux](https://www.youtube.com/embed/AbaauM7gUJw) (Android), L - Disk usage analyzer (block/apparent) - File picker, (neo)vim plugin - Navigation - - *Type-to-nav* mode with dir auto-select + - *Type-to-nav* mode with automatic matching dir entry - Contexts (_aka_ tabs/workspaces) with custom colors - Sessions, bookmarks with hotkeys; mark and visit a dir - Remote mounts (needs `sshfs`, `rclone`) - Familiar shortcuts (arrows, ~, -, @), quick look-up - `cd` on quit (*easy* shell integration) - - Auto-advance on opening files + - Auto-proceed on file open and selection - Search - Instant filtering with *search-as-you-type* - Regex (POSIX/PCRE) and string (default) filters diff --git a/src/nnn.c b/src/nnn.c index 4243f2cc..6305dd98 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -334,7 +334,7 @@ typedef struct { uint_t prefersel : 1; /* Prefer selection over current, if exists */ uint_t fileinfo : 1; /* Show file information on hover */ uint_t nonavopen : 1; /* Open file on right arrow or `l` */ - uint_t autoselect : 1; /* Auto-select dir in type-to-nav mode */ + uint_t autoenter : 1; /* auto-enter dir in type-to-nav mode */ uint_t reserved2 : 1; uint_t useeditor : 1; /* Use VISUAL to open text files */ uint_t reserved3 : 3; @@ -414,7 +414,7 @@ static settings cfg = { 0, /* prefersel */ 0, /* fileinfo */ 0, /* nonavopen */ - 1, /* autoselect */ + 1, /* autoenter */ 0, /* reserved2 */ 0, /* useeditor */ 0, /* reserved3 */ @@ -3373,7 +3373,7 @@ static int filterentries(char *path, char *lastname) if (cfg.filtermode) { switch (*ch) { case '\'': // fallthrough /* Go to first non-dir file */ - case '+': // fallthrough /* Toggle auto-advance */ + case '+': // fallthrough /* Toggle auto-proceed on open */ case ',': // fallthrough /* Mark CWD */ case '-': // fallthrough /* Visit last visited dir */ case '.': // fallthrough /* Show hidden files */ @@ -3434,17 +3434,17 @@ static int filterentries(char *path, char *lastname) continue; } - /* If the only match is a dir, auto-select and cd into it */ + /* If the only match is a dir, auto-enter and cd into it */ if (ndents == 1 && cfg.filtermode - && cfg.autoselect && (pdents[0].flags & DIR_OR_DIRLNK)) { + && cfg.autoenter && (pdents[0].flags & DIR_OR_DIRLNK)) { *ch = KEY_ENTER; cur = 0; goto end; } /* - * redraw() should be above the auto-select optimization, for - * the case where there's an issue with dir auto-select, say, + * redraw() should be above the auto-enter optimization, for + * the case where there's an issue with dir auto-enter, say, * due to a permission problem. The transition is _jumpy_ in * case of such an error. However, we optimize for successful * cases where the dir has permissions. This skips a redraw(). @@ -5013,7 +5013,7 @@ static void show_help(const char *path) "9Lt h Parent%-12c~ ` @ - ~, /, start, prev\n" "5Ret Rt l Open%-20c' First file/match\n" "9g ^A Top%-21c. Toggle hidden\n" - "9G ^E End%-21c+ Toggle auto-advance\n" + "9G ^E End%-21c+ Toggle auto-proceed on open\n" "8B (,) Book(mark)%-11cb ^/ Select bookmark\n" "a1-4 Context%-11c(Sh)Tab Cycle/new context\n" "62Esc ^Q Quit%-20cq Quit context\n" @@ -8112,7 +8112,7 @@ static void usage(void) #ifndef NOFIFO " -a auto NNN_FIFO\n" #endif - " -A no dir auto-select\n" + " -A no dir auto-enter\n" " -b key open bookmark key (trumps -s/S)\n" " -c cli-only NNN_OPENER (trumps -e)\n" " -C 8-color scheme\n" @@ -8129,7 +8129,7 @@ static void usage(void) " -g regex filters\n" " -H show hidden files\n" " -i show current file info\n" - " -J no auto-proceed on select\n" + " -J no auto-proceed on selection\n" " -K detect key collision\n" " -l val set scroll lines\n" " -n type-to-nav mode\n" @@ -8319,7 +8319,7 @@ int main(int argc, char *argv[]) break; #endif case 'A': - cfg.autoselect = 0; + cfg.autoenter = 0; break; case 'b': if (env_opts_id < 0) From fe0608116ab1a602aee2827df63419d477cab1e0 Mon Sep 17 00:00:00 2001 From: Patrick Date: Thu, 23 Dec 2021 17:44:27 -0800 Subject: [PATCH 9/9] introduce new plugin for jumping git root --- plugins/README.md | 3 ++- plugins/gitroot | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100755 plugins/gitroot diff --git a/plugins/README.md b/plugins/README.md index 40427b3f..88449c37 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -29,7 +29,8 @@ Plugins extend the capabilities of `nnn`. They are _executable_ scripts (or bina | [fzopen](fzopen) | Fuzzy find file(s) in subtree to edit/open/pick | sh | fzf, xdg-open/open | | [fzplug](fzplug) | Fuzzy find, preview and run other plugins | sh | fzf | | [getplugs](getplugs) | Update plugins to installed `nnn` version | sh | curl | -| [gpg\*](gpg\*) | Encrypt/decrypt files using GPG [✓] | sh | gpg | +| [gitroot](gitroot) | Cd to the root of current git repo | sh | git | +| [gpge](gpge) | Encrypt/decrypt files using GPG [✓] | sh | gpg | | [gutenread](gutenread) | Browse, download, read from Project Gutenberg | sh | curl, unzip, w3m
[epr](https://github.com/wustho/epr) (optional) | | [imgresize](imgresize) | Batch resize images in dir to screen resolution | sh | [imgp](https://github.com/jarun/imgp) | | [imgur](imgur) | Upload an image to imgur (from [imgur-screenshot](https://github.com/jomo/imgur-screenshot)) | bash | - | diff --git a/plugins/gitroot b/plugins/gitroot new file mode 100755 index 00000000..4428d1e0 --- /dev/null +++ b/plugins/gitroot @@ -0,0 +1,15 @@ +#!/usr/bin/env sh + +# Description: cd to the top level of the current git repository in the current context +# Dependencies: git +# Shell: sh +# Author: https://github.com/PatrickF1 + +root="$(git rev-parse --show-toplevel 2>/dev/null)" +if [ -n "$root" ]; then + printf "%s" "0c$root" > "$NNN_PIPE" +else + printf "Not in a git repository" + read -r _ + exit 1 +fi