Numpad characters don't work in keybindings mappings (but work in general)












1














For my terminal Vim 8.0, I have downloaded this plugin that makes changing font size on the fly easy:
https://github.com/drmikehenry/vim-fontsize



Following the instructions, here is how I decided to define my mappings for changing fonts:



nmap <silent> <C>+ <Plug>FontsizeInc
nmap <silent> <C-kPlus> <Plug>FontsizeDec
nmap <silent> <C>- <Plug>FontsizeDec
nmap <silent> <C-kMinus> <Plug>FontsizeDec
nmap <silent> <C>0 <Plug>FontsizeDefault


However, to my surprise, the functionalities are only working for the + and - characters that are not in the NumPad are of my keyboard. When I hit the combinations using + or - form the NumPad, nothing happens. And otherwise, my Vim recognizes the NumPad just normally.



How could I perhaps solve this issue?










share|improve this question









New contributor




Jorget Millani is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Those mappings dont look quite right to my eye
    – D. Ben Knoble
    5 hours ago










  • Also the title of your question has nothing to do with it’s body?
    – D. Ben Knoble
    5 hours ago










  • @D.BenKnoble Ooops, my bad, I mistakenly copied and pasted the title from wrong place. Fixed it now. About the mappings, what does not look right? It works perfectly for <C>+, <C>- and <C>0, just not <C-kPlus> and <C-kMinus>
    – Jorget Millani
    5 hours ago










  • The typical syntax is map <LHS> <RHS>, but in your question i see 3 “sides” after the map commands
    – D. Ben Knoble
    5 hours ago










  • @D.BenKnoble Changed that, no effect
    – Jorget Millani
    4 hours ago
















1














For my terminal Vim 8.0, I have downloaded this plugin that makes changing font size on the fly easy:
https://github.com/drmikehenry/vim-fontsize



Following the instructions, here is how I decided to define my mappings for changing fonts:



nmap <silent> <C>+ <Plug>FontsizeInc
nmap <silent> <C-kPlus> <Plug>FontsizeDec
nmap <silent> <C>- <Plug>FontsizeDec
nmap <silent> <C-kMinus> <Plug>FontsizeDec
nmap <silent> <C>0 <Plug>FontsizeDefault


However, to my surprise, the functionalities are only working for the + and - characters that are not in the NumPad are of my keyboard. When I hit the combinations using + or - form the NumPad, nothing happens. And otherwise, my Vim recognizes the NumPad just normally.



How could I perhaps solve this issue?










share|improve this question









New contributor




Jorget Millani is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Those mappings dont look quite right to my eye
    – D. Ben Knoble
    5 hours ago










  • Also the title of your question has nothing to do with it’s body?
    – D. Ben Knoble
    5 hours ago










  • @D.BenKnoble Ooops, my bad, I mistakenly copied and pasted the title from wrong place. Fixed it now. About the mappings, what does not look right? It works perfectly for <C>+, <C>- and <C>0, just not <C-kPlus> and <C-kMinus>
    – Jorget Millani
    5 hours ago










  • The typical syntax is map <LHS> <RHS>, but in your question i see 3 “sides” after the map commands
    – D. Ben Knoble
    5 hours ago










  • @D.BenKnoble Changed that, no effect
    – Jorget Millani
    4 hours ago














1












1








1







For my terminal Vim 8.0, I have downloaded this plugin that makes changing font size on the fly easy:
https://github.com/drmikehenry/vim-fontsize



Following the instructions, here is how I decided to define my mappings for changing fonts:



nmap <silent> <C>+ <Plug>FontsizeInc
nmap <silent> <C-kPlus> <Plug>FontsizeDec
nmap <silent> <C>- <Plug>FontsizeDec
nmap <silent> <C-kMinus> <Plug>FontsizeDec
nmap <silent> <C>0 <Plug>FontsizeDefault


However, to my surprise, the functionalities are only working for the + and - characters that are not in the NumPad are of my keyboard. When I hit the combinations using + or - form the NumPad, nothing happens. And otherwise, my Vim recognizes the NumPad just normally.



How could I perhaps solve this issue?










share|improve this question









New contributor




Jorget Millani is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











For my terminal Vim 8.0, I have downloaded this plugin that makes changing font size on the fly easy:
https://github.com/drmikehenry/vim-fontsize



Following the instructions, here is how I decided to define my mappings for changing fonts:



nmap <silent> <C>+ <Plug>FontsizeInc
nmap <silent> <C-kPlus> <Plug>FontsizeDec
nmap <silent> <C>- <Plug>FontsizeDec
nmap <silent> <C-kMinus> <Plug>FontsizeDec
nmap <silent> <C>0 <Plug>FontsizeDefault


However, to my surprise, the functionalities are only working for the + and - characters that are not in the NumPad are of my keyboard. When I hit the combinations using + or - form the NumPad, nothing happens. And otherwise, my Vim recognizes the NumPad just normally.



How could I perhaps solve this issue?







key-bindings keymap keyboard-layout map-operator






share|improve this question









New contributor




Jorget Millani is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Jorget Millani is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 4 hours ago





















New contributor




Jorget Millani is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 5 hours ago









Jorget Millani

62




62




New contributor




Jorget Millani is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Jorget Millani is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Jorget Millani is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Those mappings dont look quite right to my eye
    – D. Ben Knoble
    5 hours ago










  • Also the title of your question has nothing to do with it’s body?
    – D. Ben Knoble
    5 hours ago










  • @D.BenKnoble Ooops, my bad, I mistakenly copied and pasted the title from wrong place. Fixed it now. About the mappings, what does not look right? It works perfectly for <C>+, <C>- and <C>0, just not <C-kPlus> and <C-kMinus>
    – Jorget Millani
    5 hours ago










  • The typical syntax is map <LHS> <RHS>, but in your question i see 3 “sides” after the map commands
    – D. Ben Knoble
    5 hours ago










  • @D.BenKnoble Changed that, no effect
    – Jorget Millani
    4 hours ago


















  • Those mappings dont look quite right to my eye
    – D. Ben Knoble
    5 hours ago










  • Also the title of your question has nothing to do with it’s body?
    – D. Ben Knoble
    5 hours ago










  • @D.BenKnoble Ooops, my bad, I mistakenly copied and pasted the title from wrong place. Fixed it now. About the mappings, what does not look right? It works perfectly for <C>+, <C>- and <C>0, just not <C-kPlus> and <C-kMinus>
    – Jorget Millani
    5 hours ago










  • The typical syntax is map <LHS> <RHS>, but in your question i see 3 “sides” after the map commands
    – D. Ben Knoble
    5 hours ago










  • @D.BenKnoble Changed that, no effect
    – Jorget Millani
    4 hours ago
















Those mappings dont look quite right to my eye
– D. Ben Knoble
5 hours ago




Those mappings dont look quite right to my eye
– D. Ben Knoble
5 hours ago












Also the title of your question has nothing to do with it’s body?
– D. Ben Knoble
5 hours ago




Also the title of your question has nothing to do with it’s body?
– D. Ben Knoble
5 hours ago












@D.BenKnoble Ooops, my bad, I mistakenly copied and pasted the title from wrong place. Fixed it now. About the mappings, what does not look right? It works perfectly for <C>+, <C>- and <C>0, just not <C-kPlus> and <C-kMinus>
– Jorget Millani
5 hours ago




@D.BenKnoble Ooops, my bad, I mistakenly copied and pasted the title from wrong place. Fixed it now. About the mappings, what does not look right? It works perfectly for <C>+, <C>- and <C>0, just not <C-kPlus> and <C-kMinus>
– Jorget Millani
5 hours ago












The typical syntax is map <LHS> <RHS>, but in your question i see 3 “sides” after the map commands
– D. Ben Knoble
5 hours ago




The typical syntax is map <LHS> <RHS>, but in your question i see 3 “sides” after the map commands
– D. Ben Knoble
5 hours ago












@D.BenKnoble Changed that, no effect
– Jorget Millani
4 hours ago




@D.BenKnoble Changed that, no effect
– Jorget Millani
4 hours ago










1 Answer
1






active

oldest

votes


















2














If I understand your question right, you are working in a terminal. Vim can't change the font size in a terminal. What you see, when pressing Ctrl-+ and Ctrl-- is a functionality of the terminal.



Try it without starting vim.



The plugin you downloaded just changes the guifont.



For this I have the following in my gvimrc:



command! -bar -nargs=0 BiggerFont  :let &guifont = substitute(&guifont,'d+$','=submatch(0)+1','')
command! -bar -nargs=0 SmallerFont :let &guifont = substitute(&guifont,'d+$','=submatch(0)-1','')
nnoremap <M--> :SmallerFont<CR>
nnoremap <M-+> :BiggerFont<CR>


Stolen from tpope.



BTW: The {lhs} of the mappings <C>+, <C>- and <C>0 all map a sequence of 4 characters.



BTW-2: I'm not sure that Ctrl-+ and Ctrl-- is mappable at all. If I go into insert mode in gVim and enter Ctrl-V + Ctrl-+ I just get a single +. If I use Ctrl-V + Ctrl-L I get ^L.






share|improve this answer























  • Thanks, I corrected the mappings, getting rid of that part. Still, the same thing: it does work with <C>+ and <C>-, so it can change the fonts - I don't think it is only the terminal, because if I comment those lines out the re-sizing of the font stops working. It just does not work with the numpad keys
    – Jorget Millani
    4 hours ago








  • 1




    I'm pretty sure your terminal does that, not Vim. My GNOME-Terminal has this. It changes the font size with <C-+> and <C--> even without Vim.
    – Ralf
    4 hours ago










  • You are using Vim in a terminal, not gVim? Which OS?, Which terminal emulator?
    – Ralf
    4 hours ago











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "599"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






Jorget Millani is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fvi.stackexchange.com%2fquestions%2f18474%2fnumpad-characters-dont-work-in-keybindings-mappings-but-work-in-general%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














If I understand your question right, you are working in a terminal. Vim can't change the font size in a terminal. What you see, when pressing Ctrl-+ and Ctrl-- is a functionality of the terminal.



Try it without starting vim.



The plugin you downloaded just changes the guifont.



For this I have the following in my gvimrc:



command! -bar -nargs=0 BiggerFont  :let &guifont = substitute(&guifont,'d+$','=submatch(0)+1','')
command! -bar -nargs=0 SmallerFont :let &guifont = substitute(&guifont,'d+$','=submatch(0)-1','')
nnoremap <M--> :SmallerFont<CR>
nnoremap <M-+> :BiggerFont<CR>


Stolen from tpope.



BTW: The {lhs} of the mappings <C>+, <C>- and <C>0 all map a sequence of 4 characters.



BTW-2: I'm not sure that Ctrl-+ and Ctrl-- is mappable at all. If I go into insert mode in gVim and enter Ctrl-V + Ctrl-+ I just get a single +. If I use Ctrl-V + Ctrl-L I get ^L.






share|improve this answer























  • Thanks, I corrected the mappings, getting rid of that part. Still, the same thing: it does work with <C>+ and <C>-, so it can change the fonts - I don't think it is only the terminal, because if I comment those lines out the re-sizing of the font stops working. It just does not work with the numpad keys
    – Jorget Millani
    4 hours ago








  • 1




    I'm pretty sure your terminal does that, not Vim. My GNOME-Terminal has this. It changes the font size with <C-+> and <C--> even without Vim.
    – Ralf
    4 hours ago










  • You are using Vim in a terminal, not gVim? Which OS?, Which terminal emulator?
    – Ralf
    4 hours ago
















2














If I understand your question right, you are working in a terminal. Vim can't change the font size in a terminal. What you see, when pressing Ctrl-+ and Ctrl-- is a functionality of the terminal.



Try it without starting vim.



The plugin you downloaded just changes the guifont.



For this I have the following in my gvimrc:



command! -bar -nargs=0 BiggerFont  :let &guifont = substitute(&guifont,'d+$','=submatch(0)+1','')
command! -bar -nargs=0 SmallerFont :let &guifont = substitute(&guifont,'d+$','=submatch(0)-1','')
nnoremap <M--> :SmallerFont<CR>
nnoremap <M-+> :BiggerFont<CR>


Stolen from tpope.



BTW: The {lhs} of the mappings <C>+, <C>- and <C>0 all map a sequence of 4 characters.



BTW-2: I'm not sure that Ctrl-+ and Ctrl-- is mappable at all. If I go into insert mode in gVim and enter Ctrl-V + Ctrl-+ I just get a single +. If I use Ctrl-V + Ctrl-L I get ^L.






share|improve this answer























  • Thanks, I corrected the mappings, getting rid of that part. Still, the same thing: it does work with <C>+ and <C>-, so it can change the fonts - I don't think it is only the terminal, because if I comment those lines out the re-sizing of the font stops working. It just does not work with the numpad keys
    – Jorget Millani
    4 hours ago








  • 1




    I'm pretty sure your terminal does that, not Vim. My GNOME-Terminal has this. It changes the font size with <C-+> and <C--> even without Vim.
    – Ralf
    4 hours ago










  • You are using Vim in a terminal, not gVim? Which OS?, Which terminal emulator?
    – Ralf
    4 hours ago














2












2








2






If I understand your question right, you are working in a terminal. Vim can't change the font size in a terminal. What you see, when pressing Ctrl-+ and Ctrl-- is a functionality of the terminal.



Try it without starting vim.



The plugin you downloaded just changes the guifont.



For this I have the following in my gvimrc:



command! -bar -nargs=0 BiggerFont  :let &guifont = substitute(&guifont,'d+$','=submatch(0)+1','')
command! -bar -nargs=0 SmallerFont :let &guifont = substitute(&guifont,'d+$','=submatch(0)-1','')
nnoremap <M--> :SmallerFont<CR>
nnoremap <M-+> :BiggerFont<CR>


Stolen from tpope.



BTW: The {lhs} of the mappings <C>+, <C>- and <C>0 all map a sequence of 4 characters.



BTW-2: I'm not sure that Ctrl-+ and Ctrl-- is mappable at all. If I go into insert mode in gVim and enter Ctrl-V + Ctrl-+ I just get a single +. If I use Ctrl-V + Ctrl-L I get ^L.






share|improve this answer














If I understand your question right, you are working in a terminal. Vim can't change the font size in a terminal. What you see, when pressing Ctrl-+ and Ctrl-- is a functionality of the terminal.



Try it without starting vim.



The plugin you downloaded just changes the guifont.



For this I have the following in my gvimrc:



command! -bar -nargs=0 BiggerFont  :let &guifont = substitute(&guifont,'d+$','=submatch(0)+1','')
command! -bar -nargs=0 SmallerFont :let &guifont = substitute(&guifont,'d+$','=submatch(0)-1','')
nnoremap <M--> :SmallerFont<CR>
nnoremap <M-+> :BiggerFont<CR>


Stolen from tpope.



BTW: The {lhs} of the mappings <C>+, <C>- and <C>0 all map a sequence of 4 characters.



BTW-2: I'm not sure that Ctrl-+ and Ctrl-- is mappable at all. If I go into insert mode in gVim and enter Ctrl-V + Ctrl-+ I just get a single +. If I use Ctrl-V + Ctrl-L I get ^L.







share|improve this answer














share|improve this answer



share|improve this answer








edited 3 hours ago

























answered 4 hours ago









Ralf

69510




69510












  • Thanks, I corrected the mappings, getting rid of that part. Still, the same thing: it does work with <C>+ and <C>-, so it can change the fonts - I don't think it is only the terminal, because if I comment those lines out the re-sizing of the font stops working. It just does not work with the numpad keys
    – Jorget Millani
    4 hours ago








  • 1




    I'm pretty sure your terminal does that, not Vim. My GNOME-Terminal has this. It changes the font size with <C-+> and <C--> even without Vim.
    – Ralf
    4 hours ago










  • You are using Vim in a terminal, not gVim? Which OS?, Which terminal emulator?
    – Ralf
    4 hours ago


















  • Thanks, I corrected the mappings, getting rid of that part. Still, the same thing: it does work with <C>+ and <C>-, so it can change the fonts - I don't think it is only the terminal, because if I comment those lines out the re-sizing of the font stops working. It just does not work with the numpad keys
    – Jorget Millani
    4 hours ago








  • 1




    I'm pretty sure your terminal does that, not Vim. My GNOME-Terminal has this. It changes the font size with <C-+> and <C--> even without Vim.
    – Ralf
    4 hours ago










  • You are using Vim in a terminal, not gVim? Which OS?, Which terminal emulator?
    – Ralf
    4 hours ago
















Thanks, I corrected the mappings, getting rid of that part. Still, the same thing: it does work with <C>+ and <C>-, so it can change the fonts - I don't think it is only the terminal, because if I comment those lines out the re-sizing of the font stops working. It just does not work with the numpad keys
– Jorget Millani
4 hours ago






Thanks, I corrected the mappings, getting rid of that part. Still, the same thing: it does work with <C>+ and <C>-, so it can change the fonts - I don't think it is only the terminal, because if I comment those lines out the re-sizing of the font stops working. It just does not work with the numpad keys
– Jorget Millani
4 hours ago






1




1




I'm pretty sure your terminal does that, not Vim. My GNOME-Terminal has this. It changes the font size with <C-+> and <C--> even without Vim.
– Ralf
4 hours ago




I'm pretty sure your terminal does that, not Vim. My GNOME-Terminal has this. It changes the font size with <C-+> and <C--> even without Vim.
– Ralf
4 hours ago












You are using Vim in a terminal, not gVim? Which OS?, Which terminal emulator?
– Ralf
4 hours ago




You are using Vim in a terminal, not gVim? Which OS?, Which terminal emulator?
– Ralf
4 hours ago










Jorget Millani is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















Jorget Millani is a new contributor. Be nice, and check out our Code of Conduct.













Jorget Millani is a new contributor. Be nice, and check out our Code of Conduct.












Jorget Millani is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Vi and Vim Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fvi.stackexchange.com%2fquestions%2f18474%2fnumpad-characters-dont-work-in-keybindings-mappings-but-work-in-general%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Contact image not getting when fetch all contact list from iPhone by CNContact

count number of partitions of a set with n elements into k subsets

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks