-g
-H
-K
+ -l
-n
-o
-p
if [[ $prev == -b ]]; then
local bookmarks=$(echo $NNN_BMS | awk -F: -v RS=\; '{print $1}')
COMPREPLY=( $(compgen -W "$bookmarks" -- "$cur") )
+ elif [[ $prev == -l ]]; then
+ return 1
elif [[ $prev == -p ]]; then
COMPREPLY=( $(compgen -f -d -- "$cur") )
elif [[ $prev == -s ]]; then
complete -c nnn -s g -d 'regex filters'
complete -c nnn -s H -d 'show hidden files'
complete -c nnn -s K -d 'detect key collision'
+complete -c nnn -s l -r -d 'lines to move per scroll'
complete -c nnn -s n -d 'start in type-to-nav mode'
complete -c nnn -s o -d 'open files only on Enter'
complete -c nnn -s p -r -d 'copy selection to file' -a '-\tstdout'
'(-g)-g[regex filters]'
'(-H)-H[show hidden files]'
'(-K)-K[detect key collision]'
+ '(-l)-l[lines to move per scroll]:val'
'(-n)-n[start in type-to-nav mode]'
'(-o)-o[open files only on Enter]'
'(-p)-p[copy selection to file]:file name'
static context g_ctx[CTX_MAX] __attribute__ ((aligned));
-static int ndents, cur, last, curscroll, last_curscroll, total_dents = ENTRY_INCR;
+static int ndents, cur, last, curscroll, last_curscroll, total_dents = ENTRY_INCR, scroll_lines = 1;
static int nselected;
#ifndef NOFIFO
static int fifofd = -1;
#if NCURSES_MOUSE_VERSION > 1
/* Scroll up */
if (event.bstate == BUTTON4_PRESSED && ndents && (cfg.rollover || cur)) {
- move_cursor((cur + ndents - 1) % ndents, 0);
+ move_cursor((cur + ndents - scroll_lines) % ndents, 0);
break;
}
/* Scroll down */
if (event.bstate == BUTTON5_PRESSED && ndents
&& (cfg.rollover || (cur != ndents - 1))) {
- move_cursor((cur + 1) % ndents, 0);
+ move_cursor((cur + scroll_lines) % ndents, 0);
break;
}
#endif
" -g regex filters [default: string]\n"
" -H show hidden files\n"
" -K detect key collision\n"
+ " -l val set scroll lines\n"
" -n type-to-nav mode\n"
" -o open files only on Enter\n"
" -p file selection file [stdout if '-']\n"
while ((opt = (env_opts_id > 0
? env_opts[--env_opts_id]
- : getopt(argc, argv, "Ab:cdeEfFgHKnop:QrRs:St:T:Vxh"))) != -1) {
+ : getopt(argc, argv, "Ab:cdeEfFgHKl:nop:QrRs:St:T:Vxh"))) != -1) {
switch (opt) {
case 'A':
cfg.autoselect = 0;
case 'K':
check_key_collision();
return EXIT_SUCCESS;
+ case 'l':
+ if (env_opts_id < 0)
+ scroll_lines = atoi(optarg);
+ break;
case 'n':
cfg.filtermode = 1;
break;