Found the following snippet https://github.com/ConradIrwin/vim-bracketed-paste and thought it would be neat if I could modify it so it would,
- Detect when pasting,
- Update statusline with "pasting data"
- set paste
- "paste data"
- leave pastemode (by pastetoggle binded on [201~)
- Update statusline to whatever it was before pasting
This is what I've "kinda tried", but cant understand how I would get anything to "execute" on "[201~". Even though I used VIM for some while I still find this incredible difficult (I still don't fully understand the whole code snippet) and tips / pointers / solutions would be welcome.
let &t_ti .= "\<Esc>[?2004h"
let &t_te = "\e[?2004l" . &t_te
function! PasteStart(ret)
set statusline=pasting
set pastetoggle=<f29>
set paste
return a:ret
endfunction
function! PasteEnd()
set statusline=Done
return ""
endfunction
execute "set <f28>=\<Esc>[200~"
execute "set <f29>=\<Esc>[201~"
map <expr> <f28> PasteStart("i")
imap <expr> <f28> PasteStart("")
vmap <expr> <f28> PasteStart("c")
map <expr> <f29> PasteEnd()
imap <expr> <f29> PasteEnd()
vmap <expr> <f29> PasteEnd()
cmap <f28> <nop>
cmap <f29> <nop>
Thanks