From 8fa9359927d54f4b50e11daa34c39ea53dcd272f Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Tue, 24 Jan 2023 20:56:05 +0000 Subject: add yank_join --- plugin/yank_join.vim | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 plugin/yank_join.vim (limited to 'plugin') diff --git a/plugin/yank_join.vim b/plugin/yank_join.vim new file mode 100644 index 0000000..36ff7b9 --- /dev/null +++ b/plugin/yank_join.vim @@ -0,0 +1,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 call JoinYank() -- cgit