I have this command in my .vimrc:
vip:normal @g<CR>
When I set the register 'g' by typing in a buffer like this, it works:
qg<CR>jq
If I type: registers, it shows:
After that, entering @g causes the carriage to return, and then the cursor moves to the next line. ^ M appears in special color.
However, when I use the setreg command in my vimrc, if I type @g, nothing happens.
call setreg('g','^Mj')
If I type: registers, it shows:
^ M has no special color.
I have the following in my .vimrc:
map <CR> :call MyFunction<CR>
The carriage return that I want to keep in register is to run MyFunction. MyFunction is called fine as long as I fill the buffer manually, and not using setreg.
Where am I wrong? My platform is Linux.
source share