macvim icon indicating copy to clipboard operation
macvim copied to clipboard

option (alt) not works in :terminal

Open epheien opened this issue 6 years ago • 4 comments

Reproduce

:terminal
echo hello<CR>
<M-.>

not show 'hello'

but it works when macvim run in Terminal

epheien avatar Feb 22 '19 05:02 epheien

Hmm what's the issue here? What shell are you using and what were you expecting?

ychin avatar Feb 22 '19 06:02 ychin

Also, do you have set macmeta? Does setting that help?

ychin avatar Feb 22 '19 06:02 ychin

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

epheien avatar Feb 22 '19 10:02 epheien

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.

ychin avatar Feb 22 '19 10:02 ychin