Re: good keys for mappings

2007-06-02 Thread John Little

Hi all

Tony said:


F2 to F12 (with the possible exception of F10), Shift-F1 to Shift-F12.


Perhaps not the OP, but someone might find this useful.

Vim, at least on Windows, also knows about F13, F14 and F15.  I've
never seen a keyboard with such, but registry mappings can be used to
map the otherwise next to useless (IMO) windows keys (called Left
Windows, Right Windows and Application) to them, and their easily
found location may make them good for a map leader, though grossly
unportable.

(I confess the weakness, oh the shame, of using the arrow keys a lot,
with the mouse, more shame, in my left hand, so while in this mode, I
use the above trick to bring often used functions to hand without
having to move my left hand from the mouse.)

Of the various pages about this windows arcana I found
http://www.usnetizen.com/fix_capslock.html very helpful.

I'm curious, though.  Are these keys known by Vim on Unices, so could
be mapped with say, xmodmap?

Regards, John


Re: good keys for mappings

2007-06-02 Thread A.J.Mechelynck

John Little wrote:

Hi all

Tony said:


F2 to F12 (with the possible exception of F10), Shift-F1 to Shift-F12.


Perhaps not the OP, but someone might find this useful.

Vim, at least on Windows, also knows about F13, F14 and F15.  I've
never seen a keyboard with such, but registry mappings can be used to
map the otherwise next to useless (IMO) windows keys (called Left
Windows, Right Windows and Application) to them, and their easily
found location may make them good for a map leader, though grossly
unportable.

(I confess the weakness, oh the shame, of using the arrow keys a lot,
with the mouse, more shame, in my left hand, so while in this mode, I
use the above trick to bring often used functions to hand without
having to move my left hand from the mouse.)

Of the various pages about this windows arcana I found
http://www.usnetizen.com/fix_capslock.html very helpful.

I'm curious, though.  Are these keys known by Vim on Unices, so could
be mapped with say, xmodmap?

Regards, John



After doinf some research (it wasn't easy) on my Linux system, I came up with 
the following:


X11 allows up to 35 F-keys; you would of course have to determine the 
geographical code of the keys involved, or to find some way to remap them. 
(Keyboards with up to 248 keys are supported in theory, and keycodes are in 
the range 8..255 so they are not the same as keyboard scan codes.)


On my system, /usr/include/X11/keysymdef.h, and a few more in the same 
directory, define a lot of key functions for X11 (I mean, they give names to 
what a key can do when you hit it).



Best regards,
Tony.
--
To err is human, to moo bovine.


Re: good keys for mappings

2007-06-02 Thread Yegappan Lakshmanan

Hi,

On 5/31/07, Arn [EMAIL PROTECTED] wrote:

Hi,

Any suggestions on keys/key combos that are good candidates for custom
mappings etc?

Maybe a dumb question but I hate having to unlearn something, I'd like
to create a fair number of mappings that use a consistent convention and
won't conflict with anything existing.  I think Bram mentioned he's
found prefixing with _ works well..



In addition to the detailed answers you have already received, you
can also refer to the following tutorial on creating keymaps with Vim:

http://www.geocities.com/yegappan/vim_keymap.html

- Yegappan


good keys for mappings

2007-05-31 Thread Arn

Hi,

Any suggestions on keys/key combos that are good candidates for custom 
mappings etc?


Maybe a dumb question but I hate having to unlearn something, I'd like 
to create a fair number of mappings that use a consistent convention and 
won't conflict with anything existing.  I think Bram mentioned he's 
found prefixing with _ works well..


thanks


Re: good keys for mappings

2007-05-31 Thread Tim Chase

Any suggestions on keys/key combos that are good candidates
for custom mappings etc?

[snip]

I think Bram mentioned he's found prefixing with _ works
well..


I believe that the backslash (\) is the only stand-alone 
lower-ASCII character available for mappings, and thus is the 
default map-leader (:help mapleader).  Depending on your vim 
environment, control+S and control+Q are also available, but on 
console versions, they ofter mess with your flow-control so 
they're not quite as portable.


There are a family of characters which mostly duplicate behavior 
of other keys, and thus are good candidates if you want them. 
Such characters include the underscore (as you mentioned), the 
plus, the minus, the enter key and control+M/control+J.  These 
characters mostly navigate up or down with tweaks regarding how 
they treat counts, and how they behave column-wise.  (Always a 
bit like my understanding of the kama-sutra...#58 is the same as 
#42, only you cross your fingers)


Fortunately, Alt+anything should be available if supported by 
your vim environment (some consoles don't pass along Alt). 
Additionally, all the F-n keys are available (again, assuming 
availability in your terminal).


Some folks have problems with the backslash on their keyboard 
because it's in an inconvenient place (or requires key-chords or 
use of dead-keys), so they prefer to use another character as the 
mapleader.  However, if backslash is available and easy enough 
for you to reach, it would be my recommended character.


A lot of folks seem to use the comma or semi-colon as a 
map-leader, but they _do_ have functionality that I use on a 
regular basis.  Therefore, if you don't want to relearn muscle 
memory and want to eventually learn to use those commands (a good 
follow-on lesson to using t/T/f/F for jumping in a line), I 
wouldn't go over to the dark side... ;-)


-tim






Re: good keys for mappings

2007-05-31 Thread Peter Palm
Op donderdag 31 mei 2007, schreef Arn:
 Hi,

 Any suggestions on keys/key combos that are good candidates for
 custom mappings etc?

 Maybe a dumb question but I hate having to unlearn something, I'd
 like to create a fair number of mappings that use a consistent
 convention and won't conflict with anything existing.  I think Bram
 mentioned he's found prefixing with _ works well..

Well, there's a special key, the so called 'mapleader', you can use to 
define your mappings. If you don't set it, it defaults to '\'. You can 
change the value of the mapleader to '_' to 'test' your mapping with 
the '_' prefix, or change it to something else, without changing the 
definition of the map.

See
:help mapleader

for more info.

Oh, and personally, I just keep it set to the default.


Peter


Re: good keys for mappings

2007-05-31 Thread François Pinard

[Arn]

Any suggestions on keys/key combos that are good candidates for custom 
mappings etc?


The usual is \ followed by something.  I initially fought this 
convention, because \ is a bit hard to type on my keyboard, and tried 
other things instead, with various levels of conflicts and displeasure.  
I finally gave in the convention and overcame the keyboard difficulty.



I think Bram mentioned he's found prefixing with _ works well..


The _ key is sometimes suggested as well, and some say it is unused.  
But this is not true, _ is a very useful command for me (it brings the 
cursor back at the first non-blank character of the current line).


A common approach is to use timeouts for recognizing a single key 
command when that key is also the prefix of multi-key commands.  The 
timeout is not incurred when you immediately follow the single key 
command by other commands which are not ambiguous with the multi-key 
commands, but if you want to see the effect of the single key command, 
you have to suffer the timeout, which may be a bit irritating at times.


--
François Pinard   http://pinard.progiciels-bpi.ca


Re: good keys for mappings

2007-05-31 Thread DervishD
Hi Arn :)

 * Arn [EMAIL PROTECTED] dixit:
 Any suggestions on keys/key combos that are good candidates for custom 
 mappings etc?
 
 Maybe a dumb question but I hate having to unlearn something, I'd like 
 to create a fair number of mappings that use a consistent convention and 
 won't conflict with anything existing.  I think Bram mentioned he's 
 found prefixing with _ works well..

I think that, apart from '\' (backslash) and probably '_'
(underscore) there aren't many keys available for everyone to use as
mapleader.

This said, depending on your keyboard layout, you may find
interesting candidates: for example, my spanish keyboard comes with ç,
which is just under my right little finger and that I almost never use.
So, I've remapped some combos to 'çç', 'ç+', 'ç-', etc. That is, the key
I don't use and the keys that are near to it.

This is very useful to me, but this works only on spanish keyboards.
Which layout do you use?

Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736 | http://www.dervishd.net
It's my PC and I'll cry if I want to... RAmen!


Re: good keys for mappings

2007-05-31 Thread Yeti
On Thu, May 31, 2007 at 11:15:18AM -0400, François Pinard wrote:

 I think Bram mentioned he's found prefixing with _ works well..

 The _ key is sometimes suggested as well, and some say it is unused.
 But this is not true, _ is a very useful command for me (it brings the
 cursor back at the first non-blank character of the current line).

If you use _ only for that (i.e. without count), it is
equivalent to ^.  So you can map one of them.

Yeti

--
http://gwyddion.net/


Re: good keys for mappings

2007-05-31 Thread A.J.Mechelynck

Arn wrote:

Hi,

Any suggestions on keys/key combos that are good candidates for custom 
mappings etc?


Maybe a dumb question but I hate having to unlearn something, I'd like 
to create a fair number of mappings that use a consistent convention and 
won't conflict with anything existing.  I think Bram mentioned he's 
found prefixing with _ works well..


thanks



F2 to F12 (with the possible exception of F10), Shift-F1 to Shift-F12. As many 
keys as the Great Arcana of a Tarot deck ;-) Need more? Use some of them as 
prefixes for multikey {lhs}es.


On my Linux/kde system, the window manager preempts Ctrl-Fn and Alt-Fn so 
those are not usable for Vim.



Best regards,
Tony.
--
The chief cause of problems is solutions.


Re: good keys for mappings

2007-05-31 Thread A.J.Mechelynck

DervishD wrote:

Hi Arn :)

 * Arn [EMAIL PROTECTED] dixit:
Any suggestions on keys/key combos that are good candidates for custom 
mappings etc?


Maybe a dumb question but I hate having to unlearn something, I'd like 
to create a fair number of mappings that use a consistent convention and 
won't conflict with anything existing.  I think Bram mentioned he's 
found prefixing with _ works well..


I think that, apart from '\' (backslash) and probably '_'
(underscore) there aren't many keys available for everyone to use as
mapleader.

This said, depending on your keyboard layout, you may find
interesting candidates: for example, my spanish keyboard comes with ç,
which is just under my right little finger and that I almost never use.
So, I've remapped some combos to 'çç', 'ç+', 'ç-', etc. That is, the key
I don't use and the keys that are near to it.

This is very useful to me, but this works only on spanish keyboards.
Which layout do you use?

Raúl Núñez de Arenas Coronado



On my Belgian keyboard, there are ù (u-grave) and µ (greek mu) at the right 
end of the middle row, plus shift-mu which is £ (pound sterling). Shift-ù is % 
and Vim uses that, especially when matchit is enabled. Then there are keys 
like ² (superscript 2), é (e-acute), § (paragraph), è (e-grave), ç 
(c-cedilla), à (a-grave) as the unshifted counterparts of various keys of the 
digits row (on this AZERTY layout the digits are shifted, unlike on US-QWERTY).


But I'd say the F keys are the safest in general, especially when taking 
portability into account.



Best regards,
Tony.
--
An attorney was defending his client against a charge of first-degree
murder.  Your Honor, my client is accused of stuffing his lover's
mutilated body into a suitcase and heading for the Mexican border.
Just north of Tijuana a cop spotted her hand sticking out of the
suitcase.  Now, I would like to stress that my client is *not* a
murderer.  A sloppy packer, maybe...


Re: good keys for mappings

2007-05-31 Thread DervishD
Hi Tony :)

 * A.J.Mechelynck [EMAIL PROTECTED] dixit:
 But I'd say the F keys are the safest in general, especially when
 taking portability into account.

Of course: if you plan to use more than one vim or more than one
keyboard type, the F keys are the best choice. In fact, for complex
commands I think that they are the only option, because that way you
will be able to do these complex commands in any keyboard. But for
simple things (like my 'çç', which is just a shorcut for gqip more or
less) I prefer a key which is near to my blind typing position.

Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736 | http://www.dervishd.net
It's my PC and I'll cry if I want to... RAmen!


Re: good keys for mappings

2007-05-31 Thread A.J.Mechelynck

DervishD wrote:

Hi Tony :)

 * A.J.Mechelynck [EMAIL PROTECTED] dixit:

But I'd say the F keys are the safest in general, especially when
taking portability into account.


Of course: if you plan to use more than one vim or more than one
keyboard type, the F keys are the best choice. In fact, for complex
commands I think that they are the only option, because that way you
will be able to do these complex commands in any keyboard. But for
simple things (like my 'çç', which is just a shorcut for gqip more or
less) I prefer a key which is near to my blind typing position.

Raúl Núñez de Arenas Coronado



I used to have a mapping for µ (mu) because it's easily accessible (not far 
from your ç, I guess), but that mapping must have gone up in smoke when I 
upgraded from M$ to Linux. Nowadays I have all my important mappings on Fn and 
Shift-Fn, but I keep µ and £ (and then maybe ² ³ etc) in reserve for the time 
when all available F slots will have been taken.



Best regards,
Tony.
--
Just remember: when you go to court, you are trusting your fate to
twelve people that weren't smart enough to get out of jury duty!