🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.editors
Article #3843

Re: In Ctrl with vi!

#3843
From: Ilya
Date: Mon, 29 Mar 1999 00:00
93 lines
4576 bytes
O. W. Puckett <sendnospam@nortel.ca> wrote:
 
> I've discovered some tricks/techniques recently that have made vi a lot
> more fun to use.  They may seem minor or obvious or whatever to you, but
> they weren't obvious to me and their effects on my editing have been
> major.  If you use vi, at least give them a try and see whether you like
> them.

> What's the key to the left of your 'a' key?  For me it's "Caps Lock."  I
> hit this key two or three times a year.  So why is "Caps Lock" taking up
> such a choice spot on my keyboard?  It's nuts.  Luckily, this is
> something we can change.

> Under Unix, you can swap the "Caps Lock" and "Ctrl" keys pretty easily.
> Having the "Ctrl" key to the left of the 'a' key can be very handy, as
> you will soon see.  Here's how you can swap them.

You are right.  Having the CTRL key to the left of the "A" key is very
handy... for Emacs users. In Emacs, you have to use the CTRL all the time,
for every movement.  (Unless you use arrow keys, but then you have to take
your hands off the home row). 

In vi, the key that you use a lot more often is Escape. I constantly go from
Input to Escape modes. Constantly. That is why it makes sense to remap the
Caps Lock key, which is used rarely, to the Escape key, not control.  I think
it is done the same way as in your example, except that Control_L gets
replaced by Escape.

I tried it and I got the Caps Lock key to work as Escape, but I could not get
either Control keys or the Escape key to work as Caps Lock using your
example.


> Make a file in your home directory called ".xmodmap".  Put these
> commands in it:

> 	!
> 	! Swap Caps_Lock and Control_L
> 	!
> 	remove Lock = Caps_Lock
> 	remove Control = Control_L
> 	keysym Control_L = Caps_Lock
> 	keysym Caps_Lock = Control_L
> 	add Lock = Caps_Lock
> 	add Control = Control_L

> Run the command "xrdb -merge ~/.xmodmap".  Now your "Caps Lock" key
> does what the "Ctrl" key used to do and vice versa.  If it works
> correctly, you can put this command into one of your startup files so
> that the key swap happens every time you log in.

> DOS/Windows users can make the key swap using various public domain
> programs with which I am happily unfamiliar.

> This swap lets us do cool things with vi:

> (1) Did you know that pressing "Ctrl [" is the same as pressing the
> "Esc" key?  You know it now.  And now that the "Ctrl" key is in such a
> choice spot, it's a lot faster to hit "Ctrl [" than it is to find the
> "Esc" key (which is relegated to the Siberia of the far upper-left
> corner of many keyboards).  I was dubious of the benefits of "Ctrl ["
> until I actually tried it, but it's damn fast, trust me.  It makes vi
> a true pleasure to use.

Yes, but using two keys when I can use one is not an advantage, it is a
disadvantage.

> (2)  Did you know that pressing "Ctrl h" is the same as pressing
> "Backspace"?  And it's faster.  This I was really dubious of, but all
> I can say is, give it a try.  Some people will like the change and
> some will hate it.  I like it.  You don't have to look down, and you
> don't have to reach your pinky out into nowhere.

Yeah, the same thing.

> (3)  Did you know that pressing "Ctrl i" is the same as pressing
> "Tab"?  This feature I'm not really sold on yet, but I'm still trying
> it out.

The same thing. :)  Tab is easier.

> To sum up:  you can at least speed up the two most common things you do
> in vi -- hitting "Esc" and hitting "Backspace" -- by relocating the
> "Ctrl" key and changing your habits.  I think you'll find that doing
> this makes vi faster than ever.

Why not just move Escape - which is what you really use - down to the home
row?

Ilya

--------------------------
These are my opinions only.
Technical Details
Message-ID: <7doe5l$61b$2@ocean.cup.hp.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <b32pv61qtvb.fsf@wppkhc65.us.nortel.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 102b9a,1f8bd93945d97f92,start
X-Google-Attributes: gid102b9a,public
X-Google-Thread: 10e6b9,1f8bd93945d97f92,start
X-Google-Attributes: gid10e6b9,public
X-Google-Thread: 107393,da892dab18020116
X-Google-Attributes: gid107393,public
From: Ilya <NO_SPAM_ilya@napavlly.rose.hp.com>
Subject: Re: In Ctrl with vi!
Date: 1999/03/29
Message-ID: <7doe5l$61b$2@ocean.cup.hp.com>
X-Deja-AN: 460421870
Distribution: inet
Sender: Ilya <ilya@napavlly.rose.hp.com>
References: <b32pv61qtvb.fsf@wppkhc65.us.nortel.com>
Organization: Hewlett Packard Cupertino Site
User-Agent: tin/pre-1.4-981114 ("The Watchman") (UNIX) (HP-UX/B.11.00 (9000/715))
Newsgroups: comp.editors,comp.emacs,gnu.emacs