/
Using number pad in VI or Vim

Using number pad in VI or Vim

PROBLEM DESCRIPTION


This article explains how you can configure Xshell and terminal to allow entering numbers using the number pad in the vi or vim editor.



RESOLUTION


This problem occurs when the terminal type is not set to 'vt220' or 'ansi'. To use the color feature such as the syntax highlighting feature in vi, change the terminal type to ansi.
To change the terminal type from terminal, enter one of the following commands:
$export TERM=ansi 

or 

$setenv TERM ansi
Alternatively, you can set the terminal type in Xshell session properties. Selected terminal type will be used every time you open the session. To change the terminal type in Xshell:
  1. Open the Session Properties dialog box.
  2. Click on the 'Terminal' menu.
  3. From the Terminal Type list, select or type 'ansi'.
  4. Click OK to save the changes. 


ADDITIONAL INFORMATION


If you want to set the terminal type for the vi editor only, you can create a script and execute it when you open vi. To do this:
First, create a script file in home directory with the following command:
$ vi $HOME/vi
Then, save the following lines:
#!/bin/sh
TERM=ansi
export TERM
exec /usr/bin/vi $@
Change the permission on the file to 755:
$chmod 755 $HOME/vi
Lastly, open the login script file such as .profile.cshrc or .login and add the following line:
$alias vi='$HOME/vi'
(If you are using C Shell, use $alias vi '$HOME/vi')
Or you can use a little code using alias.
$ alias vi=`OLDTERM=${TERM}; TERM=ansi; \vi; TERM=${OLDTERM}'

Related content

Making an SSH connection to an AWS EC2 server
Making an SSH connection to an AWS EC2 server
Read with this
Using numeric keypad in vi, vim
Using numeric keypad in vi, vim
More like this
Number keypad in vim insert mode [8]
Number keypad in vim insert mode [8]
More like this
keypad under VI - Solaris 8 [1]
keypad under VI - Solaris 8 [1]
More like this
Can't use vi editor [1]
Can't use vi editor [1]
More like this
Local shell can't use number keypad [5]
Local shell can't use number keypad [5]
More like this