Saturday, July 8, 2023

Re: Win32 Vim inside MSYS Tmux doesn't interpret C-h

On Sat, 8 Jul 2023 18:57:01 +0200
Christian Brabandt <cblists@256bit.org> wrote:
> On Sa, 08 Jul 2023, Enan Ajmain wrote:
>
> > This is an edgecase. I am using win32 version of Vim (built with gcc of
> > mingw-w64) inside Tmux provided by msys. In it C-h isn't interpreted as
> > it is done outside Tmux. I have this keymap:
> >
> > nnoremap <C-h> <C-w>h
> >
> > And it doesn't take effect in win32-vim in tmux.
>
> Have you tried explicitly typing <C-h>?
>
> > I also have an unix version of vim, built with gcc from msys. By "unix
> > version," I mean it runs on msys shell with its unix layer. This
> > version of vim, unix-vim, interprets <C-h> inside tmux properly. Vim
> > inside Tmux on native Linux also interprets <C-h> properly.
> >
> > Although few if anyone use win32 Vim inside Tmux, so this issue is not
> > really an issue, but I am curious as to what's going on, if anyone here
> > can shed some light.
>
> Well, it may be, that Vim just receives <C-?> instead of <C-h>. Vim even
> has its own method of fixing this by using the :fixdel command. Nowadays
> one usually uses stty erase ^? or similar to configure the backspace
> thing (or one configures the terminal directly what it should send for
> backspace).
>
> Long are the times gone, when I needed to fiddle with that ;)

I never had to fiddle. It just worked for me in Ubuntu from when I
first started with vim7.2. What ":h :fixdel" tells me to do does not
work in win32-vim inside tmux. It says if "the code for BS is alright,"
by which I understood, "if BS is working correctly," then using
":fixdel" is all I need to do, but that didn't fix it, so obviously "the
code for BS is alright" means "t_kb" needs to be something sane, which
in this case is not true (see below). So I tried this:

set t_kb=^VÎx " I pressed <C-v>, not caret and V
fixdel

But this only cause BS key in insert mode to insert "Îx" instead of
deleting the previous character; didn't impact <C-h> at all.

I also tried "set t_kD=^V<Del>" with and without the "t_kb" plus fixdel
duo above, which only caused Del key to delete the whole line instead of
the character under cursor (which works properly without setting "t_kD")

All this to say, :fixdel isn't fixing <C-h> win32-vim inside tmux.
Either that or I am missing something.

> So I would first try inside vim, what is actually printed when typing in
> insert mode <C-V><Backspace> and from there we can continue.

unix-vim inside and outside tmux (works properly):

C-v BS: ^?
C-v C-h: ^H

win32-vim outside tmux (works properly):

C-v BS: Îx
C-v C-h: ^H

win32-vim inside tmux (<C-h> doesn't work):

C-v BS: Îx
C-v C-h: <C-BS>

Above, "^x" characters are non-printable C-x characters, but "<C-x>" are
plain printable text.

--
Enan

P.S. BS and Del keys works fine in win32-vim inside tmux.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20230708234650.00004ec0%40gmail.com.

No comments:

Post a Comment