Termux-packages: Enable clipboard usage in vim?

Created on 4 Apr 2018  ·  4Comments  ·  Source: termux/termux-packages

I understand clipboard usage works with the neovim package, cf: https://github.com/termux/termux-packages/issues/1828

Would it be possible to get this behaviour working in the vim package too?

Most helpful comment

On my chromebook, ctrl+alt+v can paste into vim edit mode

All 4 comments

On my chromebook, ctrl+alt+v can paste into vim edit mode

nmap y :r!termux-clipboard-set
vmap y y:r!termux-clipboard-set ''"''
Some characters are not displayed!
Copy can be solved this way but not perfect. There is a length character limit. Is there any other way?

The following works (copy, cut, and paste).

au TextYankPost * call system('termux-clipboard-set &', @")
function Paste(p)
    let sysclip=system('termux-clipboard-get')
    if sysclip != @"
        let @"=sysclip
    endif
    return a:p
endfunction
noremap <expr> p Paste('p')
noremap <expr> P Paste('P')

This solution is perfect, thank you!

The following works (copy, cut, and paste).

au TextYankPost * call system('termux-clipboard-set &', @")
function Paste(p)
    let sysclip=system('termux-clipboard-get')
    if sysclip != @"
        let @"=sysclip
    endif
    return a:p
endfunction
noremap <expr> p Paste('p')
noremap <expr> P Paste('P')
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  ·  56Comments

stuart-little picture stuart-little  ·  73Comments

ghost picture ghost  ·  73Comments

ghost picture ghost  ·  70Comments

urrut picture urrut  ·  51Comments