mirror of
https://github.com/jarun/nnn.git
synced 2024-12-01 02:49:44 +00:00
eaffd311d4
This set the correct path to the temp nnn file when XDG_CONFIG_HOME is set. It fixes https://github.com/jarun/nnn/discussions/1605
19 lines
572 B
Plaintext
19 lines
572 B
Plaintext
# The behaviour is set to cd on quit (nnn checks if NNN_TMPFILE is set)
|
|
let cfgHome = ($env | default $"($env.HOME)/.config" XDG_CONFIG_HOME | get XDG_CONFIG_HOME)
|
|
let-env NNN_TMPFILE = $"($cfgHome)/nnn/.lastd"
|
|
|
|
def-env n [...x] {
|
|
# Launch nnn. Add desired flags after `^nnn`, ex: `^nnn -eda ($x | str join)`
|
|
^nnn ($x | str join)
|
|
let newpath = (
|
|
if ($env.NNN_TMPFILE | path exists) {
|
|
let newpath = (open $env.NNN_TMPFILE | parse 'cd "{nnnpath}"').0.nnnpath
|
|
^rm -f $env.NNN_TMPFILE
|
|
echo $newpath
|
|
} else {
|
|
pwd
|
|
}
|
|
)
|
|
cd $newpath
|
|
}
|