Rebind copying selected text in zsh - macos

I want to bind copying selected text in terminal to another key (besides the usual Cmd+C). It seems I can do that only when the text is selected in the prompt by calling zsh's copy-region-as-kill. However, if text is selected outside the prompt (using the mouse) there seems to be no way to obtain that text.
Is there a way to do this?

Related

I can't enter text via the command line, is it possible to do this?

When you try to automatically enter the desired content (and there will be a lot of such objects with text content and I would prefer to avoid entering all the necessary data manually), the input field moves from the console to the area highlighted with a red rectangle, which makes it impossible to automatically create signatures.
The question is, is it possible to make the input field of the desired content always remain on the command line?
enter image description here
I tried to find the question on the Internet by entering the corresponding queries in Russian, nothing gave results
I understand that by "automatically" you mean copying and pasting from some editor to the AutoCAD command prompt.
I will never work that way, you must use a programming language and I think the easiest thing is to use AutoLISP.
Try copying and pasting this:
(command "_mtext" "36,0" "42,0" "your text here" "")
and note the empty string at the end "" that finalises the MTEXT command.

RichEdit20A line selection mode similar to Notepad

I'm trying to change the way RichEdit20A Windows control selects line so it's similar to how it works in Notepad.
By default, if I select a line (e.g. Shift-End), then all the characters and the end of line is selected:
Sample text
^^^^^^^^^^^^ <- this is the selection
In Notepad it selects just the text:
Sample text
^^^^^^^^^^^
As a result, pressing delete (or backspace) in RichEdit20A control removes the line while in Notepad it just removes the text and keeps the line empty.
Is there any simple way (other than handling selection on my own) to configure the RichEdit20A control to keep formatting but make the line selection to work like in Notepad?
I don't know such a setting to influence the RTF control. But pressing Shift+End is a key input that is possible to trap with a WM_KEYDOWN handler, when you subclass the control.
You can use EM_LINEINDEX with -1 to get the current line start index.
Now with this index you can use EM_LINELENGTH.
Get the current selection (EM_GESTEL) and now you are free to use EM_SETSEL with the values you like to extend it.

How to disable formatting in TextEdit on Mac Yosemite

When I copy something and paste it from buffer in TextEdit, it saves text formatting (font-color, background-color, font-style) How can I turn that off?
I don't think you will be able to turn it off. But you can tweak it in the copy/paste process.
Take a look at this article here as it explains how you can copy/paste using a certain combination of keys to skip formatting.
Paste the copied text and match current style by using Command+Option+Shift+V.
Notice the difference from the normal Command+V paste trick, which would include the formatting.
If you don't want to save text with formatting, you should work with plain text format: menu Format > Make Plain Text (⇧⌘T). You can also set plain text format as your default document format in TextEdit Preferences.

Copying by highlighting in bash

I was trying to set up my bash in such a way that whenever I highlight (by selecting it with the mouse) any text it automatically gets copied to clipboard. How can I do this?
Thanks!
X11 has a concept of the selection which is distinct from the clipboard. You can easily paste the last selection by middle-clicking the destination.

Keyboard shortcut to rename a variable?

In Visual Studio, when you change the name of a variable, a small red square appears underneath it and when you hover over it, a bigger yellow box appears, and when you click on that an option appears to automatically rename all instances of that variable to the new name. Is there a keyboard shortcut for this? It would be much faster than trying to hover over the tiny red box for half an hour... (if it matters I'm using the C# code editor)
EDIT: I am aware of CTRL+. but is there one where you don't have to press enter afterwards? :-)
F2 displays the Rename dialog box, which allows renaming all references for an identifier.
You can rename variables of this easy ways: Right click -> Rename or Ctrl+R-> Ctrl+R

Resources