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

























  • Those mappings dont look quite right to my eye

    – D. Ben Knoble
    Jan 6 at 18:47











  • Also the title of your question has nothing to do with it’s body?

    – D. Ben Knoble
    Jan 6 at 18:47











  • @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
    Jan 6 at 18:52











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

    – D. Ben Knoble
    Jan 6 at 18:53











  • @D.BenKnoble Changed that, no effect

    – Jorget Millani
    Jan 6 at 19:17
















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

























  • Those mappings dont look quite right to my eye

    – D. Ben Knoble
    Jan 6 at 18:47











  • Also the title of your question has nothing to do with it’s body?

    – D. Ben Knoble
    Jan 6 at 18:47











  • @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
    Jan 6 at 18:52











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

    – D. Ben Knoble
    Jan 6 at 18:53











  • @D.BenKnoble Changed that, no effect

    – Jorget Millani
    Jan 6 at 19:17














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
















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















share|improve this question













share|improve this question




share|improve this question








edited Jan 6 at 19:17







Jorget Millani

















asked Jan 6 at 18:38









Jorget MillaniJorget Millani

112




112













  • Those mappings dont look quite right to my eye

    – D. Ben Knoble
    Jan 6 at 18:47











  • Also the title of your question has nothing to do with it’s body?

    – D. Ben Knoble
    Jan 6 at 18:47











  • @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
    Jan 6 at 18:52











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

    – D. Ben Knoble
    Jan 6 at 18:53











  • @D.BenKnoble Changed that, no effect

    – Jorget Millani
    Jan 6 at 19:17



















  • Those mappings dont look quite right to my eye

    – D. Ben Knoble
    Jan 6 at 18:47











  • Also the title of your question has nothing to do with it’s body?

    – D. Ben Knoble
    Jan 6 at 18:47











  • @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
    Jan 6 at 18:52











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

    – D. Ben Knoble
    Jan 6 at 18:53











  • @D.BenKnoble Changed that, no effect

    – Jorget Millani
    Jan 6 at 19:17

















Those mappings dont look quite right to my eye

– D. Ben Knoble
Jan 6 at 18:47





Those mappings dont look quite right to my eye

– D. Ben Knoble
Jan 6 at 18:47













Also the title of your question has nothing to do with it’s body?

– D. Ben Knoble
Jan 6 at 18:47





Also the title of your question has nothing to do with it’s body?

– D. Ben Knoble
Jan 6 at 18:47













@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
Jan 6 at 18:52





@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
Jan 6 at 18:52













The typical syntax is map <LHS> <RHS>, but in your question i see 3 “sides” after the map commands

– D. Ben Knoble
Jan 6 at 18:53





The typical syntax is map <LHS> <RHS>, but in your question i see 3 “sides” after the map commands

– D. Ben Knoble
Jan 6 at 18:53













@D.BenKnoble Changed that, no effect

– Jorget Millani
Jan 6 at 19:17





@D.BenKnoble Changed that, no effect

– Jorget Millani
Jan 6 at 19:17










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
    Jan 6 at 19:18








  • 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
    Jan 6 at 19:20











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

    – Ralf
    Jan 6 at 19:22











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
});


}
});














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
    Jan 6 at 19:18








  • 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
    Jan 6 at 19:20











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

    – Ralf
    Jan 6 at 19:22
















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
    Jan 6 at 19:18








  • 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
    Jan 6 at 19:20











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

    – Ralf
    Jan 6 at 19:22














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 Jan 6 at 20:06

























answered Jan 6 at 19:13









RalfRalf

950112




950112













  • 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
    Jan 6 at 19:18








  • 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
    Jan 6 at 19:20











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

    – Ralf
    Jan 6 at 19:22



















  • 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
    Jan 6 at 19:18








  • 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
    Jan 6 at 19:20











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

    – Ralf
    Jan 6 at 19:22

















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
Jan 6 at 19:18







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
Jan 6 at 19:18






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
Jan 6 at 19:20





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
Jan 6 at 19:20













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

– Ralf
Jan 6 at 19:22





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

– Ralf
Jan 6 at 19:22


















draft saved

draft discarded




















































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.




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

Human spaceflight

Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

張江高科駅