Program option to load session is now -s

- remove auto-stored session "@" on restore
- minor help update
This commit is contained in:
Arun Prakash Jana 2019-12-20 15:49:13 +05:30
parent 9725c17d20
commit 37988cf854
No known key found for this signature in database
GPG key ID: A75979F35C080412
5 changed files with 16 additions and 15 deletions

View file

@ -16,7 +16,6 @@ _nnn ()
-b
-c
-d
-e
-E
-g
-H
@ -28,6 +27,7 @@ _nnn ()
-Q
-r
-R
-s
-S
-t
-v
@ -39,7 +39,7 @@ _nnn ()
COMPREPLY=( $(compgen -W "$bookmarks" -- "$cur") )
elif [[ $prev == -p ]]; then
COMPREPLY=( $(compgen -f -d -- "$cur") )
elif [[ $prev == -e ]]; then
elif [[ $prev == -s ]]; then
local sessions_dir=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/sessions
COMPREPLY=( $(cd "$sessions_dir" && compgen -f -d -- "$cur") )
elif [[ $cur == -* ]]; then

View file

@ -15,7 +15,6 @@ complete -c nnn -s a -d 'use access time'
complete -c nnn -s b -r -d 'bookmark key to open' -x -a '(echo $NNN_BMS | awk -F: -v RS=\; \'{print $1"\t"$2}\')'
complete -c nnn -s c -d 'cli-only opener'
complete -c nnn -s d -d 'start in detail mode'
complete -c nnn -s e -r -d 'load session by name' -x -a '@\t"last session" (ls $sessions_dir)'
complete -c nnn -s E -d 'use EDITOR for undetached edits'
complete -c nnn -s g -d 'regex filters'
complete -c nnn -s H -d 'show hidden files'
@ -27,6 +26,7 @@ complete -c nnn -s p -r -d 'copy selection to file' -a '-\tstdout'
complete -c nnn -s Q -d 'disable quit confirmation'
complete -c nnn -s r -d 'show cp, mv progress (Linux-only)'
complete -c nnn -s R -d 'disable rollover at edges'
complete -c nnn -s s -r -d 'load session by name' -x -a '@\t"last session" (ls $sessions_dir)'
complete -c nnn -s S -d 'start in disk usage analyzer mode'
complete -c nnn -s t -d 'disable dir auto-select'
complete -c nnn -s v -d 'show program version and exit'

View file

@ -13,7 +13,6 @@ args=(
'(-b)-b[bookmark key to open]:key char'
'(-c)-c[cli-only opener]'
'(-d)-d[start in detail mode]'
'(-e)-e[load session]:session name'
'(-E)-E[use EDITOR for undetached edits]'
'(-g)-g[regex filters]'
'(-H)-H[show hidden files]'
@ -25,6 +24,7 @@ args=(
'(-Q)-Q[disable quit confirmation]'
'(-r)-r[show cp, mv progress (Linux-only)]'
'(-R)-R[disable rollover at edges]'
'(-s)-s[load session]:session name'
'(-S)-S[start in disk usage analyzer mode]'
'(-t)-t[disable dir auto-select]'
'(-v)-v[show program version and exit]'

8
nnn.1
View file

@ -10,7 +10,6 @@
.Op Ar -b key
.Op Ar -c
.Op Ar -d
.Op Ar -e name
.Op Ar -E
.Op Ar -g
.Op Ar -H
@ -21,6 +20,7 @@
.Op Ar -Q
.Op Ar -r
.Op Ar -R
.Op Ar -s name
.Op Ar -S
.Op Ar -v
.Op Ar -x
@ -56,9 +56,6 @@ supports the following options:
.Fl d
detail mode
.Pp
.Fl "e name"
load a session by name
.Pp
.Fl E
use $EDITOR for internal undetached edits
.Pp
@ -92,6 +89,9 @@ supports the following options:
.Fl R
disable rollover at edges
.Pp
.Fl "s name"
load a session by name
.Pp
.Fl S
start in disk usage analyzer mode
.Pp

View file

@ -2945,7 +2945,8 @@ END:
if (!status) {
printmsg(messages[MSG_FAILED]);
xdelay(XDELAY_INTERVAL_MS);
}
} else if (restore)
unlink(spath);
return status;
}
@ -3474,7 +3475,7 @@ static void show_help(const char *path)
"6(Sh)Tab Cycle context%-11cd Detail view toggle\n"
"c/ Filter%-13cIns ^N Nav-as-you-type toggle\n"
"aEsc Exit prompt%-9c^L F5 Redraw/clear prompt\n"
"c. Hidden toggle%-11c? Help, conf\n"
"c. Toggle hidden%-11c? Help, conf\n"
"9Q ^Q Quit%-20cq Quit context\n"
"b^G QuitCD%-1c\n"
"1FILES\n"
@ -5488,7 +5489,6 @@ static void usage(void)
" -b key open bookmark key\n"
" -c cli-only opener\n"
" -d detail mode\n"
" -e name load session by name\n"
" -E use EDITOR for undetached edits\n"
" -g regex filters [default: string]\n"
" -H show hidden files\n"
@ -5500,6 +5500,7 @@ static void usage(void)
" -Q no quit confirmation\n"
" -r use advcpmv patched cp, mv\n"
" -R no rollover at edges\n"
" -s name load session by name\n"
" -S du mode\n"
" -t no dir auto-select\n"
" -v show version\n"
@ -5646,7 +5647,7 @@ int main(int argc, char *argv[])
bool progress = FALSE;
#endif
while ((opt = getopt(argc, argv, "HSKiab:cde:Egnop:QrRtvxh")) != -1) {
while ((opt = getopt(argc, argv, "HSKiab:cdEgnop:QrRs:tvxh")) != -1) {
switch (opt) {
case 'S':
cfg.blkorder = 1;
@ -5668,9 +5669,6 @@ int main(int argc, char *argv[])
case 'c':
cfg.cliopener = 1;
break;
case 'e':
session = optarg;
break;
case 'E':
cfg.waitedit = 1;
break;
@ -5715,6 +5713,9 @@ int main(int argc, char *argv[])
case 'R':
cfg.rollover = 0;
break;
case 's':
session = optarg;
break;
case 't':
cfg.autoselect = 0;
break;