How to achieve Mac-like use of CTRL and CMD keys on Apple Keyboard?

Tags:

Answer: 1

20 hours ago

I'm very used to emacs-like ctrl+a to mean "home," and cmd+a to mean "select all." Similarly ctrl+e is "end", ctrl+d is "delete", ctrl+c does what I expect in Terminal, and probably a few more requisites I don't have on hand.

Of course Ubuntu is a little different. The ctrl key is functionally most paired with the cmd key, even though in physical keyboard layout the cmd key will bind to super.

So my first step was simply swapping cmd and ctrl by editing xkb since that restores 70% of the functionality I'm missing.

That mostly leaves begin/end/delete and related Mac-"control" functionality, but I don't know a good way to split the functionality or move some super obscure key over to ctrl to achieve this. I'm trying to find a cohesive strategy in general, but hacks are a step.

Ubuntu 14.04.

Answer: 2

24 hours ago

For fixing your terminal behaviour:

A straightforward way to achieve what you are trying to do, is to edit your home config files. For a bash terminal, you are looking to edit your readline config, which would be your .inputrc.

  1. Open up a terminal
  2. man readline This tells you most of your customization options. If you scroll to the bottom, it shows you how emacs mode is configured. More on that below.
  3. gedit .inputrc This is what you want to edit. It is loaded whenever you log in, and will customize your readline (what bash uses for input) behaviour.

How I solved a similar issue.

I had to do something similar because I use Vi Mode in Bash:

set -o vi
  • I also use Colemak.
  • Subsequently, I use a highly customized version of Vim.

My .vimrc configuration does not affect vi Mode for bash (and ZSH for that matter).

So I had to create a custom one, and boy was it a lot of work:

http://bazaar.launchpad.net/~akiva/colemak.vim/trunk/view/head:/.inputrc

You can use my code there as a template to work off of. I have all the functions there. The ones I do not use are commented out. You can map your characters to two things:

########
# Copy #
########
# Copy to
"c":    vi-yank-to 
# fake copy line
"C":    "0c$$"
  • vi-yank-to is a builtin function
  • "0c$$" is a custom string (Notice the quotes around it) that basically simulates me pressing 0, c, $, $ in that order.

Let me know if you have any questions.

Added by: Alvera Rutherford

Answer: 3

18 hours ago

This will make you keyboard works like Mac.

Remaps Left Ctrl with AltGr

sudo vi /usr/share/X11/xkb/symbols/ctrl

Change the section

// Map Ctrl to the left Alt key, Alt to the left Win key, // and Super to the left Ctrl key.

when it says "replace key " with

replace key { [ ISO_Level3_Shift ] };

Open Tweaks On Additional Layout Options -> Ctrl , mark "Map Ctrl to the left Alt key, Alt to the left Win key, and Super to the left Ctrl key."

On your shell configuration .zshrc in my case, remap to intr check if you have the cent symbol there before. Add this to the file :

stty intr 0xA2

On gnome-terminal remap the copy and paste shortcuts to "Ctrl C" "Ctrl V"

And move physically your keys to make sense

Added by: Gavin Leffler

Popular Search

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9