• You are not logged in.
  • Index
  • Technical
  • Swe-Colemak + Shai-Vim-Mapping = Some things in Vim not working

    Swe-Colemak + Shai-Vim-Mapping = Some things in Vim not working

    • Started by linduxed
    • 7 Replies:
    • Reputation: 0
    • Registered: 23-Sep-2008
    • Posts: 4

    I recently switched to Colemak from the swedish QWERTY and while I'm nowhere near my past speeds, I do see it coming and I really think colemak is a healthy addition to the extensive computing I'm forced to. Thanks Shai!

    Now while I love the Vim mappings given here a thing or two don't seem to work correctly.

    For reference, here's my xmodmap file:

    ! Q W F P G   J L U Y Ö Å ¨
    !  A R S T D   H N E I O Ä '
    ! < Z X C V B   K M , . -
    
    !keycode   9 = Escape Escape
    !keycode  10 = 1 exclam
    !keycode  11 = 2 quotedbl at
    !keycode  12 = 3 numbersign sterling
    !keycode  13 = 4 currency dollar
    !keycode  14 = 5 percent
    !keycode  15 = 6 ampersand
    !keycode  16 = 7 slash braceleft
    !keycode  17 = 8 parenleft bracketleft
    !keycode  18 = 9 parenright bracketright
    !keycode  19 = 0 equal braceright
    !keycode  20 = plus question backslash
    !keycode  21 = dead_acute dead_grave
    !keycode  22 = BackSpace Terminate_Server
    !keycode  23 = Tab Tab
    keycode  24 = q Q
    keycode  25 = w W
    keycode  26 = f F
    keycode  27 = p P
    keycode  28 = g G
    keycode  29 = j J
    keycode  30 = l L
    keycode  31 = u U
    keycode  32 = y Y
    keycode  33 = odiaeresis Odiaeresis
    keycode  34 = aring Aring
    !keycode  35 = diaeresis asciicircum dead_tilde
    !keycode  36 = Return
    !keycode  37 = Control_L
    keycode  38 = a A
    keycode  39 = r R
    keycode  40 = s S
    keycode  41 = t T
    keycode  42 = d D
    keycode  43 = h H
    keycode  44 = n N
    keycode  45 = e E EuroSign
    keycode  46 = i I
    keycode  47 = o O
    keycode  48 = adiaeresis Adiaeresis
    !keycode  49 = section onehalf
    !keycode  50 = Shift_L
    !keycode  51 = apostrophe asterisk
    keycode  52 = z Z
    keycode  53 = x X
    keycode  54 = c C
    keycode  55 = v V
    keycode  56 = b B
    keycode  57 = k K
    keycode  58 = m M
    !keycode  59 = comma semicolon
    !keycode  60 = period colon
    !keycode  61 = minus underscore
    !keycode  62 = Shift_R
    !keycode  63 = KP_Multiply
    !keycode  64 = Alt_L
    !keycode  65 = space
    !keycode  66 = Caps_Lock
    !keycode  67 = F1 XF86_Switch_VT_1
    !keycode  68 = F2 XF86_Switch_VT_2
    !keycode  69 = F3 XF86_Switch_VT_3
    !keycode  70 = F4 XF86_Switch_VT_4
    !keycode  71 = F5 XF86_Switch_VT_5
    !keycode  72 = F6 XF86_Switch_VT_6
    !keycode  73 = F7 XF86_Switch_VT_7
    !keycode  74 = F8 XF86_Switch_VT_8
    !keycode  75 = F9 XF86_Switch_VT_9
    !keycode  76 = F10 XF86_Switch_VT_10
    !keycode  77 = Num_Lock
    !keycode  78 = Scroll_Lock
    !keycode  79 = KP_Home KP_7
    !keycode  80 = KP_Up KP_8
    !keycode  81 = KP_Prior KP_9
    !keycode  82 = KP_Subtract
    !keycode  83 = KP_Left KP_4
    !keycode  84 = KP_Begin KP_5
    !keycode  85 = KP_Right KP_6
    !keycode  86 = KP_Add
    !keycode  87 = KP_End KP_1
    !keycode  88 = KP_Down KP_2
    !keycode  89 = KP_Next KP_3
    !keycode  90 = KP_Insert KP_0
    !keycode  91 = KP_Delete KP_Decimal
    !keycode  94 = less greater bar
    !keycode  95 = F11 XF86_Switch_VT_11
    !keycode  96 = F12 XF86_Switch_VT_12
    !keycode  97 = Home
    !keycode  98 = Up
    !keycode  99 = Prior
    !keycode 100 = Left
    !keycode 102 = Right
    !keycode 103 = End
    !keycode 104 = Down
    !keycode 105 = Next
    !keycode 106 = Insert
    !keycode 107 = Delete
    !keycode 108 = KP_Enter
    !keycode 109 = Control_R
    !keycode 110 = Pause Break
    !keycode 111 = Print Execute
    !keycode 112 = KP_Divide
    !keycode 113 = Mode_switch
    !keycode 115 = Super_L
    !keycode 116 = Super_R
    !keycode 117 = Menu

    First of all, the "Å" key (keycode 34) doesn't type "Å" in Insert mode. Instead, it returns me to Command and does whatever the corresponding key on English layouts would do (i think it's the "]" character).
    Secondly, when I attempt the Ctrl+UNEI navigation in Insert, each of the combinations fail to navigate (all kinds of other stuff happens).

    These are the ones I find for now. I'll update if something new pops up.
    I was also curious why the tab switching in the "without-the-g-in-front"-vim doesn't work when adding and closing tabs is working well. With the switching I'll have all i need from gVim and wont have to consider installing it.

    Thanks in advance!

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

    Tja!  ;)

    First, let me advertise my new way of doing things: Going with the standard Colemak layout! I think it's a LOT better for coding and also better for normal writing than the silly Scandinavian layouts. Furthermore, you're less likely to run into trouble with less-than-perfectly programmed web apps and whatnot that far too often fail to account for differences in layouts (for instance, demanding a character that sits on an AltGr mapping in Scandinavia but not recognizing AltGr mappings!) It only took me a few days to catch up to speed too, maybe somewhat surprisingly. It could be because I've been thinking a lot about the US layout beforehand.

    The æøå/äöå I put on AltGr \][ (in that sequence) and for me it works very well. I think I use the square brackets more than the øå anyway! More than 95% of my typing is in English these days. If I needed to, I'd make an extra layout where the \][ are on AltGr instead and use a hotkey to switch between those two.

    Ah well, enough advertisement and on to your problem. Sounds a lot like what I was experiencing! I think it works well for me now though, so carefully check the following:
    - Are you running Vim v7.2 (or higher)? Not sure whether it's significant, but could be.
    - Maybe try using a 'mapc' command in your vimrc before you load up on colemak.vim and other mappings you may use. Again, not sure but I use that to make sure.
    - The most important thing is to consider the sequence in which you run map files! Turns out I was running mswin.vim after colemak.vim mappings which caused big trouble.

    It does sound as if a variant of the latter could be your problem too. In mswin.vim the C-Y is for instance remapped to Redo which conflicts with word navigation, and C-Tab does something too which made me unable to switch tabs with C-Tab (but C-S-Tab worked for me) until I fixed the load sequence.

    Another thing you need to check is whether your vim has a keyboard layout set. I don't personally see why vim should bother itself with keyboard layouts at all since that ought to be OS business, but it does and if it does in your case then things might get corny. (Then again, it couldn't really be set to a QWERTY layout because you'd notice that while typing!)

    The only other thing I could think of is whether you remap at the right level. I'm not that versed in matters Linux, but maybe you map only one of what is called the ScanCode and VirtualKey levels in Windows for instance? That might make Vim unable to see the right mappings.

    *** 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: 23-Sep-2008
    • Posts: 4

    Since I've always thought that the Scandinavian placement of symbols is universally flawed, I gladly made the switch to the original layout. The problems however persisted.

    I've noticed it has got to do with the colemak.vim mapping file; said problems occur regardless of keymap if colemak.vim is loaded but disappear when it's not.

    Since i don't understand the .vim file language is there someone who could have a look in the file to determine the conflict?
    Also I can't find a file where the maps you mention are stored.

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

    Ah - first observation upon closer examination of your original post: You cannot used Ctrl+UNEI in Insert mode! That's actually quite correct! There's a problem with Vim that made this mapping inconvenient/impossible but the mappings Meta+UNEI (and Meta+Shift+UNEI) should work in both Insert and Visual mode.

    The tab switching bit is still tricky. Does Shift-Ctrl-Tab (backwards tab flipping) work for you and Ctrl-Tab not, or are both dysfunctional?

    Sorry I cannot help with the å key - sounds like a glitch between the OS and Vim. As a workaround for now, you could use the Ctrl-k digraph (CTRL-K then 'aa') until someone can help you. Or you could try using a different key for the mapping (standard Colemak has it on AltGr+Ww). In my experience, some of the right-hand keys can be tricky.

    [Edit: I've found what could be the problem. Indeed, there are several difficult keys in Vim and the problem seems to be that some keys become "synonym keys" to others. For instance, Ctrl-I is a synonym to <TAB>; that can actually be useful if your left pinky likes to stretch downwards but not upwards. But it makes remappings involving Ctrl-I impossible as this isn't a mapping but something at a deeper, "hardcoded" level in (G)Vim. Bah. So it turned out that in my GVim also I get an arrow key instead of the å ... but I don't think it's really colemak.vim-related? Maybe I need to study it further.]

    A couple of tips from the colemak.vim file:
    - There are two lines near the top that should be uncommented (or run in your vimrc file) when running under linux:
    " $ export TERM=xterm    # make Backspace and Ctrl-H work correctly
    " $ stty -ixon -ixoff    # make Ctrl+S and Ctrl+Q work correctly

    - Try commenting the following line, or uncommenting it if it's commented:
    "if has("gui_running") | source $VIMRUNTIME/mswin.vim | endif
    (That may mess up the way you like your mouse to work and more, so maybe you'll want to issue a 'behave unix' and something else afterwards.)

    - I'd recommend uncommenting the following lines at least (although it's a very long shot that they should help you with these problems!):
    "set ignorecase        " ignore case
    "set smartcase        " ignore case when the pattern contains lowercase letters only
    "set showtabline=2    " always show tab page labels

    Last edited by DreymaR (25-Sep-2008 17:35:45)

    *** 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: 23-Sep-2008
    • Posts: 4

    Nice to know that Meta+UNEI works. The only problem is that I don't have a Meta-key, the Alt-key doesn't seem to be mapped as Meta either so I don't see any help in the Meta solution (the Emacs ESC solution doesn't work either...and then I would never use that).

    Both tab-switching commands are dysfunctional.

    Thanks for the digraph tip, however as stated å works well when I don't load colemak.vim.

    The following uncomments didn't affect my problems in any way.

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

    The Alt key is the Meta key; I was just trying to be "Unixy" with you.  ;)

    The rest sounds like you've either got something running after the colemak.vim script after all (in some rc file maybe?), use a script that's incompatible with colemak.vim (the only known such being matchit.vim - but you could've found another?) or something's fishy deep down in your Linux settings that I wouldn't have a clue about. So I guess I can't help you anymore I'm afraid, and hope someone else steps up to the plate.

    *** 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: 23-Oct-2009
    • Posts: 5

    This row screws it up on macos X.

    inoremap <M-e> <Down>|cnoremap <M-e> <Down>|

    Why i don't know but removing it then it works.

    Last edited by Mazon (11-Nov-2012 12:09:45)
    Offline
    • 0
    • Reputation: 211
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,345

    These days I recommend using Caps instead of Meta (see my sig topic, Extend section). I found it very very difficult to integrate the Shai remappings without breaking something I'd end up missing or ending up with inconsistencies - but they live on as truly Omnimode and even Omniapp key mappings with the Extend layer!

    Last edited by DreymaR (11-Nov-2012 12:21:46)

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

    Offline
    • 0
      • Index
      • Technical
      • Swe-Colemak + Shai-Vim-Mapping = Some things in Vim not working