map TComment_gcc get `E354: Invalid register name: '$'`
ruinb0w opened this issue · comments
ruinb0w commented
I maped tcomment like below
vim.keymap.set('n', "<leader>c", '<plug>TComment_gcc')
vim.keymap.set('v', "<leader>c", '<plug>TComment_gc')
The second line works great, but the first one throws the error E354: Invalid register name: '$'
Tom Link commented
Which version of vim do you use? I still use vim 8.2.
<Plug>TComment_gcc should be something like
nnoremap <Plug>TComment_gcc :<c-u>call tcomment#ResetOption() \| if
v:count > 0 \| call tcomment#SetOption("count", v:count) \| endif \| let
w:tcommentPos = getpos(".") \| set opfunc=TCommentOpFunc_gcc<cr>g@$
Does this work when defined manually? (You might want to check if the
TCommentOpFunc_gcc function exists since I'm not 100% sure.)
ruinb0w commented
Tom Link commented
I don't know nvim so I cannot really help you with that.
Do you really have to escape the pipe character when using the
vim.keymap.set() function? I could imagine just the bar "|" with not
backslash should work. The backslash is there as a work-around for vim's
:map command.