aboutsummaryrefslogtreecommitdiff
path: root/plugin/yank_join.vim
blob: 36ff7b9279e48f092dea72e85939bc161bdca53e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
" Remap 'Y' in visual mode to yank-and-join the lines. Useful when yanking
" something from the termial which is supposed to be a single line, but because
" of limitations in the termial, appear in serveral lines.

function! JoinYank()
  let reg = v:register
  exec printf('norm "%sy', reg)

  let new = substitute(getreg(reg), "\n", "", "g")
  call setreg(reg, new)
endfunction

vnoremap Y <cmd>call JoinYank()<cr>