My build of nnn with minor changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

27 lines
766 B

  1. # Rename this file to match the name of the function
  2. # e.g. ~/.config/fish/functions/n.fish
  3. # or, add the lines to the 'config.fish' file.
  4. function n --description 'support nnn quit and change directory'
  5. # Block nesting of nnn in subshells
  6. if [ (expr $NNNLVL + 0) -ge 1 ]
  7. echo "nnn is already running"
  8. return
  9. end
  10. # The default behaviour is to cd on quit (nnn checks if NNN_TMPFILE is set)
  11. # To cd on quit only on ^G, export NNN_TMPFILE after the call to nnn
  12. if test -n "$XDG_CONFIG_HOME"
  13. set -x NNN_TMPFILE "$XDG_CONFIG_HOME/nnn/.lastd"
  14. else
  15. set -x NNN_TMPFILE "$HOME/.config/nnn/.lastd"
  16. end
  17. nnn $argv
  18. if test -e $NNN_TMPFILE
  19. source $NNN_TMPFILE
  20. rm $NNN_TMPFILE
  21. end
  22. end