macvim
macvim copied to clipboard
option (alt) not works in :terminal
Reproduce
:terminal
echo hello<CR>
<M-.>
not show 'hello'
but it works when macvim run in Terminal
Hmm what's the issue here? What shell are you using and what were you expecting?
Also, do you have set macmeta
? Does setting that help?
Finnally,I found a solution:
" I don't known why this line not work..., it seems a bug
"tnoremap <M-.> <C-w>:<C-u>call term_sendkeys(bufnr('%'), "\<Esc>.")<CR>
tnoremap <silent> <M-.> <C-w>:call <SID>tmap_meta('.')<CR>
function s:tmap_meta(key)
call term_sendkeys(bufnr('%'), "\<Esc>" . a:key)
endfunction
Oh I see, basically the shell you were using was expecting Meta-<key>
sequence to be encoding as <Esc>
+ <key>
, which is how most shells work, but in GVim (and MacVim under macmeta
) it uses 8-bit encoding (do :h xterm-8bit
) so it's not really compatible.
This ties to a larger ongoing issue about how Vim should be handling meta keys and would need some thought and collaboration with Vim to figure this out. I think for now you will need to keep your workaround.
Keeping this issue open for tracking.