terrortylor / nvim-comment

A comment toggler for Neovim, written in Lua
MIT License
479 stars 23 forks source link

Custom mapping #9

Closed gegoune closed 3 years ago

gegoune commented 3 years ago

Hey again.

I have used tcomment for a long time and gotten used to <C-_><C-_> mapping. So I did set line_mapping to it

line_mapping = "<C-_><C-_>"

it works fine except for visual mode. tcomment did support that, I know there is operator_mapping but I would like to keep that set to default value.

Do you think I could somehow map <C-_><C-_> to toggle single line in normal mode and selection in visual mode too?

Thanks!

litoj commented 3 years ago

you can use `map("n", "<C-_>", ":CommentToggle<CR>", {noremap=true,silent=true})

terrortylor commented 3 years ago

Hey, yeah this works: nmap <C-_><C-_> :CommentToggle<CR>

Doesn't handle your other issue though. Been busy am still planning on getting to it!

litoj commented 3 years ago

Hey, yeah this works: nmap <C-_><C-_> :CommentToggle<CR>

Doesn't handle your other issue though. Been busy am still planning on getting to it!

For visual mode just use map instead of nmap (map is for n, v and o modes, nmap only for normal mode)