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












2














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
    yesterday










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










  • @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
    yesterday










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










  • @D.BenKnoble Changed that, no effect
    – Jorget Millani
    yesterday
















2














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
    yesterday










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










  • @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
    yesterday










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










  • @D.BenKnoble Changed that, no effect
    – Jorget Millani
    yesterday














2












2








2







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 yesterday







Jorget Millani













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 yesterday









Jorget MillaniJorget Millani

112




112




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
    yesterday










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










  • @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
    yesterday










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










  • @D.BenKnoble Changed that, no effect
    – Jorget Millani
    yesterday


















  • Those mappings dont look quite right to my eye
    – D. Ben Knoble
    yesterday










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










  • @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
    yesterday










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










  • @D.BenKnoble Changed that, no effect
    – Jorget Millani
    yesterday
















Those mappings dont look quite right to my eye
– D. Ben Knoble
yesterday




Those mappings dont look quite right to my eye
– D. Ben Knoble
yesterday












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




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












@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
yesterday




@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
yesterday












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




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












@D.BenKnoble Changed that, no effect
– Jorget Millani
yesterday




@D.BenKnoble Changed that, no effect
– Jorget Millani
yesterday










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
    yesterday








  • 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
    yesterday










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











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
    yesterday








  • 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
    yesterday










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
















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
    yesterday








  • 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
    yesterday










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














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 yesterday

























answered yesterday









RalfRalf

70511




70511












  • 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
    yesterday








  • 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
    yesterday










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


















  • 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
    yesterday








  • 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
    yesterday










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
















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
yesterday






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
yesterday






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
yesterday




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
yesterday












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




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










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

1300-talet

1300-talet

Display a custom attribute below product name in the front-end Magento 1.9.3.8