Is there a way to change the keyboard layout in Vim on Windows? - windows

I am working on several documents where I have to type [ ] { and the like (which is much easier with with an american keyboard layout (and to which I am used much more)) but where I also have to type Umlauts such as ä, ö and ü.
Usually, I go be setting up the (what I believe to be a standard) Windows Shortcut Alt+Shift to switch between these layouts.
This is unpractical, because at times I am not sure if I am already in the german layout when I need the german layout (and vice versa).
So, is there a better way to change the keyboard layout in Vim on *OS-level"?
I guess it could be solved with changed :map and :imap but I'd rather not use these for such porposes unless really forced to.

I don't think there is such an option - even though vim can even make pancake for you!
It'd be highly unlikely for any program to allow changing the keyboard layout of regular keys since basically any OS already supports it.

I am not sure if I am already in the german layout when I need the german layout
Do you have the language bar enabled? It should have an icon that represents your current settings.
Microsoft Knowledgebase article: HOW TO: Use the Language Bar in Windows XP

If the only thing that you need is to add umlauts easily, Vim has built-in support for adding these characters:
Method 1. In insert mode type: CTRL-K a: to give ä.
Method 2. If you use :set digraph you can enter a<BS>: to give the same result.
These methods will work with any character that needs umlauts, just use CTRL+K o: or CTRL+K u: respectively.
Source: http://vim.wikia.com/wiki/Entering_special_characters

Maybe you could be interested in some Dvorak layouts (mine is bépo, maybe it could suit you?)

Related

What software program can I use to build a custom desktop keyboard IME for MacOS?

I would like to make my own version of Mac's ABC-Extended keyboard for typing Pinyin (a way to write Mandarin that indicates tones). But when I use Xcode, I just see a target custom keyboard extension for iOS and nothing for macOS. I've looked into the program Ukulele but it doesn't seem like it will do everything I need. Theoretically I could also put my rules into files like how this article indicates but that also seems cumbersome based on what I want my keyboard to do.
Here's what I want it to do:
First option: user literally types "ni3 hao3" and my logic in real time changes their output to "nǐ hǎo" (there are pinyin/grammar rules for where the tone mark goes)
Secondly (phase 2 in my project), in their user settings for the keyboard, they could indicate they want to convert their text to Hanzi (the characters). So when they type their Pinyin, my algorithm guesses a best guess list of Hanzi characters that matches their Pinyin entry. This would require that I have a downloaded dictionary file for my keyboard.
Thanks for any help! I know how to program it I just need the right software to use :(

Prefered keystroke for ending NSTextView edit

Is there prefered keystroke for ending edit of an NSTextVIew? Obvious candidates are ESCape and Return with modifier key. I'd like this to be fairly intuitive and easy to type. Of course for people raised on Vim, Escape is the obvious choice.
Since I mentioned Vim, I thought I'd add my emacsish version:
For emacs I guess it might be C-x C-S. I would find this more convenient typing than ESC. But what would be the cocoa way?
Command+return is quite common for confirming multi-line input (this is used for example in Apple's iWork when editing a text frame).
In standard Cocoa text views, Esc triggers auto-completion suggestions (when applicable).
tab is the most popular to switch between different textfields and textviews and is considered as end of editing.
Also you can use any combination as per your likings, e.g. cmd+enter etc to move out of the textView.
But no to esc, it sends as something you are cancelling. However this is used in CUI as vim, but surely not in GUI for OSX and even for Windows.

Translating shortcut keys

When extracting strings from a desktop Windows application for translation, should I translate shortcut keys as well?
In other words, should Ctrl-C copy to the clipboard even for Chinese software?
Yes, CTRL-C is universal. You can safely assume that typical CTRL-something shortcuts behave the same in all (modern) Windows versions, regardless of the language.
However, there might be several ways to present them depending on the language. For example, French would translate the name of the key (the combination remains the same).
But you are asking about Chinese (presumably Simplified Chinese), which will simply display it as CTRL-C. After all, the keyboard layout is the same (with the same symbols), all they do differently is they use so-called Input Method Editors. And although there are several different IMEs, I haven't yet seen the one that would override CTRL-C...

OSX Option/Alt as Meta: Is there a way to port or use emulate-mac-keyboard-mode in standard Emacs 24?

Emacs 24.1 was just released, and I once again feel inclined to use the "real" Emacs (Cocoa GUI version, from http://emacsformacosx.com) instead of Aquamacs. The only thing keeping me in Aquamacs is this:
In AquamacsEmacs, Option (Alt) is mapped to Meta - however, because
Option is used to input a lot of non-ASCII characters such as ü or £
on a variety of keyboards, the special character input methods take
precedence by default. You can deselect “Option key produces only
special characters” in the Options menu to use Option as Meta, or you
set the variable mac-command-modifier to ‘meta - you will lose
functionality, of course. If you use a non-English keybboard layout,
the emulation modes might be just what you want. While they leave the
Option key mapped to Meta, they will allow you to input many common
characters ([,],{,},\, etc.) directly with the Option key, just as you
would otherwise. You can find them in the Options → Option Key menu -
or use, e.g., M-x emulate-mac-german-keyboard-mode.
This question speaks about the same issue, and one of the answers is "use Aquamacs".
So in Aquamacs, I can use Option key as Meta and everything is fine, I can type e.g. [ with option(alt)-8 and still use alt as meta when I add this into my .emacs:
(setq emulate-mac-finnish-keyboard-mode t)
But is there any way to use this feature in Emacs 24? Has anyone ever tried porting emulate-mac-‌​keyboard-mode.el to standard Emacs?
And no, cmd as meta is not an option for me.
Has anyone ever tried porting emulate-mac-‌​keyboard-mode.el to
standard Emacs?
I haven't tested it, but this answer to the question you linked claims to have done just that.
I am not using Emacs but when I tried to remap certain keys for VIM I had some wired trouble. I finally found out that these issues were caused by Terminal.app as it somehow did not pass through some key events. I then switched to iTerm2 which also had some additional features, e.g. X11 mouse events without need for plugins.
I use EmacsForMacosx. This claims to be pure gnu emacs.
The options you are asking for are easily available through customize-group ns
(from what I know the naming comes from NextStep which kinda was a precessor of OSX)
personally I set the fn key to meta as I hardly use it within emacs. And keep alt as used by mac. You can also set left and right alternate to different functions - like for german on windows keyboards.

Is ctrl-s save universal for save or are there different combinations for different languages

I imagine that there are different combination, just looking for an affirmation. Or, are we developers really that english-centric?
If I were in Japan, using a word processor on some computer, would Ctrl + S save?
Are there keyboards where Ctrl + S doesn't even exist (non-english keyboards)? Most of what I've seen usually has latin + [insert language here] characters, usually overridden on the normal qwerty keyboard.
It depends.
If the application's UI is in English, most people will expect CTRL + S to save.
If you're writing an application that is going to be translatable, you probably want also the shortcuts to be translatable. Shortcut standard varies between languages and countries. Leave this to the translator.
Yes, Ctrl- and Alt- are usually passed on verbatim and not subject to IME processing—assuming one is using an IME; I don't know about IME-less JP input methods. But in the basic case where an IME is used, Ctrl-S remains Ctrl-S, it does not become Ctrl-す or something.
Furthermore, menu entries often have a Latin accelerator defined - cf. http://www.marsei.net/tec/tecladoEspWindows.jpeg :
addmenuentry(m, "ファイル(&F)");
Just tried on my Mac by setting Spanish as my default language. None of the programs I opened used different shortcuts in Spanish than English, although the menu text was all translated. TextEdit was the main program I used to test.
I also tried setting my keyboard to the Dvorak layout (very different layout, still meant for English), Spanish layout (still QWERTY), and French (a & q, z & w, m & , & ; swapped). Even though the French keyboard had the q in a different place, the shortcut was still CMD-Q.
So, it seems the convention on Mac OS X is to have the shortcuts always use the same letters.
However, according to this link, in Spain CTRL-G(uardar) is normally the shortcut for saving: http://www.ixda.org/node/18527.
Here's an argument for basing the shortcuts on the position of the key on the keyboard, but I'd be surprised if anyone actually does that. http://blog.i18n.ro/are-we-supposed-to-localize-keyboard-shortcuts/
In Visual Studio, CTRL + S saves the document. In MS Office it's the same if it's in English, otherwise if it's in Italian, CTRL + S underlines the text, while SHIFT + something saves the document. I have no idea why they did this, but it might also apply to other applications and languages.
It depends on what you want to write. if you want to write a program and want to publish it everywhere, you should decide if you want it to write in only one language or in lots of languages. If you only want to write it in English, every one that wants to use it should change his/her system language to English or at least should support English. In that way Ctrl + S will do what you want.

Resources