• You are not logged in.

Colemak + Vim

  • Started by Jules
  • 148 Replies:
  • Shai
  • Administrator
  • Reputation: 36
  • Registered: 11-Dec-2005
  • Posts: 423
DreymaR said:

Alt/Meta-UNEI sounds like the better option, unless that messes up something important.

The Alt key is usually less comfortable to hit compared to other modifiers such as the Shift and Ctrl. It is also used for menus and such.

You can add the following to your colemak.vim:

set winaltkeys=no
inoremap <M-n> <Left>|
inoremap <M-u> <Up>|
inoremap <M-e> <Down>|
inoremap <M-i> <Right>|
Offline
  • 0
  • Reputation: 210
  • From: Viken, Norway
  • Registered: 13-Dec-2006
  • Posts: 5,343

Actually, I can see myself being able to use the AltGr key for this! As a Norwegian keyboardist, I'm already very used to hitting that key and although it seems awkwardly placed it's quite possible to flick the right-hand thumb inwards while keeping home position. As a result, navigation could be kept a right-hand affair.

I really like the UNEI nav block now, seeing how it has the N index finger bump making it easy to locate without ever looking. As for the disadvantage of leaving the home row for one key, I think the middle finger is strong enough to handle it and the intuitive physical layout of the block more than outweighs the excursions to the upper row in my opinion.

Could you show me how to implement the RAlt or whatever Linux calls it as the nav block metakey in insert mode, please?

I read about the emacs-vim "wars" today on the net. Good stuff, hehe. It's also amusing to try and determine whether perl or python wins the day. I've already learnt Colemak and a spot of Esperanto so I guess I'll get around to Perl as well someday.  :)

*** Learn Colemak in 2–5 steps with Tarmak! ***
*** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

Offline
  • 0
  • Shai
  • Administrator
  • Reputation: 36
  • Registered: 11-Dec-2005
  • Posts: 423

I don't think it makes sense to use the right Alt. It's better to use to the opposing hand for ergonomic reasons. Moreover, that way you wouldn't be able to type any of the AltGr characters.

Offline
  • 0
  • Reputation: 210
  • From: Viken, Norway
  • Registered: 13-Dec-2006
  • Posts: 5,343

Ah, forgot about those. Silly me. I was just thinking about the right-hand-navigates thing but this really is a point for normal mode I see now. Ah well.

Have you tried Cream? Any comments on that?

*** Learn Colemak in 2–5 steps with Tarmak! ***
*** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

Offline
  • 0
  • Reputation: 0
  • Registered: 08-Feb-2008
  • Posts: 20

I use gVim and Colemak with this script, and it's awesome. I'm wondering, though: why don't we map : (colon) to ; (semicolon) so the shift key isn't needed to do things like :e and :wq? Does that create a conflict elsewhere in the mappings?

Offline
  • 0
  • Shai
  • Administrator
  • Reputation: 36
  • Registered: 11-Dec-2005
  • Posts: 423

ChessWhiz, it's a good idea, and I've added it to the latest version of colemak.vim.

Offline
  • 0
  • Reputation: 0
  • Registered: 08-Feb-2008
  • Posts: 20

Thanks, that was fast! Downloading now.

Also, I'm loving the fact that Ctrl+Shift+Up/Dn moves lines, but I find myself trying to use the U/E keys instead of the arrow keys, and that only freezes up my Vim until I ESC a few times. Is there a reason U/E keys aren't enabled for this shortcut? This is really the only time I move my poor hand over to the miles-away arrow keys.

Offline
  • 0
  • Shai
  • Administrator
  • Reputation: 36
  • Registered: 11-Dec-2005
  • Posts: 423

That's also a good idea, but unfortunately Vim/GVim isn't capable of mapping Ctrl+Shift+[letter] correctly.

Offline
  • 0
  • Reputation: 0
  • Registered: 17-Mar-2008
  • Posts: 192

Hi all! Did anyone get around to compiling a cheat sheet? Even just an unformatted list of all the most commonly used commands, including the ones retained and unchanged from standard vim would be very helpful. If someone would provide such a list I would be happy to compile a chart or similar.

Offline
  • 0
  • Reputation: 210
  • From: Viken, Norway
  • Registered: 13-Dec-2006
  • Posts: 5,343

The list you're looking for is pretty much in the file - just open colemak.vim in ... uh, maybe in vim?  :)

A cheat sheet would be great. I haven't gotten around to using the ColemakVim beyond a little searching around yet because I'm daunted without a graphic.

I also couldn't quite figure out how to install it, being a complete noob around Linux. Is there a directory I could put the colemak.vim file in to have it automatically happen? What about "plugin"? [Edit: That seems to work for me (I have a Cream/Vim7.1 install).]

The plugin directory is for standard Vim plugin scripts.

All files here ending in .vim will be sourced by Vim when it starts up.
Look in the file for hints on how it can be disabled without deleting it.

I'm a bit confused, because the "addons" dir is also mentioned. Would both those work?

Last edited by DreymaR (18-Mar-2008 09:35:27)

*** Learn Colemak in 2–5 steps with Tarmak! ***
*** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

Offline
  • 0
  • Reputation: 0
  • Registered: 17-Mar-2008
  • Posts: 192

Dreymar: That is true, but I am new to vim and so parsing the vim file would be a bit of work for me. I am also unsure yet which commands are important in vim so just putting the whole vim file into a cheat sheet might not be the best thing to do.

If no one else has done it I'll likely get around to it myself.

Offline
  • 0
  • Reputation: 0
  • From: Australia
  • Registered: 22-Oct-2007
  • Posts: 47
tomlu said:

Hi all! Did anyone get around to compiling a cheat sheet? Even just an unformatted list of all the most commonly used commands, including the ones retained and unchanged from standard vim would be very helpful.

This is not a direct answer to your question, but I thought I would mention the way that I set up vim for Colemak personally.

First of all, here is a cheat sheet for the basic commands in their original QWERTY positions:

http://www.worldtimzone.com/res/vi.html

What I respected about this interface is that virtually all of the commands are logically named by taking the first character of one of the words in the command description. So,

w - move forward one "w"ord
b - move "b"ackward one word
d - "d"elete
i - "i"nsert text at cursor position
a - "a"ppend text after cursor position
:w - "w"rite file
:q - "q"uit vim

Then, you can combine commands, such as "dw" = "delete word", and ":wq" = "write and quit".

When switching to Colemak, I did not like the idea of messing with these logical letter associations - especially the most frequent one, the "insert" command. When I enter insert mode, I still like to type "i" because that is logically what I think of in my head when I want to insert text.

** My vim key bindings **

My approach was to preserve the original "logical" names as much as possible, and just change the navigation commands. They are the only commands that don't really make sense in Colemak.

I came up with the "NEST" navigation bindings which preserve the physical location of the up/down navigation keys (left/right are different but still on the home row):

N = down
E = up
S = left
T = right

The commands for setting this up are on my Colemak page at the bottom:

http://www.ryanheise.com/colemak/

Mostly, these bindings allow you to use a regular vim cheat sheet to learn the commands, except for navigation of course.

Of the 4 keys assigned in N-E-S-T, the "N" ("n"ext search result) and "E" (move "e"nd of current word) were frequent but gobbled up. I remapped them back to their original QWERTY positions and so they are the only two commands that don't have their original logical names.

Offline
  • 0
  • Reputation: 0
  • Registered: 18-Mar-2008
  • Posts: 19

The behavior in this is very different from vim, and in some ways, it is more intuitive (many similiar buttons grouped together) but as a vim user, it may be hard to adjust

Offline
  • 0
  • Reputation: 210
  • From: Viken, Norway
  • Registered: 13-Dec-2006
  • Posts: 5,343

Okay, having thought about this for a while I have a few things to say:

- My suggested mnemonic for Change on the W key: Warp.

- I suggest not taking people's familiar and logically placed Aa key from them (Ctrl-A can still do its' thing), but using Tt instead! New mnemonic for Visual mode: opTical mode. It makes sense to have the WARS keys next to each other for Warp/Append/Replace/Substitute, I think, since those are related keys. (Hey - I got to use my beloved WARS block for something!)

- The Ff lines below can be commented out, can't they?

" Search
"nnoremap f f|xnoremap f f|onoremap f f| 
"nnoremap F F|xnoremap F F|onoremap F F|

Now, the nav block again. I realized that it isn't only the block consistency that's hurting, but furthermore the word navigation consistency in Insert/Command mode - they should logically be on Ctrl-l/y like in the other modes but instead they get shoved to Ctrl-j/h since l/y are now used for the other nav block! This won't do, and we can do better!

I think that the Alt/Meta strategy should be possible, and the only price to pay might be either setting winaltkeys=no (thus being unable to select menus with Alt in Windows), or better - actually renaming a few menus! In GUI mode you'll see the menus' hotkeys anyway (at least, I do in Cream) so it shouldn't be a biggie at all. I'll need a way to actually do that change of menu hotkeys though. Any hints, short of me starting to edit program resources (which I believe I could pull off)? I realize that changing menus would be language specific as well, but that can't be helped. We'd just have to provide instructions and/or a few extra files. The simple way is turning off the winalt keys, but the more elegant way is renaming those menus.

The problematic menu hotkeys would be Edit and iNsert, and I suggest:
- eDit
- inSert (in consistency with the inSert command!)
- settinGs
I don't think those changes would be problematic for the great majority of users (I always look at the menus to see the shortcuts anyway). Correct me if I'm wrong.

Would the turbo nav mode be compatible with Alt/Meta in Insert/Command mode? If so, how should it be written into the .vim file?
inoremap <silent> <M-N> @='5<M-n>'<CR>|cnoremap <silent> <M-N> @='5<M-n>'<CR>|   ? Nope - didn't work
Or simply |inoremap <M-N> 5<M-n>|   ? Ditto
inoremap <silent> <M-N> @='5<Left>'<CR>  ? Nope
I'm at my wit's end for now, unfortunately.  :(

I don't think hitting the Alt key is uncomfortable at all. I just ease the left thumb from its' resting position over the Space bar which feels quite smooth to me.

Hope these suggestions make sense to you. Making this more consistent both with itself and with normal Vim makes a lot of sense to me, and could be instrumental to getting ColemakVim off the ground - just like ease of learning is instrumental to Colemak itself!

Last edited by DreymaR (11-Jun-2008 21:01:53)

*** Learn Colemak in 2–5 steps with Tarmak! ***
*** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

Offline
  • 0
  • Shai
  • Administrator
  • Reputation: 36
  • Registered: 11-Dec-2005
  • Posts: 423

You've convinced me on the Alt key, and I'm now rewriting Colemak.vim to take advantage of it.

The insert/append keys are designed so that they are on the strongest finger position, and in a logical relative position, especially when pressed with Shift, and 'A' is designed to be consistent so that the same key selects regardless of modifiers so it matches Ctrl+A.

Offline
  • 0
  • Reputation: 0
  • Registered: 08-Feb-2008
  • Posts: 20

I also very much like the current method: A for select and S/T for insert/append. I don't think of the letters anymore; only the keys' position under my "strong" fingers. How exactly will you take advantage of the Alt key, Shai?

Offline
  • 0
  • Reputation: 0
  • Registered: 07-Aug-2007
  • Posts: 69

The Alt key isn't immediately to the left (or the right) of the spacebar on all keyboards!  For both Apple and Sun keyboards, it is the *second* key away.   

Also, Macs use the Alt (aka Option) key for purposes that are not similar to Windows.  Option's primary function is for entering special symbols (accented letters and the like), and only then as something to add to other keyboard shortcuts for a very specific purpose: to do something immediately without bringing up an interactive menu (unless I'm misremembering -- the point is, Option is not often used and so doesn't really have an easy-reach position).

I find all modifier keys difficult to touch-type, perhaps even more so than the much-complained-about Escape key.   That's why I've always turned Caps Lock into Control (even if Colemak wants that location for Backspace).

Perhaps a useful exercise is to create vim nmaps that don't rely on *any* modifier key, including Control.  I mean, the attraction of vi(m) is that you use Control less frequently than a nonmodal editor, so why not avoid Control altogether?   For instance, I have gn<key> nmapped to <c-<key>> for most <key>s, and as a special case, gw nmapped to <c-w>, since the windowing commands are used so often.

Offline
  • 0
  • Reputation: 210
  • From: Viken, Norway
  • Registered: 13-Dec-2006
  • Posts: 5,343

Well, for the Insert mode you cannot really avoid control keys! Other functionality uses a slightly more emacs-like(?) and common system approach of letting control keys modify the strength of a function - which is an attractive approach for many (including myself) since it means having to learn/remember fewer base keys... and it feels logical.

I'd think that the Control key is precisely the one to use on a Mac.

*** Learn Colemak in 2–5 steps with Tarmak! ***
*** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

Offline
  • 0
  • Reputation: 0
  • Registered: 17-Apr-2007
  • Posts: 11

DreymaR: My mnemonic I've been using for 'w' is 'wipe'.  I'm amused by your 'warp', though.

Offline
  • 0
  • Reputation: 0
  • Registered: 18-Mar-2008
  • Posts: 19

my vim:
qwfrgseuy;
apdithjklo
bottom row is same as qwerty

Offline
  • 0
  • Reputation: 210
  • From: Viken, Norway
  • Registered: 13-Dec-2006
  • Posts: 5,343

Shai: Well allright, I won't make a fuss of the A vs. S/T issue. Instead, I'll try to think of some fun mnemonics for those.

a (Visual mode): Area mode (since a text area is being visualised and operated on; the word "area" is used in the Vim documentation)
s (Insert): inSert (as on the menu), or Stick [some text in]
t (Append): Tack [onto]
w (Change): Warp [WorldMaker: In my understanding, "wipe" means "delete" so I didn't quite take to that one]
p ('till): Push [against next instance]
k (next): Kiss [next instance; more intimate than Pushing against it]? [Although it's a sin, keeping the "next" mnemonic from the QWERTY location is tempting here...]
b (reverse find/'till): Backwards - or Bounce Back!

Using gK for "help" is a weak mapping I think; why not gh or something else that's easily mnemonicized? I also don't quite see why you couldn't use less uppercase with the g remaps and maybe make them more intuitive too: gz for Undo Line sounds logical to me for instance (or zz, like it is with dd and suchlike?).

Not sure if there's any other functions left out now? Is anything from the full Vim mappings missing in your remap? Any more changed keys that don't have a mnemonic?

It's probably because I'm a newbie, but it still feels a wee bit excessive to have separate commands for "enter Insert mode" and "enter Insert mode and make a space character". I can imagine it's convenient for the expert user though, so maybe in a year's time from now I'll fail to see how I could ever get by without both.  :)

Last edited by DreymaR (11-Jun-2008 21:04:49)

*** Learn Colemak in 2–5 steps with Tarmak! ***
*** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

Offline
  • 0
  • Reputation: 0
  • Registered: 07-Aug-2007
  • Posts: 69

I am surprised no one has mentioned this:  The trouble with colemak.vim is that it invalidates many things that :help says.  I guess one could distribute with the colemak.vim plugin some additional or optional code that modifies the vim help text so that the keys referred to in the help are not confusing or wrong for the plugin users.  But maybe that' s an icky thing to do, changing the document like that, even if it happens only for colemak.vim users.  But it would be much more usable than a separate document or cheat sheet.

Offline
  • 0
  • Shai
  • Administrator
  • Reputation: 36
  • Registered: 11-Dec-2005
  • Posts: 423
DreymaR said:

Now that you've decided to try out the Alt/Meta navigation, can we expect an updated colemak.vim file any time soon? I've started making edits in my copy of the Feb 08 version, and if a new one is coming out then I'd love to have it as soon as possible. (Then why do I keep making all these new suggestions all the time? Heh.)

It's not completely done yet, but I've uploaded a new version with the Alt/Meta navigation in insert mode (e.g. Alt-J/Alt-H for PageUp/PageDown don't work yet). Note that the Alt mapping may interfere with the AltGr characters.

DreymaR said:

It's probably because I'm a newbie, but it still feels a wee bit excessive to have separate commands for "enter Insert mode" and "enter Insert mode and make a space character". I can imagine it's convenient for the expert user though, so maybe in a year's time from now I'll fail to see how I could ever get by without both.  :)

The spacebar is frequently used for aligning, indenting,  etc. Spacebar is by far the most frequently used character, and it is more intuitive than than the previous mapping (which was move to the right). Since it's so common, it's much quicker to do it in one key, instead of entering insert mode, pressing spacebar, and then exiting insert mode each time. The same reasoning applies for the backspace and enter keys.

Offline
  • 0
  • Reputation: 210
  • From: Viken, Norway
  • Registered: 13-Dec-2006
  • Posts: 5,343

I had another thought: Why is the g key "extra commands" when it's hard to hit? It was easier to hit in QWERTY than it is here.

Swapping k (now the "next" command key) and g (still the "extra commands" key) will in my opinion achieve:
- the g (next) key is now in a block with the f (find) and p ('till) keys, and close to the b (reverse find/'till) key. Beautiful!
- a slightly easier way to hit "extra" (I think so, at least?)
- the mnemonics "kommands" for k, and "go to" for g.

(By the way: I think the "p" mnemonic could be (a)pproach!)

*** Learn Colemak in 2–5 steps with Tarmak! ***
*** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

Offline
  • 0
  • Shai
  • Administrator
  • Reputation: 36
  • Registered: 11-Dec-2005
  • Posts: 423

The G being hard to hit is probably a result of you left shifting the bottom row. I left the "find next" in the same QWERTY position, even though now the letter is changed. I kept the 'g' because a lot of obscure commands use it. In the same principle as Colemak, I try not to change infrequently used commands, because they take longer to learn.

Colemak.vim doesn't rely much on mnemonics, and uses finger positions. Putting too many similar commands in the same area makes easier to get confused. On Colemak.vim, the "search" commands are on the right hand, and the "find letter" commands are on the left hand.
Remember that the comma key has been left intentionally unmapped, so if there are certain commands you use often, you could map it to that.

Offline
  • 0