aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2023-01-24 20:56:05 +0000
committerJosh Rahm <rahm@google.com>2023-01-24 20:56:05 +0000
commit8fa9359927d54f4b50e11daa34c39ea53dcd272f (patch)
tree59dff0ef7b92e62de673f87bfc3df5b12693cd83
parente38c4942f1b92ba374f5b7d165642f16f070ce27 (diff)
downloadfieldmarshal.vim-8fa9359927d54f4b50e11daa34c39ea53dcd272f.tar.gz
fieldmarshal.vim-8fa9359927d54f4b50e11daa34c39ea53dcd272f.tar.bz2
fieldmarshal.vim-8fa9359927d54f4b50e11daa34c39ea53dcd272f.zip
add yank_join
-rw-r--r--plugin/yank_join.vim13
1 files changed, 13 insertions, 0 deletions
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 <cmd>call JoinYank()<cr>