-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
I wanted y and friends to do their regular function but also OSC yank the same text.
It seemed to me that I should have been able to do it with the provided operator but I could concoct a solution that way so I came up with this:
function! MyOSCYankAndNormalYank(type, ...)
if a:0 " Invoked from Visual mode, use '< and '> marks.
silent exe "normal! `<" . a:type . "`>y"
elseif a:type == 'line'
silent exe "normal! '[V']y"
elseif a:type == 'block'
silent exe "normal! `[\<C-V>`]y"
else
silent exe "normal! `[v`]y"
endif
call OSCYank(getreg("+"))
endfunction
nmap <silent> y :set opfunc=MyOSCYankAndNormalYank<CR>g@
nmap <silent> yy y_
vmap <silent> y :<C-U>call MyOSCYankAndNormalYank(visualmode(), 1)<CR>
by looking at https://vimdoc.sourceforge.net/htmldoc/map.html#:map-operator and the readme of this plugin and some of its code. But I pretty much started with the thing from map-operator example from vimdoc and fiddled with it and got this.
Metadata
Metadata
Assignees
Labels
No labels