Emacs on Mac OS X Lion - what about the Ctrl and Alt touch? - macos

How can I hold Ctrl and arrow key up/down to move fast in my code? Because this is a shortcut in OS X.
How can I use alt (meta) touch? Emacs doesn't recognize option or command key?

For the Control key shortcuts, you're probably best off using the Keyboard section of the System Preferences to disable any Ctrl+Arrow shortcuts. I changed all the Control key system shortcuts to use Control, Option and Command together, which is easy enough to hit (particularly on a full-size keyboard) while being much less likely to conflict with emacs.
As for the Meta key, if you are using terminal emacs, you may just have to put up with slightly poor modifier key support. (I've found a number of shortcuts to simply not work, even after playing with the terminal preferences. The terminal system is just slightly limited, it seems.) The easiest solution is to use the Esc prefix key instead of Meta - so instead of holding Meta and tapping the key, you tap Esc, and then tap the key. So for M-x, say, you would type ESC x. This is sometimes annoying (e.g., M-f and M-b aren't so convenient any more...), but it certainly does work.
If you can, I recommend switching to the GUI version of OS X emacs, which has none of these problems.

To make the option key work:
In the terminal settings 'CMD-,' click 'Profiles -> Keyboard -> Use Option as a modifier key'.

Related

Are there any ways to disable ctrl-i at mac's default terminal?

I'm a mac user and use mac's default terminal app. Are there any ways to disable ctr-i at mac's default terminal? Ctrl-i conflicts my vim and tmux shortcut. I don't need to use ctrl-i binding as the terminal.
ctrl+I (whether i or I does not matter) is the TAB character, which you probably need. It is not a key which is set in Terminal's preferences, so (while you could add a keyboard shortcut to something different), it is not something that you could disable.

How to unbind Command-Control-Space key from Mac OS X 10.9?

How can I unbind Command-Control-Space from Mac OS X 10.9?
This shortcut shows Special Characters table and conflicts with my Emacs key binding, and I couldn't disable it from System Preference->Keyboard->Shortcuts.
Thanks.
At least on macOS Sierra to macOS Big Sur ⌃Space is the default binding for Select the previous input source which is on by default (even if only one input source is activated).
You can free it by:
Open System Preferences
Go to Keyboard > Shortcuts > Input Sources
Untick "Select the previous input source"
Afterwards, you should be able to bind it as expected.
You can create custom keyboard shortcuts for most app's menubar choices in System Preferences. If a desired key combination is losing precedence to a default shortcut that you don't use and can't easily disable, simply override it with a new, unobtrusive shortcut.
Open System Prefs / Keyboard / Shortcuts. Select App Shortcuts from the left pane. Toggle the All Applications category's triangle in the main window to point downward (if it's not open already).
If there's an item named Emoji & Symbols* shown there, then click its shortcut combination and enter a new shortcut (such as option-shift-command-t, in this case).
If there's not an item named Emoji & Symbols under All Applications, click the + button at the bottom, type or copy-paste Emoji & Symbols, and then enter a new keyboard shortcut (option-shift-command-t, or anything really). This will free the control-command-space combination for you to use as a specialized shortcut elsewhere.
To remove your custom shortcut, just click to highlight it in the main window of this preference pane, and click the – button at the bottom. The custom shortcut will disappear and the default action will resume.
*Note: On versions older than Mac OS 10.10.3, the menu item is called Special Characters… instead of Emoji & Symbols.
I don't know of any way to disable this, but an alternative option might be to create a shortcut for the app you want to use that in. I created a Command-Control-Space shortcut for Chrome and now Command-Control-Space doesn't bring up the special character palette anymore in Chrome.
failing that you may be better off asking in Apple Stackexchange

How to map Caps Lock to Esc for Vim in macOS?

I use vim to develop on my mac and I updated to Mountain Lion yesterday. I was using http://pqrs.org/macosx/keyremap4macbook/ this to remap the escape key's function to caps lock to switch between edit and insert modes. I can't really functionally develop in vim without this and it doesn't seem to work in Moutain Lion. I really need a solution soon!
Thanks a lot guys.
Found this:
https://github.com/tekezo/PCKeyboardHack/issues/8#issuecomment-7359829
It worked perfectly for me.
I had grown so accustomed to using caps-lock as esc, that it was killing my productivity until I found this.
You can achieve the same using the accessibility features of macOS. A usage example:
Map Caps Lock to Esc;
Map double Shift to Caps Lock.
To achieve (1) go to Settings > Keyboard > Special keys. In the appeared dialog set the desired mappings.
To achieve (2) go to Settings > Accessibility > Keyboard > Hardware > Activate lock keys.
So now if you have taps on you'll even have a logo on your screen notifying you about that.
NB. These are system-wide settings, not only for vim, but I believe it doesn't make a lot of sense to have a special mapping only for one editor, it will only make things more confusing.
NB. The Settings names could differ slightly for you, since I had to translate them from Dutch. Use some fuzzy logic to get to the right place.

configuring emacs keys on mac os x

I've attached an external keyboard to my laptop and I've modified my keyboard mappings such that
1. Ctrl is CAPS
2. CAPS is Ctrl
I want to continue using the right Ctrl key as Ctrl instead of CAPS. Any pointes on how this can be achieved ?
I'm not at my mac right now so I might get this wrong, but...
Take a look at the group of variables named like ns-right-control-modifier, they control how the left and right modifier keys should behave.
You might need a recent version of Emacs to get full support.
I know this might be a little orthogonal to your problem, but I would sugget running emacs in iTerm 2 with emacs -nw
I say this because then in iTerm you have a little more control over the rebinding of the modifier keys by going to iTerm -> Preferences -> Keys. There you can remap both left and right keys.
I also suggest running emacs in the terminal because then if you use a terminal multiplexer like tmux or screen you have the ability to copy and paste from a terminal window right into your emacs buffer.

How can I detect whether the alt/option key is down in GTK on Mac OS X?

I want to detect whether the alt/option key is pressed during a mouse drag in GTK on Mac OS X. I am using pygtk. Normally, holding down alt would add MOD1_MASK to event.state, but alt does affect event.state at all. In key press events alt shows up as gtk.keysyms.kana_switch, but this is not sufficient for my purposes since the user might press alt in a different application and switch to mine by clicking.
Is there an available setting that would cause alt/option to show up as a modifier in event.state? Alternatively, is there a way of detecting whether a key is currently down even if the key down event went to a different application?
I think you should use gtk.accelerator_get_default_mod_mask()
http://library.gnome.org/devel/gtk/unstable/checklist-modifiers.html

Resources