• You are not logged in.

Colemak + Vim

  • Started by Jules
  • 148 Replies:
  • Reputation: 0
  • Registered: 09-Oct-2009
  • Posts: 23

(Sorry for triple post but it's been a whole day.) (!)

On our previous discussion, about the @='' behaviour, i think i found something.

Asking on IRC, i learned about Vim's "patchlevel".

If you'd look at our version outputs again, you can see that you've got "Included patches: 1-22", whereas mine says 1-368. And currently it says 385 (automated upgrades).

This page tells about Vim patches: http://www.vim.org/patches.php
You can download the README, it has a list of patches and what they do; there's 411 patches at the moment.

Doing a quick search for '@', i find this:
``7.2.346  repeating a command with @: causes mapping to be applied twice''

I can't be entirely sure but it sounds like the cause of our (my?) issue.

I don't know how @= is actually meant to work (i.e. whose Vim behaves 'wrong'), but you might want to check for patches anyway.

``Common sense is nothing more than a deposit of prejudices laid down by the mind before you reach eighteen.''
~ Albert Einstein

Offline
  • 0
  • Reputation: 0
  • Registered: 09-Oct-2009
  • Posts: 23

I just had a nice idea, while mapping my pagers and stuff (lesskeys) to fit the colemak.vim keys.

If you map your pager (man (less)), browser, or some other file viewing program for u,n,e,i navigation, you'll realize that using the same finger for up and down movement gets really annoying.

So i've mapped n and e to down and up, respectively, and u and i to left and right, respectively. You might say it doesn't make sense, and that's right; but you'll just love n/e in file viewing software, where you scroll down/up all the time. It'll just need a bit of getting used to, while using Vim.
You might ask why n is down and e is up, and not the reverse, since e is on the right and right=down seems more intuitive. Well, it's the same reason the original vi used j for down and k for up, and not the reverse; going down is the primary movement while viewing a file. Older vi users will also like this because the exact locations of down/up are preserved now (and also right, but not left and that'll remain so).

The files i uploaded two posts ago don't reflect this change (i won't be touching that post anymore); you're free to modify them yourself.

Last edited by TaylanUB (03-Apr-2010 15:08:07)

``Common sense is nothing more than a deposit of prejudices laid down by the mind before you reach eighteen.''
~ Albert Einstein

Offline
  • 0
  • Reputation: 0
  • From: Switzerland
  • Registered: 10-Nov-2007
  • Posts: 16

For those who don't like to remap less: You can also use e and y to scroll one line down or up which is much easier to use with Colemak than the native j and k.

TaylanUB said:

So i've mapped n and e to down and up [...].

That's almost the same as my remapping for vi: n and p to move one line down (next) or up (previous).

TaylanUB said:

You might say it doesn't make sense, and that's right.

Concerning n (and e in your case), nothing else makes more sense to me. As you mention yourself, Colemak-n is Qwerty-j, the original key for scrolling/moving one line down.

See my post here for an overview of more alternatives for less, vi and others without or with the very minimal remapping I use.

edit: mention vi

Last edited by cisum (03-Apr-2010 18:05:34)
Offline
  • 0
  • Reputation: 210
  • From: Viken, Norway
  • Registered: 13-Dec-2006
  • Posts: 5,343

Usage statistics show that the Up key is used a lot less than the other arrows. Also, I consider the middle finger position on the top row as a "home row" position in practice. I don't find myself alternating a lot between Up and Down presses. Bottom line, I don't see any problem with an arrow cross myself and find it much more comfortable and intuitive than a linear mapping that you'll have to learn.

I wonder why an arrow cross could feel troublesome? Maybe TaylanUB alternates Up/Down keypresses a lot compared to me?

*** 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: 05-Jan-2010
  • Posts: 91
DreymaR said:

Usage statistics show that the Up key is used a lot less than the other arrows.

Yes. You usually begin in the top of documents, thus getting a slight edge of down key traversal. But that shouln't really count, if you ask me. It's just a stupid way to move down to where you're going to work.

Offline
  • 0
  • Reputation: 0
  • Registered: 09-Oct-2009
  • Posts: 23

While viewing a man page, a web page, or any other document that you won't modify, going down (first of all) and up are usually the only kind of navigation you'll do; i find having them on the same finger _really_ annoying. It immediately felt somewhat wrong when i started to use u,n,e,i navigation, though i thought i'd get used to it, but it got unbearable when i mapped those keys to the aforementioned file-viewing software. Maybe i scroll back up in pages more often than others. :P

Last edited by TaylanUB (06-Apr-2010 15:33:46)

``Common sense is nothing more than a deposit of prejudices laid down by the mind before you reach eighteen.''
~ Albert Einstein

Offline
  • 0
  • Reputation: 0
  • Registered: 05-Jan-2010
  • Posts: 91

When I'm reading man pages I use the thumb and middle finger to navigate down and up respectively. So same-finger is not really a factor.

Offline
  • 0
  • Reputation: 0
  • From: Montreal
  • Registered: 06-Aug-2010
  • Posts: 2

hi,
im a colemak newby and im trying to do a cheat sheet based on shai's colemak.vim and http://www.viemu.com/vi-vim-cheat-sheet-svg.zip
could anybody check it see what i missed ? I don't understand all the vi commands so ... :)
file is here http://rapidshare.com/files/411299145/v … olemak.svg could not think of anything else ...
thanks for the help

Offline
  • 0
  • Reputation: 0
  • From: Montreal
  • Registered: 06-Aug-2010
  • Posts: 2

welcome,
please tell me if you see anything wrong or anything to improve.
Btw, Anybody knows what are the terms for publishing this cheat sheet ? i did not find any licence information, so i dont know if i am allowed to modify and distribute it ?
Thanks,
Keru

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

Okay, now I feel silly for not sharing my own work-in-eternal-progress before. But here goes; pipe in if you think it could give you anything.

Colemak-Vim-helpsheet_unfinished.png

The main reason it wasn't finished is that I started spooling in another end and haven't finished that one yet...

*** 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: 01-Oct-2010
  • Posts: 3

I was waiting and waiting for somebody to create proper vector easily editable cheat sheet... and finally made one myself.

You can get inkscape svg vector drawing here:
www.smartcodehq.com/colemak/vim.svg.zip

Please note, it is temporary location, it would be nice if somebody can give it more permanent home.

It is great starting point for all remapping plans, I do like to see what gets affected before I change vim mappings.

You have vim-querty-original layout and vim-colemak-original layouts in there. It is easy to edit and change. All you need is inkscape: https://inkscape.org/

Let me SEE your layouts :) Still working on mine but I like really minimal changes, will probably have only navigation keys plus keys affected by remap changed.

All elements are grouped, just ungroup them for proper edit.

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

Are you saying that mine isn't proper, or isn't easily editable?  :)

Grats on your work there. I tried to use symbols a bit more because I like to make small printouts and it's hard to keep them easily readable then. Yours is probably better for people who don't understand all sorts of arcane symbolisms.  :)

*** 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: 01-Oct-2010
  • Posts: 3

It is proper but not easily editable lol :)

I tried editing original viemu gif initially but I gave up because of editing problems (shades, borders and symbols get easily messed up). Also prefer vector format because you can properly resize it to anything you need.

Anyway here is my minimal beauty:
g3BJl.png

I decided to use NEIO for navigating, this way U remains undo as cult of VI declared long time ago ;) Key functions are directly exchanged, except for J and E to keep Join and End word commands logical. Anything more than this would be... blasphemy :P

N <-> H
n <-> h
e <-> j
I <-> K
i <-> k
O <-> L
o <-> l

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

I'll have you know that mine is a proper Inkscape file as well, thus not harder to edit than yours methinks.  :)

I too, like being conservative. However, the desire to unlock the power of Vim in all its glory may have led me into... slight... blasphemy!

I do consider the entire navigation block consisting of 'JHLYUNEI' and the delete keys 'O:' very handy. I notice now that the version of my sheet I posted above is an unmodified one for the benefit of non-mappers, so the one I actually use is improved (in my eyes) from that. It's somewhat less drastic than Shai's mappings though.

In actual Vim use however, I don't carry around a printed helpsheet anymore. Instead, I type ':ars' to bring up a frame with an ASCII helpsheet I've made:

"+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+
"|~ Case    |! ExtFlt> |@ PlyMcr· |#  <-=    |$  ->|    |% GoMatch |^  <--    |& Rep :s  |*  =->    |( |<-Sent |) Sent->| |_ LastLin |+ Next<-- |
"|` Go Mk·  |1         |2         |3         |4         |5         |6         |7         |8         |9         |0  |<-    |- TopLine |= Format> |
"+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+
"|          |  Quit    |  WinNext |          |          |          |  =<PgUp> |  =<Home> |  =<Up>   |  =<End>  |          |  =<Esc>  |          |
"|  NextTab |  =<C-v>  |  WinCmd  |  GUIFind |  =<Up>   |  FileInf |  BOF     |   <--    |  ScrlUp  |   ->|    |          |  =<Esc>  |          |
"| <TAB>    |Q PlyMcrQ |W Warp->| |F <-Find· |P <-Prch· |G ScrMid  |J ScrTop  |L <-WORD  |U  5Up    |Y WORD->  |; z-Cmd·  |{ |<-Para |} Para->| |
"| <TAB>    |  RecMcr· |  Warp >  |  Find·-> |  Prch·-> |  g-Cmd·  |  PgUp    |  <-word  |    Up    |  word->  |: ExLine  |[ <-Misc· |] Misc·-> |
"+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+
" OmniMeta->|  AreaVis |          |          |  TabNext |          |  =<PgDn> |  =<Left> |  =<Dn>   |  =<Rght> |  =<CR>   |          |          |
" Ctrl----->|  AreaAll |  Redo    |  Save    |  TabNew  |  DelWord |  EOF     |  =<Dn>   |  ScrlDn  |  =<Tab>  |  JmpOldr |          |          |
" Shift---->|A AreaLin |R RepMode |S |<-Ins  |T Att->|  |D Del->|  |H ScrBot  |N 5Left   |E  5Dn    |I 5Right  |O OpenUp  |" SetReg· || GoCol1  |
" Normal--->|  Area    |  Replce· |  InSert  |  ATtach  |  Delete> |  PgDn    |   Left   |    Dn    |   Right  |  OpenDn  |' GoMk·|< |\ (usr)·  |
"           +----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+
"           |          |          |          |          |          |          |          |          |          |          |
"  Ctrl+:   |  Undo    |  ClpCtLn |  ClpCpLn |  ClipIns |          |  Digraph |  =<CR>   |          |          |          |    · = char arg.
"Up/Dn scrl |Z Redo    |X <-Cut   |C CopyLin |V <-Paste |B RevPpFf |K <-Next§ |M ScrMid  |< Unindt> |> Indent> |? <-Find§ |    > = move arg.
"PgUp/Dn HL |  Undo    |  Cut->   |  Copy >  |  Paste-> |  RepPpFf |  Next§-> |  Set Mk· |, (usr)·  |. Repeat  |/ Find§-> |
"           +----------+----------+----------+----------+----------+----------+----------+----------+----------+----------+
"
"Quick golemak.vim helpscreen - DreymaR, 0812                                                                                       [columns=149]
"
"Legend: |<- <-- ->| b/h/eol; Mk mark; Flt filter; Mcr macro; Reg register; = same/ident.; § pattern; Warp change; Area visual; 'Pr(oa)ch 'till.
"NB: Obviously, a sheet such as this cannot possibly cover everything. It's pretty much mode naïve and modes mean a lot, for instance.
"    One idea in colemak.vim is to make things more consistent over multiple modes (although you may have to use Meta/Alt in i/c mode!).
"Notes: Some keys (sUQK) are available as g-cmds. Ctrl-Shift-Up/Dn swaps lines. Use r(educed) for i(nner). A count may be used with - _ G |.
"Alt: Hit AND RELEASE the Alt/Meta key and then a letter for menu shortcuts. M-T Tab nav; M-W Win nav; M-R(eturn) Esc;
"
"Changes: M JHG jh ; X LY C-ly , C-[] C-q C-w () C-ue x_C-D abbrevs (he ed ars/sra). These changes relative to colemak.vim per 080421.
"Missing: C-t (tag stack; only for filetype help now)?, eE, sS (not necessary?), -_ (- taken from gg; swap-map gg to -?)
"Problem: Some C-mappings are "hard-coded" synonyms that cannot be remapped?! n_<C-i>=<Tab> (can be handy?); n_<C-m>=<Enter>; n_<C-p/n>=<Up>/<Dn>
"
" colemak.vim - redesigned mapping for the Colemak layout for Vim 7.0; 2008-04-21 Shai Coleman, https://colemak.com/ . Public domain. 
" golemak.vim - further tweaks (and some untweaks!); 2008-12-02 Øystein Bech "DreymaR" Gadmar, http://folk.uio.no/obech/ . Public domain.
"

typing ':sra' closes it again. Works like a charm for me, and it's even more easily editable than an Inkscape file!

I called my file 'golemak.vim'; here's how I add the help screen:

" For a Golemak help screen, type :ars and hit Enter (shows the top of this file!) - to close it (and other windows, unfortunately...) use :sra
" Show the colemak.vim helpscreen in a read-only window split (navigate with, e.g., C-w u/e and -/_).
" TODO: Find out how to identify the help window so you could close only that one afterwards?
cnoreabbrev <expr> ars (getcmdtype() . getcmdline() != ':ars' ? 'ars' : '19sview $VIM/golemak.vim\|wincmd w')
cnoreabbrev <expr> sra (getcmdtype() . getcmdline() != ':sra' ? 'sra' : 'wincmd o')

*** 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: 01-Oct-2010
  • Posts: 3

Ouch, should have asked and save myself from creating svg from scratch :)

Great helper, like it.

How do you solve remapping in external scripts, is there any other way than editing them directly? I am using NERDTree and minibuffexpl, had to edit them manually but I don't like the process. There must be a better way.

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

I don't use scripts like that. Other than that, my main experience is that it's very important which sequence the scripts get loaded in. If you make sure that your own remapping happens last, it'll take precedence and you can make provisions for what your other scripts need if you want to.

*** 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: 19-Dec-2008
  • Posts: 14

Could you share your mapping file please? I think that this is exactly what I need to start getting into vim.

Offline
  • 0
  • Reputation: 0
  • Registered: 21-Mar-2011
  • Posts: 11

I disliked Shai's mappings. I feel like it was specially designed to torture my hands (navigation... why so horrible) and certain keys I like have been clobbered or made more difficult.

Last edited by iamthebest (23-Mar-2011 12:33:49)
Offline
  • 0
  • Reputation: 0
  • Registered: 09-Oct-2009
  • Posts: 23

My Vim keymap can now at any time be viewed from GitHub:
https://github.com/TaylanUB/misc/blob/m … keymap.vim

``Common sense is nothing more than a deposit of prejudices laid down by the mind before you reach eighteen.''
~ Albert Einstein

Offline
  • 0
  • Reputation: 0
  • Registered: 14-Nov-2011
  • Posts: 1
LeoMaheo said:

I've remapped Colemak `j' `k' `h' (`l') (i.e. Qwerty YNHU) to perform the Vim `h' `j' `k' (`l') commands.  Thus, Qwerty H is up and N is down, which I find very convenient since Qwerty H is placed just above N, and both are easy to reach. Qwerty Y moves left, which I find adequate since Qwerty Y is just left of U, and U moves right. However, I find Qwerty Y hard to reach, but this is not an issue since Colemak remaps Backspace to Qwerty Caps-Lock, which also moves the cursor left, and Caps-Lock is easy to reach.

After much trial and error, I believe that LeoMaheo has the most pragmatic solution for colemak users. I recently switched to colemak and found out that it is easier to keep most of vim's mnemonics untouched rather than remapping half of the keyboard using "finger memory".

Offline
  • 0
  • Reputation: 23
  • From: Belgium
  • Registered: 26-Feb-2008
  • Posts: 480
skaczor said:

After much trial and error, I believe that LeoMaheo has the most pragmatic solution for colemak users. I recently switched to colemak and found out that it is easier to keep most of vim's mnemonics untouched rather than remapping half of the keyboard using "finger memory".

Same story here.  At work, I manage hundreds of Linux machines and therefor I prefer to use the standard mnemonics everywhere.  Same for mutt and other keyboard driven tools.  Apart from hjkl, most commands are fine.

Offline
  • 0
  • Reputation: 0
  • From: Switzerland
  • Registered: 10-Nov-2007
  • Posts: 16
ghen said:

Same story here.  At work, I manage hundreds of Linux machines and therefor I prefer to use the standard mnemonics everywhere.  Same for mutt and other keyboard driven tools.  Apart from hjkl, most commands are fine.

I can only repeat myself once again: When I am limited to a Vim without remapping or when there is only vi (vi does not support remap) then I use:

... moving direction
:  ... mnemonic to type for this move (key may be layout specific)
:  :
<  h (even the same key for Colemak as for qwerty)
>  Space (even the same key for Colemak as for qwerty)
^  Ctrl-p (same mnemonic as already for Emacs and others)
v  Ctrl-n (same mnemonic as already for Emacs and others)

For more about this and for a minimal Vim remapping see my post here:
https://forum.colemak.com/viewtopic.php?pid=1938#p1938

Offline
  • 0
  • Reputation: 0
  • Registered: 20-Jan-2012
  • Posts: 1

I'm considering making a switch from QWERTY to Colemak. I was previously into Dvorak but felt a bit put off by the positioning of the "L" key. As of now I'm also learning how to use vim and therefore made a reference card much alike the ones previously posted here. One difference though is that I don't even use half of all the finesses and features and hence opted for a less cluttered "newbmewd" (for the time being). My remapping is not as complex as the one by Shai since I try not to go too far from the defaults in case TSHTF and I find myself at the mercy of a vanilla vim. Suggestions, hints and corrections welcome.

SWITCH
------------------------
g <> G
h <> n
l <> o
N > H
j > e
O > L
w > O
W > I
t > w
T > W
i > t (mnemonic: "type")
I > T (mnemonic: "type")
k > i
b > N
B > E
========================
17 changes in total

4 unused keys (unbind or reassign):
jbBk

HLeE original functions lost:
(H) Screen top
(L) Screen bottom
(e) End word
(E) End WORD


MORE
------------------------
Add \\ as escape to normal mode (if comfy, evaluate)
Change zz to fold/unfold
Change ZZ to save
Change ZQ to quit


NEWBMEWD
------------------------
Unbind:
!@#$%^&*()-+
`0-=
QWFGJL{}|
qwfjl;[]
"
'
BM
bkm,

vim_colemak_reference.jpg
vim_colemak_reference_newbmewd.jpg

Offline
  • 0
  • Reputation: 0
  • Registered: 12-Nov-2007
  • Posts: 29

I tried to learn VIM with Shai's mapping, but found two issues: It differed radically from my learning material and keys that are common were in uncommon places (F and D are no longer on the home row).

What I'd like to do is only have Inert Mode in Colemak, but every other mode in Qwerty. I tried using:

noremap f e
noremap p r
etc.

...for all of the Qwerty keys that are different for Colemak. It worked quite well, but there's still some weird bits (<C-F> does not do page down)

Does anyone else use these settings? Any suggestions?

Kind regards
wussboy

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

@Wussboy: Remapping to physical QWERTY positions rather contradicts the idea of the different key mnemonics I think! Experienced vimmers seem to feel that they're "talking to the editor" because almost all the shortcuts have letter mnemonics. So "delete inner word" is 'diw' for instance. Sounds like a good principle and a good shot easier than learning a whole slew of physical positions!

I've cooled down on the massive remapping projects, too. It's just so frustrating to come to a machine without my .vimrc file on it and feel completely lost there! I'll be trying to learn the normal mappings instead, and use my lv5/extend navigation mappings to move around!

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

Offline
  • 0