wincent/terminus

Handle bracketed past in normal and visual mode

thalesmello opened this issue · 3 comments

I was wondering if it would be possible to handle bracketed paste on normal mode.

Imagine the (assuming + register is linked to system clipboard):

  • In normal mode, Command + v would "+P
  • In visual mode, Command + v would "+p

That would make the Vim terminal behave exactly like other GUI editors.

Is something like this even possible?

This already works; see here.

For example, in normal mode, on Command-V, it does :set paste, enters insert mode, and allows the pasted text straight through (no "+P needed).

Strange. That does't happen on my computer.

Vim interprets the characters literally. Would you have any idea what
configuration could be missing?

Notice terminus pastes correctly (escaping the pasted text) when I'm in
insert mode.

Atenciosamente,
Thales Mello.

On Thu, Jul 21, 2016 at 4:42 PM, Greg Hurrell notifications@github.com
wrote:

This already works; see here

let s:paste=get(g:, 'TerminusBracketedPaste', 1)
if s:paste
" Make use of Xterm "bracketed paste mode". See:
" - http://www.xfree86.org/current/ctlseqs.html#Bracketed%20Paste%20Mode
" - http://stackoverflow.com/questions/5585129
if s:screenish || s:xterm
" Enable bracketed paste mode on entering Vim.
let &t_ti.="\e[?2004h"
" Disable bracketed paste mode on leaving Vim.
let &t_te="\e[?2004l" . &t_te
set pastetoggle=<Esc>[201~
inoremap <expr> <Esc>[200~ terminus#private#paste('')
nnoremap <expr> <Esc>[200~ terminus#private#paste('i')
vnoremap <expr> <Esc>[200~ terminus#private#paste('c')
cnoremap <Esc>[200~ <nop>
cnoremap <Esc>[201~ <nop>
endif
endif

.

For example, in normal mode, on Command-V, it does :set paste, enters
insert mode, and allows the pasted text straight through (no "+P needed).


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#16 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABEz4iIj9Fbdqydl3E7RjrDyVpMqT8j9ks5qX8uggaJpZM4JSDBo
.

Nevermind. I just found the reason it does not seem to be working: I'm using Neovim.

I noticed there is an issue open. I'll take a look into it.