aboutsummaryrefslogtreecommitdiffstats
path: root/misc/quitcd
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-10-11 23:19:25 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-10-11 23:19:25 +0530
commitd1d491c102f5da1bf6a2c8c21fa71530e74f90d3 (patch)
tree191129298cc38228a3313f850656604722c84548 /misc/quitcd
parentc99a47d68898700160bec9f9ef3547cc39b49ecf (diff)
downloadnnn-d1d491c102f5da1bf6a2c8c21fa71530e74f90d3.tar.gz
Fix #350: cd on quit if NNN_TMPFILE is set
Diffstat (limited to 'misc/quitcd')
-rw-r--r--misc/quitcd/quitcd.bash2
-rw-r--r--misc/quitcd/quitcd.csh4
-rw-r--r--misc/quitcd/quitcd.fish2
-rw-r--r--misc/quitcd/quitcd.zsh2
4 files changed, 10 insertions, 0 deletions
diff --git a/misc/quitcd/quitcd.bash b/misc/quitcd/quitcd.bash
index e303b4c..a26395d 100644
--- a/misc/quitcd/quitcd.bash
+++ b/misc/quitcd/quitcd.bash
@@ -1,5 +1,7 @@
n()
{
+ # The default behaviour is to cd on quit (nnn checks if NNN_TMPFILE is set)
+ # To cd on quit only on ^G, export NNN_TMPFILE after the call to nnn
export NNN_TMPFILE=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd
nnn "$@"
diff --git a/misc/quitcd/quitcd.csh b/misc/quitcd/quitcd.csh
index 9ea952d..206e620 100644
--- a/misc/quitcd/quitcd.csh
+++ b/misc/quitcd/quitcd.csh
@@ -1,3 +1,7 @@
# NOTE: set NNN_TMPFILE correctly if you use 'XDG_CONFIG_HOME'
+
+# The default behaviour is to cd on quit (nnn checks if NNN_TMPFILE is set)
+# To cd on quit only on ^G, export NNN_TMPFILE after the call to nnn
set NNN_TMPFILE=~/.config/nnn/.lastd
+
alias n 'nnn; source "$NNN_TMPFILE"; rm "$NNN_TMPFILE"'
diff --git a/misc/quitcd/quitcd.fish b/misc/quitcd/quitcd.fish
index f2a54e8..4117cc5 100644
--- a/misc/quitcd/quitcd.fish
+++ b/misc/quitcd/quitcd.fish
@@ -3,6 +3,8 @@
# or, add the lines to the 'config.fish' file.
function n --description 'support nnn quit and change directory'
+ # The default behaviour is to cd on quit (nnn checks if NNN_TMPFILE is set)
+ # To cd on quit only on ^G, export NNN_TMPFILE after the call to nnn
if test -n "$XDG_CONFIG_HOME"
set -x NNN_TMPFILE "$XDG_CONFIG_HOME/nnn/.lastd"
else
diff --git a/misc/quitcd/quitcd.zsh b/misc/quitcd/quitcd.zsh
index c55b321..9259e4a 100644
--- a/misc/quitcd/quitcd.zsh
+++ b/misc/quitcd/quitcd.zsh
@@ -1,5 +1,7 @@
n()
{
+ # The default behaviour is to cd on quit (nnn checks if NNN_TMPFILE is set)
+ # To cd on quit only on ^G, export NNN_TMPFILE after the call to nnn
export NNN_TMPFILE=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd
nnn "$@"