Nnn help - zoxide not found

autojump and NNN variables screenshot

Run this unset NNN_PIPE and then run nnn again.

From what I understand from the documentation, NNN_PIPE is supposed to be set by the autojump script, not manually.

I ran unset. Quit the terminal and restarted it ran nnn again

zoxide: no match found

It is not picking up yet …

No. You can’t quit after unset. unset is only temporary because the variable is set in your start up files.

Run unset NNN_PIPE and then run nnn right away in the same terminal. I just want to test whether that environment variable is causing the problem.

Ran nnn in the same terminal no change .
I think the issue is with zoxide. I tried running zoxide default command it is also showing no match found.

I don’t think zoxide’s binary is zoxide. Zoxide is meant to be ran as z.

First, run

pacman -Ql zoxide

I’m not sure why nnn keeps trying to find zoxide. It must have something to do with NNN_PIPE. Where did you set NNN_PIPE? Inside your .bashrc? Remove it from your .bashrc, restart your terminal and try again.

pacman -Ql zoxide

Screenshot

Removed NNN_PIPE from bashrc file. After restarting still the same … zoxide no match fouind !!! :expressionless:

Okay. That’s just a normal warning from zoxide apparently. Can you post the output of

alias

Can you run the zoxide init command on the command line instead and post the output?

Where should we create the script file autojump.sh? Maybe I made a mistake on the very first step

zoxide init screenshot

You don’t have to create the script. This script is automatically placed in the ~/.config/nnn/plugins directory when you install the autojump plugin.

From what I understand, the current situation is that nnn does use zoxide when it is launched, but zoxide keeps returning not found for some reason.

The nnn keybinding you assign to autojump will trigger the autojump script inside the plugins directory. If you have zoxide installed, the plugin should work without any extra configurations.

I made a typo. My bad.

zoxide init bash

~
❯ zoxide init bash

=============================================================================

Utility functions for zoxide.

pwd based on the value of _ZO_RESOLVE_SYMLINKS.

function __zoxide_pwd() {
\builtin pwd -L
}

cd + custom logic based on the value of _ZO_ECHO.

function __zoxide_cd() {
# shellcheck disable=SC2164
\builtin cd – “$@”
}

=============================================================================

Hook configuration for zoxide.

Hook to add new entries to the database.

__zoxide_oldpwd=“$(__zoxide_pwd)”

function __zoxide_hook() {
\builtin local -r retval=“$?”
\builtin local pwd_tmp
pwd_tmp=“$(__zoxide_pwd)”
if [[ ${__zoxide_oldpwd} != “${pwd_tmp}” ]]; then
__zoxide_oldpwd=“${pwd_tmp}”
\command zoxide add – “${__zoxide_oldpwd}”
fi
return “${retval}”
}

Initialize hook.

if [[ ${PROMPT_COMMAND:=} != ‘__zoxide_hook’ ]]; then
PROMPT_COMMAND=“__zoxide_hook;${PROMPT_COMMAND#;}”
fi

=============================================================================

When using zoxide with --no-cmd, alias these internal functions as desired.

__zoxide_z_prefix=‘z#’

Jump to a directory using only keywords.

function __zoxide_z() {
# shellcheck disable=SC2199
if [[ $# -eq 0 ]]; then
__zoxide_cd ~
elif [[ $# -eq 1 && $1 == ‘-’ ]]; then
__zoxide_cd “${OLDPWD}”
elif [[ $# -eq 1 && -d $1 ]]; then
__zoxide_cd “$1”
elif [[ ${@: -1} == “${__zoxide_z_prefix}”?* ]]; then
# shellcheck disable=SC2124
\builtin local result=“${@: -1}”
__zoxide_cd “${result:${#__zoxide_z_prefix}}”
else
\builtin local result
# shellcheck disable=SC2312
result=“$(\command zoxide query --exclude “$(__zoxide_pwd)” – “$@”)” &&
__zoxide_cd “${result}”
fi
}

Jump to a directory using interactive search.

function __zoxide_zi() {
\builtin local result
result=“$(\command zoxide query --interactive – “$@”)” && __zoxide_cd “${result}”
}

=============================================================================

Commands for zoxide. Disable these using --no-cmd.

\builtin unalias z &>/dev/null || \builtin true
function z() {
__zoxide_z “$@”
}

\builtin unalias zi &>/dev/null || \builtin true
function zi() {
__zoxide_zi “$@”
}

Load completions.

- Bash 4.4+ is required to use @Q.

- Completions require line editing. Since Bash supports only two modes of

line editing (vim and emacs), we check if either them is enabled.

- Completions don’t work on dumb terminals.

if [[ ${BASH_VERSINFO[0]:-0} -eq 4 && ${BASH_VERSINFO[1]:-0} -ge 4 || ${BASH_VERSINFO[0]:-0} -ge 5 ]] &&
[[ :“${SHELLOPTS}”: =~ :(vi|emacs): && ${TERM} != ‘dumb’ ]]; then
# Use printf '\e[5n' to redraw line after fzf closes.
\builtin bind ‘“\e[0n”: redraw-current-line’ &>/dev/null

function __zoxide_z_complete() {
    # Only show completions when the cursor is at the end of the line.
    [[ ${#COMP_WORDS[@]} -eq $((COMP_CWORD + 1)) ]] || return

    # If there is only one argument, use `cd` completions.
    if [[ ${#COMP_WORDS[@]} -eq 2 ]]; then
        \builtin mapfile -t COMPREPLY < <(
            \builtin compgen -A directory -- "${COMP_WORDS[-1]}" || \builtin true
        )
    # If there is a space after the last word, use interactive selection.
    elif [[ -z ${COMP_WORDS[-1]} ]] && [[ ${COMP_WORDS[-2]} != "${__zoxide_z_prefix}"?* ]]; then
        \builtin local result
        # shellcheck disable=SC2312
        result="$(\command zoxide query --exclude "$(__zoxide_pwd)" --interactive -- "${COMP_WORDS[@]:1:${#COMP_WORDS[@]}-2}")" &&
            COMPREPLY=("${__zoxide_z_prefix}${result}/")
        \builtin printf '\e[5n'
    fi
}

\builtin complete -F __zoxide_z_complete -o filenames -- z
\builtin complete -r zi &>/dev/null || \builtin true

fi

=============================================================================

To initialize zoxide, add this to your configuration (usually ~/.bashrc):

eval “$(zoxide init bash)”

~

:sweat_smile:

That’s abit difficult to read. Never mind.

Could something be wrong with the nnn executable?

What’s the output of which nnn

which nnn screenshot

Okay. Let’s isolate the problem. Remove the t:autojump from your NNN_PLUG environment variable first, then restart your terminal.

Does it still try to invoke zoxide when you run nnn after that?

Removed the env variable,restarted terminal,ran nnn . No it didnt invoke zoxide

So nnn starts normally when you don’t use autojump? Okay. That means you haven’t set up zoxide correctly.

Add back the other of keybindings for other plugins but without autojump. Does nnn still work?