New answers tagged

1

OK, got it. Was using wrong sigil. Instead of "+ you need @+. So: inoremap <Leader>gg [<esc>:silent !~/bin/copy_safari_title.osa <cr>:let @+ = substitute(@+, '\|', '', 'g')<cr>"+pa](<esc>:silent !~/bin/copy_safari_url.osa <cr>"+pa)


3

You can append to the named registers "a through "z, in which case you use the lowercase versions of the registers to overwrite/replace their contents and the uppercase version to append to their contents. So you can use "a3yy (or 3"ayy) for the initial yank of 3 lines, then "A5yy (or 5"Ayy) to append the 5 next lines to that ...


2

If your Vim contains the patch 8.2.0924, then try to use getreginfo(): function Foo() let save_cb = &cb let regInfo = getreginfo('"') try norm! y{motion} do something finally let &cb = save_cb call setreg('"', regInfo) endtry endfunction The latter function returns a dictionary providing ...


0

If you have a line of text consisting of just :w, doing yy on that line will yank it into @" with the <Enter> character automatically. But with other control keys you would have to physically enter it on the line of text to be yanked. Also :set cpoptions+=> Ensures that whatever is copied/appended to a register is terminated by ONE newline, ...


2

You need to have the actual terminal code of <CR> in your yanked text instead of the literal characters <CR>. To input the terminal code in insert mode you need to use ctrl+v and then the key you want to input, here Enter. See :h i_CTRL-V So the text you will yank should look something like :w^M Once you yank it and use @" Vim will consider ^...


Top 50 recent answers are included