From 9587b77efe4ed1cbbe9675262203ce91e3a6d479 Mon Sep 17 00:00:00 2001 From: dv-blk Date: Wed, 5 May 2021 04:14:16 +0000 Subject: [PATCH] Updated Troubleshooting (markdown) --- Troubleshooting.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Troubleshooting.md b/Troubleshooting.md index 88ec885..ab72864 100644 --- a/Troubleshooting.md +++ b/Troubleshooting.md @@ -10,6 +10,8 @@ Use the following command to set default applications for mimetypes when using ` ## 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: @@ -30,6 +32,41 @@ n () } ``` +#### New window/pane using cwd + +`nnn` does not change the process cwd while navigating. This may produce unexpected behaviour when using functions such as: + +`tmux new-window -c "#{pane_current_path}"` + +*See [author comment](https://github.com/jarun/nnn/issues/332#issuecomment-533937941) and issue #565 for more details.* + +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 example`tmux_split_curdir.sh`: + +```bash +#!/bin/bash +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: