I am trying to override Control-Meta-Down Arrow and Control-Meta-Up Arrow in emacs.
I've tried all sorts of combinations of: (global-set-key [C-M-down] 'function) and: "\C-\M-<down>" etc... but it always says: ESC undefined. This means it is only taking into account the M-<down>. Why is it ignoring the Control?? I've been working on this for 3 hours and emacs online documentation with regards to key bindings is surprisingly absolutely terrible.
When using Emacs in the terminal (which you mentioned in a comment), you are limited to the key sequences that the terminal is capable of. Unfortunately, C-down is not one of them...
Some versions of Emacs on Mac OS X have had problems with the qualifier keys. Try to update it to a newer version.
I tested this on an Emacs built from the source archive, and it works as intended. (In this case, it simply says that function is not defined, which is what expected.)
Related
Good evening,
I have a problem using Emacs in Terminal.app the last 9 hours but wasn't able to solve it on my own.
The workarounds I have found on Stackoverflow etc. didn't persuade me.
I didn't want to use the Option 'Wahltaste als Metataste verwenden' (alt/option as meta), because I have to type for example {}[] with my alt-key. Keybinding of these Charakters in Emacs is no solution for me, because outside of Emacs in nano I want to use []{}..., too.
I also didn't want to use iTerm2.app, I think it should be possible in Terminal too.
Because sometimes I use Emacs over SSH, it is not possible to choose an GUI-based Emacs either.
A possibilty I would accept is to use the left alt/option key for meta and the right one for typing []{}... Or the Fn-Key for meta...
But I wasn't able to do it the last 9 hours...
I already ported 'emulate-mac-keybord-mode.el' from Aquamacs, but I didn't get it work as expected.
Does anybody have an idea?
Thanks in advance,
Zappel
If you insist on a TTY Emacs within Terminal.app, you may probably have some success with kernel level remappings of modifier keys, using KeyRemap4MacBook. I do not know, because I never used it for such things, and since the key codes, Terminal.app sends to the TTY process when a modifier is pressed, are ultimately hard-coded in Terminal.app, this is neither easy nor particularly pretty.
iTerm2 probably provides means to customize modifiers individually, and is generally a superior terminal emulator (with the notable exception of color management), but frankly, do yourself a favor, and use a GUI Emacs.
A GUI Emacs provides a much nicer expierence on OS X. You are not only able to map each modifier key individually with mac-option-modifier and friends, you also more modifiers available, namely Super and Hyper.
For instance, the following setting uses the Command keys as Meta, the function key has Hyper, and keeps the Option keys for OS X, so that you can still use the alternate layout level:
(setq mac-option-modifier 'none
mac-command-modifier 'meta
mac-function-modifier 'hyper)
To edit files on remote systems, you'd just use Tramp then.
I recently got a mac. I was previously working on a laptop with ubuntu and I was using vim.
I now will discuss about vim in console (iTerm2 or the default terminal) and macvim.
The problem is that some binding don't work under mac. For example I had CTRL left/right for navigating between splits, CTRL up/down to move lines or blocks of code up and down, etc. They don't work anymore.
I had a bunch of plugins (nerdtree, powerline, etc.) that now look weird. Powerline doesn't display special characters in macvim and in terminal they are question marks.
In console, nerdtree looks weird and it doesn't display the special triangle character. If I hit return to open a file selected from nerdtree, it doesn't do anything. In macvim, it works ok.
Is there any guide on how to use vim on mac? Or what is the recommended way?
Nerdtree : let g:NERDTreeDirArrows=0
Powerline : Take a look at the part of strange characters in the document https://github.com/Lokaltog/vim-powerline
Navigating within splits with Ctrl + arrows work on mine. Can you post your vimrc, or try running vim without any configuration.
Ctrl+arrows to move lines and block doesn't work on mine.
Did you check which key was sent by your terminal to vim ?
Did you tried to set it manually ?
I had similar problems with emacs, including one keybinding I'm still not able to reproduce :(
I have the exact same config on my Mac and a Windows box at work, my Ubuntu box at home and a couple of VPSes. It works exactly the same on every platform in GVim/MacVim or in plain Vim.
Unfortunately I don't use either NERDTree nor Powerline but Vdt's answer seems to have all the info needed.
Some of the behaviors you describe are custom mappings. You should show us your ~/.vimrc (the old one on linux and the new one on the Mac, if there are differences) so that we can help you make it more portable.
Also, "looks weird" means nothing: please add a screenshot or two.
When I am running Emacs (in GUI mode) in GNOME, the meta key works fine i.e. alt-v jumps back one page.
But when I remove the line: "gnome-enable" from rc.conf and reboot FreeBSD then alt-v does not work in Emacs (although ctrl-v works). Doing alt-v in Emacs without GNOME simply prints v at the cursor. Yea... i can of course use esc as the meta key... but I would really love to use the alt / option key of my MacBook as the meta key.
I am running FreeBSD 8.1 on a MacBook.
Please help.
Thanks.
http://www.emacswiki.org/emacs/MetaKeyProblems goes into all (or most) of the ways that this can go wrong, and how to fix them. I don't have a gnome-enable locally, but I imagine that one of the things it does is (setq x-alt-keysym 'meta).
I'm trying to use the new iTerm app on my Snow Leopard Mac, but my Ctrl seems to be completely dead (as in non-responsive, as in nothing happens when I type Ctrl+a except for an outputed 'a') and I haven't found anything useful while googling. The closest match was this thread here on stackoverflow, but everything in Terminal.app works as it should.
And, even more strange - I can Ctrl+z myself out of applications, but I can't save files in Emacs (C-x C-s) or any other keyboard shortcuts that uses a Ctrl shortcut. And it's not local, since Ctrl is as broken on my iMac as it is on other unix computers I've sshed onto with iTerm. I've tried both in bash and zsh.
I've tried to remove all files concerning iTerm.app in my ~/Library/Application Support, and I've tried the very latest version (currently 13 h old) of iTerm I could lay my hands on, but to no avail.
Any ideas?
This seems to be an iTerm bug.
You can work around it by creating a key mapping in the profile settings.
Add a mapping for ^x so it sends 0x18 (which is the encoded form of ctrl+x).
I suggest to check this post to see if the ctrl key is enabled in your preferences
https://apple.stackexchange.com/questions/52041/how-to-press-control-key-on-mac
Did you try to configure key bindings for this terminal emulator as specified in the iTerm wiki:
http://code.google.com/p/iterm2/wiki/Keybindings
at last, have you try set -o emacs or set -o vi?
If it works, set it in your ~/.bashrc to run it at login.
I am trying to learn Emacs and trying to find best keyboard layout for me. One thing is really annoying me. I have added following lines to .emacs
(global-set-key "\C-y" 'scroll-up)
(global-set-key "\M-y" 'scroll-down)
When I hold Control and press y a few times, it will page down on every press of y.
However, when I hold the Windows key (mapped as Meta) and press y a few times it will only page up on the first press of y and all subsequent presses of y I get the ‘y’ character inserted in the buffer.
Can the page up behave like page down? I want to hold Meta and keep pressing y to scroll multiple pages up.
I am using GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600) of 2008-05-12 on LENNART-69DE564 (patched). It is Emacs with EmacsW32 patch. Is this problem with this Emacs? Problem with Meta key?
I tried original GNU Emacs (not patched) and it works OK with Alt. But my problem is not that I want to scroll without releasing any key. I release key y and press it multiple times but don't want to have to release Meta key. Same problem is described here:
http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/f30f4b75a8b75b10
Problem is not in that I have changed key mapping. It looks like it is a bug in EmacsW32 version. Here is another description of the problem:
Unreleased Meta/Win modifier
Use C-v and M-v.
Don't change C-y, M-y default bindings.
Could this be a side affect of using the Windows key as Meta? I'm thinking this because in a non-Emacs situation if you press and hold the Windows key and another key for a short cut (Win+E for Explorer, Win+R for Run dialog, etc.) the desired action only triggers once, not multiple times if you keep holding it down.
I'd try reassigning Meta to Alt and see if the problem persists. If it doesn't, then I'm not sure what other option you have, since likely it's the OS only sending the Windows key press once to the app in focus.
You should use the patched EmacsW32 version, if you want the Windows key as Meta.
From the site about the patches:
"Changes that makes it possible to use the window keyboard keys as META in Emacs. Without this patch key sequences like E will always do what they by default does in windows, ie in this case open up Windows Explorer. (This patched is not used by default, you have to turn it on.)"