tpope / vim-commentary

commentary.vim: comment stuff out
http://www.vim.org/scripts/script.php?script_id=3695
5.9k stars 214 forks source link

How to remapping this #161

Closed Ryangithub10 closed 2 years ago

Ryangithub10 commented 2 years ago

I was use this and i want remmap the key! I don't want to type gcc, i want to press <ctrl> / like other teks editor like vs code. But i don't know how to remmap operator key. I hope you understand what i am saying beacuse my english still suck 😅

k1ng440 commented 2 years ago

lua example: vim.keymap.set("v", "<C-/>", "<Plug>Commentary", { noremap = true })

vim config

  xmap <C-/>  <Plug>Commentary
  nmap <C-/> <Plug>Commentary
  omap <C-/> <Plug>Commentary
  nmap <C-/>c <Plug>CommentaryLine
  nmap <C-/>u <Plug>Commentary<Plug>Commentary

Edit: map <C-/> to <Plug>CommentaryLine