On 2019-11-26 16:27, Anders Damsgaard wrote:
* Atanas Vladimirov <vl...@bsdbg.net> [2019-11-26 14:27:33 +0200]:

Hello,

The following works on Linux:

```
bind c new-window -c "#{pane_current_path}"

```

but the `pane_current_path` variable does not exists on OpenBSD.
Does anyone now how can I achieve the same behavior on OpenBSD?

Hi Atanas,

I recently asked Nicolas Marriott the same question on Freenode/#tmux. The
pane_current_path functionality is disabled on OpenBSD because of
security reasons.

For that reason I added the following function to my ~/.profile. However,
it does not enable splitting without sending current processes to
background:

tsplit() {
        if [ -z "$TMUX" ]; then
                echo "error: not in tmux session" >&2
                return 1
        fi
        if [ $# -gt 0 ]; then
                if [ "$1" = "v" ]; then
                        tmux split-pane -v -c "$PWD"
                elif [ "$1" = "h" ]; then
                        tmux split-pane -h -c "$PWD"
                elif [ "$1" = "w" ]; then
                        tmux new-window -c "$PWD"
                else
                        echo "error: split direction not understood" >&2
                        return 2
                fi
        else
                tmux split-pane -h -c $PWD
        fi
}

Best, Anders

Hi Anders,

Thanks for your reply.
So, if I understand your example right, I need to do something like `bind c new-window -c "$PWD"` in my .tmux.conf. The problem is that it works partially - if I'm in `/home/<myhome>/<some_directory>` and start tmux there, the $PWD is correct, but when I change the directory and create a new window with `C-b c` it moves me to the initial $PWD (when the tmux was started)
instead of the current directory.

Does anyone know how to make it work as I desire, or it's not possible?
Thanks in advance,
Atanas




Reply via email to