Re: Alt keys not sent to Vim :terminal

Enan Ajmain <[email protected]>
Newsgroups gmane.editors.vim
Message-ID <[email protected]>
On Wed, 20 Nov 2024 14:05:11 -0500
Enan Ajmain <[email protected]> wrote:
> Hi,
> 
> I'm in Windows. In Linux, I always use Tmux for my terminal use cases.
> But since Tmux doesn't exist in Windows, I wanted to use the embedded
> terminal in Vim.  It works great. Except --
> 
> The alt keys are sending accent letters. For example, I am using Clink,
> which adds GNU readline-like features to Command Prompt. So I can use
> Alt-f and Alt-b to move cursor one word forward and backward. It works
> in external terminal emulator.  But it doesn't work in Vim's embedded
> terminal.
> 
>   C:> this is a word æâ  
> 
> Above you can see the accented characters æ and â where I pressed Alt-b
> and Alt-f respectively. This issue exists in both TUI Vim and GVim.
> 
> How can I fix this issue?
> 
> Note that I checked with pressing <Ctrl-v><Alt-f> in insert mode in a
> non-terminal buffer and it indeed put æ. So I'm thinking if I can send
> some other code corresponding to Alt-f, it will work, but I'm not sure.
> 
> --
> Enan
> 
> P.S. Ctrl keys work fine. Ctrl-a/e moves the cursor to the start/end of
> the line.

As usual, I got the solution right after I asked for help. I needed to
send Esc for Alt keys:


  for i in range(65,90) + range(97,122)
    let c = nr2char(i)
    exec "tnoremap <A-".c."> <Esc>".c
    exec "tnoremap <A-C-".c."> <Esc><C-".c.">"
  endfor

--
Enan

-- 
-- 
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 [email protected].
To view this discussion visit https://groups.google.com/d/msgid/vim_use/20241120155715.0000781d%40gmail.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.