On a Swedish keyboard the = character is obtained by pressing shift -
0 which is a bit troublesome when you want to use ctrl - = to change
buffer window size. Is there any key mappings for non us keyboards
available that is some what compatible with the us mappings (would be
nice to be able to use standard documentation on short cut keys)?
BRG Anders Olme
I have a Belgian AZERTY keyboard, which is also "non-US" but, from what you
say above, different from your Swedish keyboard. For me the equal key is very
easy to hit, it is the bottom-right key (just left of the right Shift key),
with no shift.
Method I:
If there is some easily-accessible key which you never use (let's say ø, the
Danish/Norwegian slashed o), you can map it to the equal sign using both
mappings below (:map for Normal and Visual modes, :map! for Insert and
Command-line modes):
:map ø =
:map! ø =
Method II:
If there isn't, you can make some accented letter present on your keyboard
(let's say ö, the German/Swedish/Finnish o-umlaut) do double-duty:
:set langmap+=ö=
This way, when in "text-input" mode, hitting ö gives ö; also for the
single-letter argument of the r command, when inputting a search string, etc.;
but when in "command" mode (when typing a Normal-mode command or an
Ex-command, but not the filename to an Ex-command), ö gives =
See ":help 'langmap'".
Method III:
Any character can be entered in Insert/Replace or Command-line modes by its
decimal, octal or hex code, see ":help i_CTRL-V_digit". This, however, does
not apply to Normal mode (as when using = to re-indent text).
As for Ctrl-= ... well, there is no Ctrl-= ; I don't know how you got the
impression that Ctrl-= is a Vim command to resize the window: no such command
is listed under ":help normal-index" or ":help insert-index".
The only "Ctrl+printable key" combinations which have a meaning are the following:
0x00 ^@ [Note]
0x01 ^A or ^a
0x02 ^B or ^b
0x03 ^C or ^c
0x04 ^D or ^d
0x05 ^E or ^e
0x06 ^F or ^f
0x07 ^G or ^g
0x08 ^H or ^h
0x09 ^I or ^i
0x0A ^J or ^j [Note]
0x0B ^K or ^k
0x0C ^L or ^l
0x0D ^M or ^m
0x0E ^N or ^n
0x0F ^O or ^o
0x10 ^P or ^p
0x11 ^Q or ^q
0x12 ^R or ^r
0x13 ^S or ^s
0x14 ^T or ^t
0x15 ^U or ^u
0x16 ^V or ^v
0x17 ^W or ^w
0x18 ^X or ^x
0x19 ^Y or ^y
0x1A ^Z or ^z
0x1B ^[ (Ctrl-OpenBracket)
0x1C ^\ (Ctrl-Backslash)
0x1D ^] (Ctrl-CloseBracket)
0x1E ^^ (Ctrl-Circumflex)
0x1F ^_ (Ctrl-Underscore)
0x7F ^? (Ctrl-QuestionMark)
Note: Vim uses 0x0A to represent null bytes internally, so Ctrl-J and Ctrl-@
often have the same effect.
Best regards,
Tony.
--
Alliance, n.:
In international politics, the union of two thieves who have
their hands so deeply inserted in each other's pocket that they cannot
separately plunder a third.
-- Ambrose Bierce, "The Devil's Dictionary"
Thank you for the answer guess I will have to remap the key then (even
thou I prefer not to change mappings since you have to do it on every
machine).
I believe that ctrl-= is used in window resizing:
"CTRL-W = Make all windows (almost) equally high and wide, but use
'winheight' and 'winwidth' for the current window." <http://
vimdoc.sourceforge.net/htmldoc/windows.html#window> section 6.
But maybe there is a better way of doing it?
Best regards Anders Olme
If you had read attentively what you quoted above, you would have noticed that
the command is not Ctrl-= (which doesn't exist) but Ctrl-W followed by =
i.e.
Press and hold Ctrl
Press and release w
Release Ctrl
Press and release =
Best regards,
Tony.
--
The buffalo isn't as dangerous as everyone makes him out to be.
Statistics prove that in the United States more Americans are killed in
automobile accidents than are killed by buffalo.
-- Art Buchwald
P.S. If you write the appropriate mappings (and other settings, if any) into
the file _vimrc or .vimrc in your Home folder, you can just copy the vimrc
(and your [._]gvimrc, if any, any user-written scripts in $VIM/vimfiles and/or
(~/.vim or ~/vimfiles)) from one machine to the next. If you want it to work
on both Windows and Linux, or on versions of Vim with different features
compiled-in, you may have to wrap some sections in an ":if has(...)" or ":if
exists(...)" but it is feasible.
Best regards,
Tony.
--
Newton's Little-Known Seventh Law:
A bird in the hand is safer than one overhead.
Ahh didn't realize that :) my brain filtered away that W ( has to
excuse me with that English is not my first language).
BRG Anders Olme
:-) Neither is it mine; but that's all the more reason to read attentively.
Best regards,
Tony.
--
All the taxes paid over a lifetime by the average American are spent by
the government in less than a second.
-- Jim Fiebig
I highly recommend you optimize your keyboard layout based on what you
type most often. For example, I doubt you type "senor" (with a tilde on
the n) very often, right? So, why have it as a dead key? Smiilarly, you
tend to type / a lot (if you live in UN*X land), so why have it at
Shift-7? And a lot more.
My keyboard layout (notice that you can do the non-alpha optimizations
even on a regular QWERTY.se keyboard):
* http://svnbox.mine.nu/stuff/keymap/normal-large.png
* http://svnbox.mine.nu/stuff/keymap/shift-large.png
* http://svnbox.mine.nu/stuff/keymap/altgr-large.png
My .vimrc with some modified key mappings (most most notably, C-Space
mapped to C-] - jump to tag, impossible to type for us):
* http://mikael.jansson.be/hacking/vim/vimrc
-- Mikael