From: Anomalocaridid <29845794+Anomalocaridid@users.noreply.github.com>
Date: Sun, 17 Jul 2022 00:25:59 +0000 (+0000)
Subject: escape call to `nnn` so `nnn` can be used as an alias to `n`
X-Git-Tag: v4.6~13
X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=f2c7495f5079d99f9b702c768dd1ee179ec40d3e;p=nnn.git

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

diff --git a/misc/quitcd/quitcd.bash_zsh b/misc/quitcd/quitcd.bash_zsh
index 492767a1..2450b795 100644
--- a/misc/quitcd/quitcd.bash_zsh
+++ b/misc/quitcd/quitcd.bash_zsh
@@ -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"
diff --git a/misc/quitcd/quitcd.csh b/misc/quitcd/quitcd.csh
index 5102e5af..72bd357d 100644
--- a/misc/quitcd/quitcd.csh
+++ b/misc/quitcd/quitcd.csh
@@ -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"'
diff --git a/misc/quitcd/quitcd.elv b/misc/quitcd/quitcd.elv
index b6514cdd..95c47a6e 100644
--- a/misc/quitcd/quitcd.elv
+++ b/misc/quitcd/quitcd.elv
@@ -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) {
diff --git a/misc/quitcd/quitcd.fish b/misc/quitcd/quitcd.fish
index 9f85fffc..c9902080 100644
--- a/misc/quitcd/quitcd.fish
+++ b/misc/quitcd/quitcd.fish
@@ -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