Skip to content

Emacs kill ring & X11 clipboard, let’s be friends!

2010/06/28

Today is another day of keyboard shortcuts. This time, let’s get some better interaction going between the X11 clipboard and the Emacs kill ring. This way, when you want to copy and paste text between Emacs and other applications, you won’t have to enable menu-bar-mode to use the function.

As this stackoverflow question explains, there are a few ways to skin this particular cat. One of the answers has a link to an EmacsWiki article that provides even more detail.

Putting the following key bindings into your .emacs should do the trick quite nicely.

(global-set-key "\C-w" 'clipboard-kill-region)
(global-set-key "\M-w" 'clipboard-kill-ring-save)
(global-set-key "\C-y" 'clipboard-yank)

Enjoy!

Advertisements
Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: