Skip to content

Instantly share code, notes, and snippets.

@davidosomething
Created November 19, 2015 00:13
Show Gist options
  • Save davidosomething/e2d2b0bbcdfbdf0448f3 to your computer and use it in GitHub Desktop.
Save davidosomething/e2d2b0bbcdfbdf0448f3 to your computer and use it in GitHub Desktop.
PUM for easyclip yanks
scriptencoding UTF-8
" ============================================================================
" EasyClip ring
" Requires vim-easyclip installed
" Press <Leader>cr to get a pop-up menu to select a yank
" ============================================================================
function! YanksToArray()
let yanks_array = []
for yank in EasyClip#Yank#EasyClipGetAllYanks()
let line = yank.text
let line = substitute(line, '\V\n', '^M', 'g')
if len(line) > 40
let line = line[: 40] . '…'
endif
call add(yanks_array, line)
endfor
return yanks_array
endfunction
function! EasyClipYankPum()
call complete(col('.'), YanksToArray())
return ''
endfunc
" key binding
inoremap <Leader>cr <C-R>=EasyClipYankPum()<CR>
@davidosomething
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment