escape call to `nnn` so `nnn` can be used as an alias to `n`

This commit is contained in:
Anomalocaridid 2022-07-17 00:25:59 +00:00 committed by Arun Prakash Jana
parent b0580905f2
commit f2c7495f50
No known key found for this signature in database
GPG Key ID: A75979F35C080412
4 changed files with 11 additions and 3 deletions

View File

@ -19,7 +19,9 @@ n ()
# stty lwrap undef
# stty lnext undef
nnn "$@"
# The backslash allows one to alias n to nnn if desired without making an
# infinitely recursive alias
\nnn "$@"
if [ -f "$NNN_TMPFILE" ]; then
. "$NNN_TMPFILE"

View File

@ -12,4 +12,6 @@ set NNN_TMPFILE=~/.config/nnn/.lastd
# stty lwrap undef
# stty lnext undef
alias n 'nnn; source "$NNN_TMPFILE"; rm -f "$NNN_TMPFILE"'
# The backslash allows one to alias n to nnn if desired without making an
# infinitely recursive alias
alias n '\nnn; source "$NNN_TMPFILE"; rm -f "$NNN_TMPFILE"'

View File

@ -30,6 +30,8 @@ fn n {|@a|
# stty lwrap undef
# stty lnext undef
# The e: prefix allows one to alias n to nnn if desired without making an
# infinitely recursive alias
e:nnn $@a
if (path:is-regular $E:NNN_TMPFILE) {

View File

@ -27,7 +27,9 @@ function n --wraps nnn --description 'support nnn quit and change directory'
# stty lwrap undef
# stty lnext undef
nnn $argv
# The command function allows one to alias this function to `nnn` without
# making an infinitely recursive alias
command nnn $argv
if test -e $NNN_TMPFILE
source $NNN_TMPFILE