Xshell Forum

Number keypad in vim insert mode

Last post: Monday, December 30, 2013 8:51 AM by Thom Porter, 6 reply

 
Friday, January 6, 2012 9:34 AM - slashkick

Number keypad in vim insert mode

 
I'm using the number keypad with num lock on in insert mode in vim. The number keypad inserts letters on a new line. The letters that are inserted are below. When not in insert mode, the number keypad work as expected and enters numbers. Does anyone have a solution to get the number keypad working normally in insert mode?

1=q
2=r
3=s
4=t

Program Ver. : Xshell 4
Friday, January 6, 2012 11:03 AM - slashkick

Re: Number keypad in vim insert mode

 
I should say that with SecureCRT the keypad functions normally entering numbers in insert mode on the same machine
Monday, January 9, 2012 7:00 PM - Filipe

Re: Number keypad in vim insert mode

 
This is due to different terminal type setting. You can change the Terminal type in Xshell session properties > Terminal. Set it as ansi and number pad should work in VIM.
Thursday, January 19, 2012 2:44 PM - slashkick

Re: Number keypad in vim insert mode

 
Filipe - Thank you so much!@!

Exactly correct.
Friday, February 17, 2012 8:50 PM - wuj

Re: Number keypad in vim insert mode

 
When I change to ansi mode, it seems PgUp and PgDn does not work well in the normal mode of vim. It will act as a function to change the current letter to a capital style instead of scroll the screen.
Tuesday, February 21, 2012 5:47 PM - Daniel

Re: Number keypad in vim insert mode

 
In VIM (or VI), the following keys are used to move between pages:

Ctrl-F - forward one page
Ctrl-B - back one page
Monday, December 30, 2013 8:51 AM - Thom Porter

Re: Number keypad in vim insert mode

 
None of the above worked well enough for me. Switching to ANSI meant loosing the functionality of other keys - namely my delete becoming a backspace (no, I didn't have "delete sends backspace" checked - though I tried checking it to see if it would fix it!) Other keys weren't working either, like home/end, etc. So I started playing. Here's what worked best for me in SecureCRT:

Under Terminal -> Emulation:
1) Set Terminal to XTerm (optionally turn on ANSI color, works fine for me.)
2) Make sure alternate keyboard emulation is unchecked.

Under Terminal -> Emulation -> Modes:
1) Make sure "Numeric Keypad" is selected in both sections.
2) Uncheck "Enable keypad mode switching".

Restart SecureCRT and give it a whirl. The only problem you might have is if you turn numlock off, the numpad does strange things (does not operate as arrows.) I don't mind this - I never turn numlock off... Also, if it makes a difference, I'm connecting to my dev machine, running Ubuntu 12 server 99% of the time... I ssh to other servers from there, and the numpad continues to work as expected on other machines I connect to.

-tp