Sponsored Content
Full Discussion: A trick to avoid ESC in vim
Top Forums UNIX for Dummies Questions & Answers A trick to avoid ESC in vim Post 302488697 by vistastar on Tuesday 18th of January 2011 08:19:19 AM
Old 01-18-2011
Hammer & Screwdriver A trick to avoid ESC in vim

Hello, I find a trick to avoid pressing ESC without key-maping in vim. I am pleasure using this method, because ALT key is very comfortble for thumb to press.

What's the trick? the ALT key.

When you are in INSERT mod, press
Code:
ALT+l                              switch to COMMAND mod without cursor moving.
ALT+h                              switch to COMMAND mod with cursor moving foward two char.
ALT+d                              switch to COMMAND mod without cursor moving up one line.
ALT+k                              switch to COMMAND mod without cursor moving down one line.
ALT+dd                             remove current line.
ALT+shift+ZZ                       save and quit vim.
...
...

Now, I think you have grasped this simple trick:
ALT+somekey = ESC then somekey.
PS: In GUI terminals, you should disable ALT as shortcut key for menu.
This User Gave Thanks to vistastar For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Stupid find trick

At work, we use a software development product (from a company that will remain nameless, but whose name may be considered a synonym for "logical"). The development trees are organized beneath a top directory, let's call it "$rat". The first level under $rat contains the major system names, and... (2 Replies)
Discussion started by: criglerj
2 Replies

2. UNIX for Dummies Questions & Answers

Looking for tips ant trick extend vi

Hello im looking for sites or tutorials how to extend vi (not vim) for programming and scripting beyond simple editing . Thanks allot (0 Replies)
Discussion started by: umen
0 Replies

3. UNIX for Dummies Questions & Answers

How to invoke ESC+K

How to invoke ESC+K to get recent commands in Korn Shell. In some of the unix machine ESC+K is available and in some machines, it does not work. All of the machines that I work have Korn shell. (5 Replies)
Discussion started by: bobbygsk
5 Replies

4. Shell Programming and Scripting

Any trick to speed up script?

Hi Guys, I have a script that I am using to convert some text files to xls files. I create multiple temp. files in the process of conversion. Other than reducing the temp. files, are there any general tricks to help speed up the script? I am running it in the bash shell. Thanks. (6 Replies)
Discussion started by: npatwardhan
6 Replies

5. Shell Programming and Scripting

Esc - key

hi i remember sometime back working in unix, when u dont recall a complete file name..u hit ESC key couple of times and actual complete name of that file which u looking for , gets visible For this to be enabled , do we need to make any entry in .profile file. In my current project, am... (3 Replies)
Discussion started by: sureshg_sampat
3 Replies

6. Solaris

Very Importan - Vim Settings - Error while opening a File using vim

I downloaded vim.7.2 and compiled the vim source . Added the vim binary path to PATH (Because iam not the root of the box) when i load the file using vim it throws me an error Error detected while processing /home2/e3003091/.vimrc: line 2: E185: Cannot find color scheme darkblue line... (0 Replies)
Discussion started by: girija
0 Replies

7. UNIX for Dummies Questions & Answers

alternative to the grep trick

Hi, We used to use the below commands often. ps -ef|grep bc ps -ef|grep abc|grep -v grep Both fairly returns the same result. For example, the process name is dynamic and we are having the process name in a variable, how we can apply the above trick. For example "a" is the... (11 Replies)
Discussion started by: pandeesh
11 Replies

8. Programming

Oracle TRICk Question

HI Guys , Below are the two columns ITEMS and STATE of table . ITEMS STATE '2345','ggdh','k5tg','dgyt','hFF' DF '1234','ghyt','DDD','GHTD','ABF' PQ Can we get output in PL/SQL in below way ?... (7 Replies)
Discussion started by: Perlbaby
7 Replies

9. UNIX for Beginners Questions & Answers

UNIX trick or command

Hi, Is there any command to do this -- Input is -- Ant Bat Cat Dog Output is -- A_Ant B_Ant A_Bat B_Bat A_Cat B_Cat A_Dog B_Dog (12 Replies)
Discussion started by: Indra2011
12 Replies
KEYBOARD(4)						   BSD Kernel Interfaces Manual 					       KEYBOARD(4)

NAME
keyboard -- pc keyboard interface DESCRIPTION
The PC keyboard is used as the console character input device. The keyboard is owned by the current virtual console. To switch between the virtual consoles use the sequence ALT+Fn, which means hold down ALT and press one of the function keys. The virtual console with the same number as the function key is then selected as the current virtual console and given exclusive use of the keyboard and display. The console allows entering values that are not physically present on the keyboard via a special keysequence. To use this facility press and hold down ALT, then enter a decimal number from 0-255 via the numerical keypad, then release ALT. The entered value is then used as the ASCII value for one character. This way it is possible to enter any ASCII value, not present on the keyboard. The console driver also includes a history function. It is activated by pressing the scroll-lock key. This holds the display, and enables the cursor arrows for scrolling up and down through the last scrolled out lines. The keyboard is configurable to suit the individual user and the different national layout. The keys on the keyboard can have any of the following functions: Normal key Enter the ASCII value associated with the key. Function key Enter a string of ASCII values. Switch Key Switch virtual console. Modifier Key Change the meaning of another key. The keyboard is seen as a number of keys numbered from 1 to n. This number is often referred to as the "scancode" for a given key. The num- ber of the key is transmitted as an 8 bit char with bit 7 as 0 when a key is pressed, and the number with bit 7 as 1 when released. This makes it possible to make the mapping of the keys fully configurable. The meaning of every key is programmable via the PIO_KEYMAP ioctl call, that takes a structure keymap_t as argument. The layout of this structure is as follows: struct keymap { u_short n_keys; struct key_t { u_char map[NUM_STATES]; u_char spcl; u_char flgs; } key[NUM_KEYS]; }; The field n_keys tells the system how many keydefinitions (scancodes) follows. Each scancode is then specified in the key_t substructure. Each scancode can be translated to any of 8 different values, depending on the shift, control, and alt state. These eight possibilities are represented by the map array, as shown below: alt scan cntrl alt alt cntrl code base shift cntrl shift alt shift cntrl shift map[n] 0 1 2 3 4 5 6 7 ---- ------------------------------------------------------ 0x1E 'a' 'A' 0x01 0x01 'a' 'A' 0x01 0x01 This is the default mapping for the key labelled 'A' which normally has scancode 0x1E. The eight states are as shown, giving the 'A' key its normal behavior. The spcl field is used to give the key "special" treatment, and is interpreted as follows. Each bit corresponds to one of the states above. If the bit is 0 the key emits the number defined in the corresponding map[] entry. If the bit is 1 the key is "special". This means it does not emit anything; instead it changes the "state". That means it is a shift, control, alt, lock, switch-screen, function- key or no-op key. The bitmap is backwards i.e., 7 for base, 6 for shift etc. The flgs field defines if the key should react on caps-lock (1), num-lock (2), both (3) or ignore both (0). The kbdcontrol(1) utility is used to load such a description into/outof the kernel at runtime. This makes it possible to change the key assignments at runtime, or more important to get (GIO_KEYMAP ioctl) the exact key meanings from the kernel (e.g. used by the X server). The function keys can be programmed using the SETFKEY ioctl call. This ioctl takes an argument of the type fkeyarg_t: struct fkeyarg { u_short keynum; char keydef[MAXFK]; char flen; }; The field keynum defines which function key that is programmed. The array keydef should contain the new string to be used (MAXFK long), and the length should be entered in flen. The GETFKEY ioctl call works in a similar manner, except it returns the current setting of keynum. The function keys are numbered like this: F1-F12 key 1 - 12 Shift F1-F12 key 13 - 24 Ctrl F1-F12 key 25 - 36 Ctrl+shift F1-F12 key 37 - 48 Home key 49 Up arrow key 50 Page Up key 51 (keypad) - key 52 Left arrow key 53 (keypad) 5 key 54 Right arrow key 55 (keypad) + key 56 End key 57 Down arrow key 58 Page down key 59 Insert key 60 Delete key 61 Left window key 62 Right window key 63 Menu key 64 The kbdcontrol(1) utility also allows changing these values at runtime. AUTHORS
Soren Schmidt <sos@FreeBSD.org> BSD
January 8, 1995 BSD
All times are GMT -4. The time now is 11:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy