Skip to content

Having trouble remapping <leader>c to gcc #2089

Closed Answered by refaelsh
refaelsh asked this question in Q&A
Discussion options

You must be logged in to vote

Issue solved. Like this:

{
  mode = "n";
  key = "<leader>c";
  action = "gcc";
  options.remap = true;
}

I found the answer here: https://www.reddit.com/r/neovim/comments/1d278fz/keymap_comment_nvim_010/.
In case the link stops working in the distant future, here is a quote:

If you are wondering why remap is necessary, it is because gcc is a mapping as well. So when remap is false, it will not recursively map to other mappings. You can see it and other defaults here https://github.com/neovim/neovim/blob/master/runtime/lua/vim/_defaults.lua#L135

Replies: 5 comments 12 replies

Comment options

You must be logged in to vote
5 replies
@refaelsh
Comment options

@MattSturgeon
Comment options

@refaelsh
Comment options

@MattSturgeon
Comment options

@refaelsh
Comment options

Comment options

You must be logged in to vote
1 reply
@MattSturgeon
Comment options

Comment options

You must be logged in to vote
4 replies
@refaelsh
Comment options

@traxys
Comment options

@refaelsh
Comment options

@refaelsh
Comment options

Comment options

You must be logged in to vote
2 replies
@khaneliman
Comment options

@refaelsh
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by refaelsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants