Skip to content

Instantly share code, notes, and snippets.

@fmoralesc
Created June 21, 2014 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fmoralesc/d6ead20dba49ed06bd42 to your computer and use it in GitHub Desktop.
Save fmoralesc/d6ead20dba49ed06bd42 to your computer and use it in GitHub Desktop.
acme middle mouse double target prototyppe
noremap <MiddleMouse> <nop>
noremap <MiddleRelease> :call AcmeMiddle()<cr>
function! AcmeMiddle() range "{{{2
let star=getreg("*")
exe "normal \<leftmouse>"
let cw=expand("<cWORD>")
let s_f_line = split(star, "\n")[0]
let f_line = getline(a:firstline)
let s_f_byte = line2byte(a:firstline + stridx(f_line, s_f_line))
let s_l_byte = s_f_byte + len(star) - (a:lastline-a:firstline)
echo "*:".star.",cW:".cw.",pos:".s_f_byte.",".s_l_byte
endfunction
finish
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment