Skip to content

Instantly share code, notes, and snippets.

@tjdevries
Created March 30, 2017 18:05
Show Gist options
  • Save tjdevries/3417fc03a2c6c6379f1fdde8d0b21c36 to your computer and use it in GitHub Desktop.
Save tjdevries/3417fc03a2c6c6379f1fdde8d0b21c36 to your computer and use it in GitHub Desktop.
Do some pasting things easily?
" Test text
" hello world
" some text
" here's more text
" 1
" 2
" 3
""
" location:
" if it's a number, it will go to that column and paste
" i.e. use line_paste(col('.'),'*') to paste what is in your * register
" in the same column
" if it's a string, it will perform that movement, and then paste
" i.e. use line_paste('$', '*') to paste what is in your * register at
" the end of line for each line
function! uneven_paste#line_paste(location, reg_name) abort
if type(a:location) == v:t_string
let l:movement = v:true
else
let l:movement = v:false
endif
for l:item in split(getreg(a:reg_name))
if l:movement
call execute('normal! ' . a:location)
else
call execute('normal! ' . a:location . '|')
endif
call execute('normal! a' . l:item)
call execute('normal! j')
endfor
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment