Sometimes I want to paste some text into a file and then immediately operate on it. For instance, to comment-out everything I pasted.
In Emacs, pasting updates Point and Mark. Is there an equivalent in VS Code?
In the extension Select By v0.12.0 I have added a command that pastes the clipboard content and keep it selected.
The command is Paste clipboard and select (selectby.pasteClipboard)
Related
When copy a file ".env", I hope to got a duplicated file named ".env 1" not ".env copy"
You can change this behavior by setting the explorer.incrementalNaming to smart.
To do that, do the following:
cmd+,
search for: explorer.incrementalNaming
Change the setting to smart.
Otherwise, if you don't want to change the setting, you can just constantly change the filename after copy is complete. The fastest and most efficient way I found is through the following keyboard commands:
Select file in Explorer
ctrl+c (or cmd+c if you're on a mac)
ctrl+v (or cmd+v)
<enter>
right arrow once
backspace 5 times
then put in 1.
My problem is as follows. When copying multi-line text (consisting of commands, for example) from somewhere (text editors, etc.) to the terminal via Ctrl + Shift + V or through the menu with the right mouse button, extra empty lines appear between each line.
For me, this is a problem when copying, for example, the body of a function to the Python interpreter.
My system is Linux Manjaro-KDE (5.4.43-1-MANJARO kernel), but the problem repeats in Arch-linux-KDE too (I checked this).
I managed to figure out the following on my own:
When copying multi-line text, in the Clipboard (which I view by clicking on the corresponding tray icon) a blue “Enter” icon is in front of each new line of the text.
If I edit the block with text directly in the Clipboard buffer, for example, press "edit", do nothing and just save, then the blue "Enter" disappears and the text is copied to the terminal without any extra intermediate lines.
As for other editors and exactly for the gnome-terminal, the text is copied everywhere correctly without blank lines, regardless of the "existence" of the blue "Enter" in the Clipboard. In addition, if I copy lines from the terminal itself and paste into it, then empty lines do not appear.
I think that additional CR/LF characters are added, which are perceived by a single line break everywhere except for the terminal "org.kde.konsole".
Please help: how can I change the behavior of the buffer when copying or the behavior of the terminal?
This question is similar to https://forum.manjaro.org/t/copy-paste-multiple-lines-on-yakuake-konsole-adds-newlines/94589 but it didn't help me.
Had the same problem, it was fixed in Konsole 20.04.3 by the following commit: https://invent.kde.org/utilities/konsole/-/commit/6b6a1e552492a25217cded1d83c25a652e5b249a
It happens from time to time that I need to edit 100+ lines in a text file all at once.
I know I can use ⌘ Cmd+↑/↓ to select multiple lines but depending on the size of the file that takes a while.
In Atom and Sublime, I can just do a ⌘ Cmd + a to select everything, hit another shortcut (forgot the actual shortcut) and end up with a cursor for every line.
Have not found this in VSCode.
Ctrl-a to select all. (or whatever muli-line selection you want)
Shift-alt-I will put cursors at end of each selected line.
And then if you want those cursors at the beginning of each line you need to trigger the command "cursorLineStart" which is unbound by default. Give it a keybinding and all those end-of-line cursors will jump to the beginning of each line.
With v1.43 and Column Selection Mode this can be quite easy, see Column selection like Visual Studio and How to put the cursor at the end of all selected lines in Visual Studio Code?
FWIW cursorLineStart is not the opposite of Shift-Alt-I. In looking at the commends, Shift-Alt-I is "Add cursors to line ends", but there is not a "Add cursors to line begins" option.
However, the easy trick for that is:
Select your text block
Shift-Alt-I to put a cursor at the end of each line
Command-LeftArrow will move those cursors to the beginning of the lines
Its an extra step but it works. When I get time I will play around with building a custom command to do all this in one action.
I am new emacs user and one of the things that irritates me is that when I want to replace current selected text with the one from clipboard I need to delete it first. Every other application that I know replaces pasted text with the current selection by default.
Here's a little bit more detailed description:
Select some block of text
Paste text from clipboard
Emacs just pastes text where the cursor was and previously selected text it is still there. I want that selected text was deleted first.
As artscan wrote in a comment, you can get this functionaly for the normal yank (paste) operations by adding:
(delete-selection-mode 1)
to your configuration.
If you want yank by mouse to also delete the current selection, you can add:
(put 'mouse-yank-primary 'delete-selection 'yank)
in your configuration as well.
So I have a file I open using emacs with 1000+ lines that contains columns of data. Is there a way to highlight everything (all lines) in the file so that I may copy and paste to my internet browser (such as in email)?
You can do Ctrl-x h Meta-w to select everything and copy it.
Ctrl-x h selects everything, and Meta-w will copy whatever is selected.
Meta+x mark-page you can typically also use Ctrl+x Ctrl+p to select the page
followed by
Meta+w
to copy the marked region, in this case the entire page.