]> Sergey Matveev's repositories - nnn.git/commitdiff
escape call to `nnn` so `nnn` can be used as an alias to `n`
authorAnomalocaridid <29845794+Anomalocaridid@users.noreply.github.com>
Sun, 17 Jul 2022 00:25:59 +0000 (00:25 +0000)
committerArun Prakash Jana <engineerarun@gmail.com>
Mon, 18 Jul 2022 12:58:18 +0000 (18:28 +0530)
misc/quitcd/quitcd.bash_zsh
misc/quitcd/quitcd.csh
misc/quitcd/quitcd.elv
misc/quitcd/quitcd.fish

index 492767a1bde9efcf7aaa18db9830de74157a284f..2450b7956dd564d3b04ebcb047981d79fc63b912 100644 (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"
index 5102e5af738535729fe89a14eb97101d8c7c948a..72bd357d06735ead0074fabcbc9059cb95e41a11 100644 (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"'
index b6514cddb8a1a356fca2d5c79aa77406f4845e32..95c47a6ecad6ce0b4e39bdb6216d33afbaafdab8 100644 (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) {
index 9f85fffcf62231a82207a944e9cf640f01dd219b..c9902080bd4e0acd4b473f5e47cb83928664cc06 100644 (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