Skip to content

Troubleshooting

Piña Colada edited this page May 7, 2021 · 63 revisions

Wrong file opener

If your text files are opening in the browser, check out the program option -e.

Use the following command to set default applications for mimetypes when using xdg-open as opener:

xdg-mime default application mimetype(s)
e.g.
xdg-mime default sxiv.desktop image/jpeg image/png

Selection marks lost

This happens on leaving and re-entering or refreshing a directory. More details on selection.

Tmux configuration

Keyboard

nnn may not handle keypresses correctly when used with tmux (see issue #104 for more details). Set TERM=xterm-256color to address it.

By default tmux advertises 8-color support. To show icons in tmux add the following to tmux configuration file:

set -g default-terminal "screen-256color"

If the Esc key isn't working as expected, add the following in .tmux.conf:

set -g escape-time 0

To start nnn within tmux use a shell function:

n ()
{
    # use option -a for previews
    tmux new-session nnn -a $@
}

New window/pane using cwd

nnn does not set the terminal's cwd while navigating. So the following may not work:

tmux new-window -c "#{pane_current_path}"

One possible workaround is to extract the path from the cwd command that nnn uses:

lsof -c nnn | grep cwd

To get the path on the last executed cwd command:

lsof -w -c nnn | grep cwd | tail -n 1 | awk '{print $9}'

A script exampletmux_split_curdir.sh:

#!/usr/bin/env sh

cwd=
cc=$(tmux display -p '#{pane_current_command}')
if [ $cc == "nnn" ] ; then
   cwd=$(lsof -w -c nnn | grep cwd | tail -n 1 | awk '{print $9}')
else
   cwd=$(tmux display -p '#{pane_current_path}')
fi

tmux split-window -c "$cwd"

Adding this script to your tmux path allows it to be run with run-shell:

bind -n KEYS run-shell "tmux_split_curdir.sh"

Broken control key

If a Ctrl-key combination is not working, check if it's masked due to terminal line settings:

stty -a

If that's the case, clear (undef) the setting. E.g.:

stty start undef
stty stop undef
stty lwrap undef
stty lnext undef

You can do this when starting nnn. See the quitcd scripts.

Help not showing

If your PAGER is less, remove the option -F (automatically exit if the entire file can be displayed on the first screen). There are other screens which use less as well.

Note that the less command takes its default parameters from the $LESS environment variable, so you may need to remove -F from your shell initialization.

Default batch rename limits

TL;DR: If you need a full-featured batch-renamer, install plugins. nnn auto-detects and invokes the internal plugin .nmv (a bash script) which is feature-complete.

The in-built batch-renamer implemented in nnn is a very simplified one. It's single-pass - reads the name/path of files iteratively (from a list of source files) and renames/moves them (as specified in the corresponding line number in a list of renamed/destination files). It doesn't handle deletions or perform any pre-parsing to account for rename loops, swaps, replaces, etc.

Misaligned size column

We have seen this issue with WSL and Putty where sometimes repeated space characters are not printed correctly.

To fix this:

export TERM=rxvt-unicode
// OR
export TERM=rxvt-unicode-256color

Detailed explanation.

Can't list within list

List view is a temporary view of symlinks. To avoid remembering the temporary paths to all listed views the current path is removed when the next list is loaded. This is also inline with the fact that find doesn't look within symlinks to directories. If you need to search the entries within a loaded list, visit the original directory and run the refined search.

BSD terminal issue

TL;DR: On releases previous to v2.7, use the keybind K to toggle selection if you are having issues with ^Y.

On OpenBSD & FreeBSD (and probably on macOS as well) stty maps ^Y to DSUSP by default. This means that typing ^Y will suspend nnn as if you typed ^Z (you can bring nnn back to the foreground by issuing fg) instead of entering multi-selection mode. You can check this with stty -a. If it includes the text dsusp = ^Y, issuing stty dsusp undef will disable this DSUSP and let nnn receive the ^Y instead.

Amethyst WM

There's a known issue with Amethyst window manager on macOS - redraws do not work correctly and the screen breaks. See issue #521 for more details.

Clone this wiki locally