You can use kill-whole-line to kill the entire line point is on. Position of point does not matter. This command is bound to C-S-DEL by default.
You can also instruct kill-line (bound to C-k) to kill the entire line by setting the variable kill-whole-line to a non-nil value:
(setq kill-whole-line t)
Note that point has to be at the beginning of the line ...
Copy from Emacs to OS X clipboard:
select region then M-| pbcopy RET
Paste from OS X clipboard to Emacs:
C-u M-| pbpaste RET (replaces current region if it exists)
M-| runs shell-command-on-region, which as the name implies pipes the current region to a shell command. C-u M-| does the same thing, but replaces the current region with the ...
You need to customize save-interprogram-paste-before-kill to t. This will push your clipboard onto the killring in case you kill something in emacs before pasting the clipboard. A related customization is yank-pop-change-selection which pushes your current yank in emacs onto the clipboard. For both of these to work, you need x-select-enable-clipboard (...
There is no bug here. Since I was also annoyed with this behavior, I just read Evil code to find out why this is happening. So, here is a straight copy/paste of the well-commented one-liner from my Emacs configuration that fixes this issue:
;; Imagine the following scenario. One wants to paste some previously copied
;; (from application other than Emacs) ...
is it feasible to make one?
Since this is emacs, yes.
My approach is to use a 3rd party tools that can take HTML and convert to plain text or even directly to Org format. I think this is an ugly hack, and there may be better ways to do this, but it looks like it works for my test cases.
(defun kdm/html2org-clipboard ()
"Convert clipboard contents from ...
There's a package called whole-line-or-region which advises various built-in commands so that they act on the current line if no region is active, so M-w will copy the current line, and C-w will kill it, for example. I've been using the package for years, and find it indispensable.
Additionally, this package makes it so that a numeric prefix will indicate ...
The solution I've found for myself is to use prefix arguments.
For me, killing half a line is a useful feature, but I want an easier
way of killing entire lines too. So I made it so that
murders everything in sight when given a prefix argument.
(defmacro bol-with-prefix (function)
"Define a new function which calls FUNCTION.
Except it ...
(buffer-substring (line-beginning-position) (line-end-position))
As Tobias noted, this also copies properties of text. If you want to avoid that, you might want to go with buffer-substring-no-properties instead:
(buffer-substring-no-properties (line-beginning-position) (line-end-position))
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 leaderrereturn.
Alternatively, you can search and paste the contents from any register: for example leaderre phrase you remember.
Personally, I've just set ...
This is not an answer for orthodox emacs. If, however, you're willing to blaspheme with evil's modal editing, you can:
dd for kill line
yy for copy/yank line
Both can be prefixed by the number of lines to kill/copy (eg, 4yy will copy the next 4 lines).
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 names of files in DIRECTORY.
There are three optional arguments:
If FULL is non-nil, return absolute file names. Otherwise return names
that are relative to the ...
If you use Emacs "the normal way" (i.e. as a GUI application), then it should already do that by default. If you use Emacs inside a terminal emulator, then indeed it doesn't know how to do that by default, but you can install the xclip package from GNU ELPA and then enable the xclip-mode which teaches Emacs how to do that both for GNU/Linux and for OSX.
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 terminal Emacs in a terminal window in a window environment. Window environments do provide copy-paste; that's what happens when you use the mouse. However, this ...
Simply use the kill ring. In evil, your simplest option is to use evil-paste-pop, bound by default to C-p. Here's the docstring:
Replace the just-yanked stretch of killed text with a different stretch.
This command is allowed only immediatly after a yank,
evil-paste-before, evil-paste-after or evil-paste-pop.
This command uses the same paste ...
If you just need this behavior for mouse selections, you can use the built-in setting mouse-drag-copy-region:
(setq mouse-drag-copy-region t)
If non-nil, copy to kill-ring upon mouse adjustments of the region.
The selection can be copied automatically if the OS supports primary selection by setting the below variable.
(setq x-select-enable-primary t)
From C-h v x-select-enable-primary, you get,
Non-nil means cutting and pasting uses the primary selection
The existence of a primary selection depends on the underlying GUI you use.
E.g. it doesn't exist ...
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 "end" of a line (and where you can use C-x C-x to go to another corner of the rectangle as well).
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 target directory, use w (command dired-copy-filename-as-kill). This copies the absolute name of that target directory. (You can copy a dir name from any Dired-...
Sounds like you are being bitten by the fact that one command is bound to mouse-2, another command is bound to down-mouse-2, and the two commands do not play well together.
Do C-h k and then click mouse-2 on text (e.g. mistaake). The help should tell you what mouse-2 and down-mouse-2 are bound to.
If I'm right in my guess, you can try doing one of these ...
As you have noticed, you can yank the password when Magit is reading
it in the minibuffer (this works pretty much always when user input is
read in the minibuffer for whatever purpose). So the sequence is more
P P RET
This might or might not cache the password, depending on various
settings. First you need to tell Git to cache the ...
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 when the key sequence conflicts with something in input-decode-map (as is the case here, because the byte sequence ESC [ (which corresponds to the M-[ event) is ...
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 directory" here is what dired-current-directory returns: the inserted subdirectory where the cursor is located, or the Dired main directory if the cursor is not in a ...
You can use the external utilities xsel or xclip (they have mostly the same features, I'll use xsel in this answer) to copy data from or to the X clipboard. To copy to the clipboard, pass the desired content on standard input. When pasting from the clipboard, the content is written to standard output.
To copy the selection to the X clipboard, use M-| xsel -...
1) How shall I avoid creating a text file with mixed encodings when copying its different parts from different sources into an editor such as emacs?
Irrespective of the source, you can always set the encoding of a buffer by setting the variable buffer-file-coding-system. An easy way to do this is via the keybinding C-x RET f which prompts you for a file ...
When I copy the text from the source to the emacs buffer ...
What you copy depends upon the application you are copying from. Some applications release UTF-8 encoded strings while others use different formats. Emacs uses the variable selection-coding-system to determine whether to decide the encoding from the data or presume a particular encoding. See the ...
Starting at the beginning of line 4 (ESC 4 ESC g g or M-4 M-g M-g to go there), C-3 C-k C-2 C-n C-y (or ESC 3 C-k down down C-y if you don't like holding modifiers down) will do this.
If you don't want to do the arithmetic in your head, but instead select lines visually, then
Move to the beginning of the zone to move
C-SPC to set the mark
Move down to the ...
I use the following for this:
(defun my-copy-simple (beg end)
"Save the current region to the kill ring after stripping extra whitespace and new lines"
(copy-region-as-kill beg end)
(while (looking-at "[ \t\n]")