How can I get shift-enter escape sequence to work in a nested tmux session?

44 Views Asked by At

I'm running a container on a macos host with iTerm inside of a tmux session on a linux OS.

On my macos, I have set up iTerm to send the Esc + [13;2u escape sequence so that shift-enter will work in the container where I have a neovim map that uses <S-CR>:

inoremap <silent><buffer> <S-CR> <Esc>:VimwikiReturn 4 3<CR>

So this all works when I do not have tmux open on the container.

The problem I'm having occurs when I have a tmux session open on the container (a nested session inside the outer session running on macos). The neovim map shown above gets ignored and nothing happens in neovim when I hit <S-CR> in the inner session. I tried a few different attempts to pass the escape sequence on to the inner tmux session with a bind command in the inner tmux.conf file but without success.

How can I get this to work?

1

There are 1 best solutions below

0
StevieD On

Placing the following lines in both the inner and outer tmux.conf files did the trick:

bind -n S-Enter send-keys "^[[13;2u"

Note that first ^[ character was created with ctrl-v and then [ and is not a literal ^[.