Skip to main content
Share Your Experience: Take the 2024 Developer Survey
18 votes
Accepted

Spacemacs: paste into minibuffer

C-y does work, but you can also paste into the minibuffer from the default register using dotspacemacs-emacs-leader-key instead of dotspacemacs-leader-key, in which case you can use: leaderre" or ...
Braham Snyder's user avatar
15 votes

Simple ways to copy/paste files and directories between dired buffers

You can do the following in vanilla Dired (no 3rd-party library needed): Go first to a Dired buffer that lists the target directory. With the cursor on the directory header line for a listing of the ...
Drew's user avatar
  • 77.9k
11 votes

Copy all file names that match regexp

Use function directory-files, for which C-h f tells you: directory-files is a built-in function in `C source code'. (directory-files DIRECTORY &optional FULL MATCH NOSORT) Return a list of ...
Drew's user avatar
  • 77.9k
10 votes
Accepted

copy from shell and paste in terminal-emacs

You can't copy-paste between Emacs and a shell without using a system-wide copy-paste facility. Text terminals in general do not provide a copy-paste facility. It seems that you're running this ...
Gilles 'SO- stop being evil''s user avatar
10 votes
Accepted

How can I copy+paste `org-mode` headlines only?

org-copy-visible, bound to C-c C-x v, does this: collapse your outline until just the headings you want to copy are visible, set a region around them, and copy via org-copy-visible.
Tyler's user avatar
  • 22.4k
9 votes

How to select (and copy) a column of an org table *without* rectangle selection?

Actually for org-table-copy-region it isn't necessary to mark the exact column width! Just mark the beginning of the column somewhere in a cell, then the end by going down the required number of rows ...
Dieter.Wilhelm's user avatar
8 votes
Accepted

How to turn off bracketed paste mode?

My crystal ball said you should remove (global-set-key (kbd "M-[") 'previous-multiframe-window) from your ~/.emacs. You might like to M-x report-emacs-bug and ask for global-set-key to complain ...
Stefan's user avatar
  • 26.5k
8 votes
Accepted

Copy text as rectangle

My crystal ball tells me you're using Emacs-24.5, which indeed had this limitation. This has been fixed in Emacs-25 where rectangle-mark-mode has been improved so you can move the cursor past the "...
Stefan's user avatar
  • 26.5k
8 votes

Simple ways to copy/paste files and directories between dired buffers

I've added this feature now to Dired+. You can use C-y (command diredp-yank-files) to paste files, whose absolute names you have copied to the kill ring, to the current directory. The "current ...
Drew's user avatar
  • 77.9k
7 votes
Accepted

Evil-emacs: how to select last pasted text (like gv)?

In my .vimrc I have nnoremap <leader>v '[V'] to do exactly this. Amazingly, the sequence '[V'] works in evil just fine. To have a shortcut in Emacs, I wrote the following function: (defun ...
Andreas's user avatar
  • 86
7 votes
Accepted

How to copy commit hash from Magit status buffer?

After I open a Magit status buffer and make a commit, I commonly also want to copy that commit's hash With vanilla Emacs bindings in the Magit status buffer: M-w (magit-copy-buffer-revision) saves ...
Basil's user avatar
  • 12.5k
6 votes
Accepted

How do I cut and paste effectively between applications while using EXWM?

Long answer: There are three modes* in EXWM. I. Sending all the keys to the apps except the global bindings (for e.g. this is a global (exwm-input-set-key (kbd "s-c") #'list-processes). EXWM calls ...
fhdhsni's user avatar
  • 703
6 votes
Accepted

How to select last pasted text

When emacs pastes ("yanks") text, it puts a mark at the start of the text, so selecting it can be done using exchange-point-and-mark, bound to C-xC-x by default.
rpluim's user avatar
  • 5,325
5 votes

Pasting Text from Clipboard - why ^M instead of linebreaks?

The linebreaks are missing because there is a conflict between your coding system on the desktop and your emacs setup. Emacs can be configured to have different coding systems for the terminal, ...
aagaard's user avatar
  • 191
5 votes
Accepted

Get thing-at-point to include periods

What about this. (defun dotted-symbol-at-point () (with-syntax-table (make-syntax-table (syntax-table)) (modify-syntax-entry ?. "_") (thing-at-point 'symbol)))
politza's user avatar
  • 3,346
5 votes
Accepted

Copying a rectangular selection to system clipboard

(defun copy-rectangle-to-system-clipboard (start end) "Like `copy-rectangle-as-kill', but also copy to system clipboard." (interactive "r") (call-interactively #'copy-rectangle-as-kill) (with-...
xuchunyang's user avatar
  • 14.6k
5 votes
Accepted

Copy Paste - Hard to use with one Hand

I don't have the precise quote, but if memory serves, the original author of Emacs default keybindings is Guy Lewis Steele. You should be able to find a mention of this fact in the book Coders at ...
wvxvw's user avatar
  • 11.4k
5 votes

How copy content of minibuffer to kill-ring?

Just like ordinary buffers, C-x h (mark-whole-buffer) then M-w (kill-ring-save).
xuchunyang's user avatar
  • 14.6k
5 votes
Accepted

Almost working smoothly attempt to get terminal Emacs to copy to clipboard

I'm also a loyal emacs-nw user, and have struggled with this over the recent emacs versions. What works for me, and without any need to C-g, follows. Note that it has a safety check that is linux-...
user1404316's user avatar
4 votes
Accepted

pasting from websites results in 1 long line..anyway to keep the paragraph format?

Just run fill-paragraph bound by default to M-q Depending on where you are copying from, remember that the paragraph is one logical object, how it shows depends on the width of the browser on your ...
icarus's user avatar
  • 1,924
4 votes

Simple ways to copy/paste files and directories between dired buffers

Your idea sounds straightforward, maybe you can try to implement it by yourself, you can also use the following to get started if you want to. (defvar your-dired-copy-list nil) (defun your-dired-...
xuchunyang's user avatar
  • 14.6k
4 votes
Accepted

How can I yank images from Emacs?

A very rudimentary function that will yank the displayed image at point to the X11 clipboard: (defun x11-yank-image-at-point-as-image () "Yank the image at point to the X11 clipboard as image/png." ...
4 votes
Accepted

Copy/paste between SSH terminal Emacs and macOS

I just recently wrote an Emacs package called Clipetty which solves this very problem. It uses OSC-52 xterm escape sequences, is smart enough to know when you're running on a remote host, and can deal ...
spud's user avatar
  • 121
4 votes
Accepted

Emacs equivalent of 'y%'

You would mark the next sexp with C-M-SPC and copy the marked region to the kill-ring with M-w. You might find such questions more appropriate on Emacs.SE.
sds's user avatar
  • 6,124
4 votes
Accepted

How can I copy text from read only buffer?

Use M-w, not C-w. You want to copy the text to the kill-ring, not kill it. Trying to kill the text raises an error in a read-only buffer. Copying the text does not modify the buffer. C-h k M-w ...
Drew's user avatar
  • 77.9k
4 votes
Accepted

Copy-paste text among Split Window Buffers

Here is another opinionated implementation, it assumes 2 windows layout and isn't as sophisticated as append-to-buffer, the point is Emacs is very easy to extend. (defun my-copy-to-next-window (b e) ...
xuchunyang's user avatar
  • 14.6k
4 votes
Accepted

Pasting images from clipboard into Orgmode

Org-mode files are 'designed' to be plain text files, therefore it is common to insert links to image files, which Emacs 'optionally' can render as an image. It is possible to insert the image data ...
dalanicolai's user avatar
  • 7,865
3 votes
Accepted

How to select (and copy) a column of an org table *without* rectangle selection?

The two commands org-table-select-col and org-table-copy-col in the following lisp code allow the selection and the copying of the current table column. You can bind it to the key of your liking and/...
Tobias's user avatar
  • 33.3k
3 votes
Accepted

How to set copy to C-c in Emacs?

I have tried using Cua mode (via adding (cua-mode t) to my ~/.emacs file) but it doesn't seem to set the copy keybinding to Ctrl-c. It does, but only when you highlight text, see CUA Bindings ...
npostavs's user avatar
  • 9,203
3 votes

Copy all file names that match regexp

If you use counsel-find-file from the counsel MELPA package, you can press M-w to copy all current matches. It works with regex patterns as input. Then press C-g if you don't wont to select a file ...
abo-abo's user avatar
  • 14.1k

Only top scored, non community-wiki answers of a minimum length are eligible