How do I get a url to be selected by double-clicking in Emacs term mode? For example, if I see stackoverflow.com in my terminal and I'd like to select it by double-clicking on it, it currently just selects either stackoverflow or com, but not stackoverflow.com
Double-click the dot (.) in stackoverflow.com to select all of that URL.
Depending on the current mode, . might have symbol syntax and not word syntax.
Double-clicking a word-constituent character selects the clicked word.
Double-clicking a symbol-constituent character selects the clicked symbol.
See the Elisp manual, node Syntax Class Table.
You can also click mouse-3 on the last word to select (e.g. com), after double-clicking mouse-1 on the first word to select (e.g. stackoverflow).
See the Emacs manual, node Mouse Commands.
You can double-click on one word and then, keeping the button pressed, move the mouse to extend the selection by additional words.
Related
In VS Code, pressing Shift+Command+L creates a cursor for every occurrences strings and you can modify them all at once. Is there a similar shortcut for the JetBrains IDEs such as Intellij IDEA?
Yes there is. You can read more about ways to create multiple cursors and selection ranes on their dedicated help page: https://www.jetbrains.com/help/idea/multicursor.html (I'll use links for the Intellij IDEA help pages, but you the instructions should be similar for all the IDEs in the JetBrains family. To get the help pages for a specific one, visit their general help page, then select an IDE, and then use the search function to search "multicursor").
In particular, see this section named "Select multiple occurrences of a word or a text range" Here's an excerpt when the Shortcuts mode is set to "Windows" (visit that link and switch the shortcut mode to whichever platform you are on)
If you want to select words, set your caret at an occurrence of the desired word. Otherwise, select the desired range with the mouse or with keyboard shortcuts.
If you want to select words, set your caret at an occurrence of the desired word. Otherwise, select the desired range with the mouse or with keyboard shortcuts.
Do one of the following:
Successively press Alt+J to find and select the next occurrence of case-sensitively matching word or text range.
Press Ctrl+Alt+Shift+J to select all case-sensitively matching words or text ranges in the document.
To remove selection from the last selected occurrence, press Alt+Shift+J.
After the second or any consecutive selection was added with Alt+J, you can skip it and select the next occurrence with F3. To return the selection to the lastly skipped occurrence, press Shift+F3.
Other functions include:
You can do it with the mouse while holding Alt+Shift+Click the target location to add another caret. You can Alt+Shift+Click one of the existing carets to remove it.
To add carets above or below the current caret using the keyboard, Press Ctrl twice, and then without releasing it, press the up or down arrow key. Or you can enable the column selection mode (press Alt+Shift+Insert) and then press Shift+Up/Shift+Down.
Edit | Find | Select All Occurrences action does it:
I am writing my own emacs cheat sheet.
So I want to copy function descriptions from emacs help.
For example, in this screen shot, I want to copy the "org-shifttab" function description:
The "pattern" field filters a list of functions.
Pressing TAB displays the description of the selected function.
But moving the yellow cursor out of the "pattern" field removes the display of the function's description.
How to copy the function's description to the clipboard?
I am running Emacs 25.2.1 on Fedora 25.
You have a *Help* buffer now with the contents that you're looking for. You can either press enter to go to that help buffer, or use C-x b to switch to it.
From there, you can mark and copy the contents of the buffer as usual (C-x h M-w).
In EMACS the default seems to be to 'copy' any text highlighted with the mouse. I'm attempting to replicate the functionality of modern text editors, where I can highlight a section of text and press 'paste' to replace it. I have so far added
(delete-selection-mode 1)
to my init.el
The problem is, if I copy something, then highlight to paste in its place, I end up pasting what I had just highlighted, changing nothing.
What do I need to change to fix that behaviour?
The most powerful element of emacs is its introspection features, lets have a look at how we can use them to try and solve this problem. We must use the power of the source.
One of the most important tools for introspection in emacs is the describe-key command which is bound to C-h k. It brings up the documentation of whatever keystroke is called after it. So in our case if we press C-h k and then click and drag we will see the documentation for <down-mouse-1> and more importantly for <drag-mouse-1>. The documentation states that "<drag-mouse-1> at that spot runs the command mouse-set-region". Below it then gives some documentation for this command. It says
Set the region to the text dragged over, and copy to kill ring.
This should be bound to a mouse drag event.
See the ‘mouse-drag-copy-region’ variable to control whether this
command alters the kill ring or not.
Now we know that somehow mouse-drag-copy-region controls whether or not the highlighted text is copied.
If we follow the link of that variable it tells us the default value and some documentation:
If non-nil, copy to kill-ring upon mouse adjustments of the region.
Now all we have to do is set the variable to be nil to get the effect that you want. Place the following code at the end of your init file and you should be all set
(setq mouse-drag-copy-region nil)
I hope that this helps you with this problem and that more importantly it helps you with further issues.
By default, selecting a region with the mouse does not copy the text to the kill ring. If your Emacs does this, you probably have set the variable mouse-drag-copy-region.
In a fresh Emacs (24.5 started using -Q), you can do the following:
Start delete-selection-mode.
Mark a region using the mouse. Copy it using M-w.
Mark a second region. Replace it with the first using C-y.
I see two alternatives, neither of which does exactly what you request. (For both, yes, turn on delete-selection-mode.)
Use the secondary selection for the text to copy, and use the primary selection (the region) for the text to be replaced.
You copy text into the secondary selection using the Meta key plus the mouse - for example, press and hold Meta (the Alt key, usually) while dragging or double-clicking mouse-1.
You paste the secondary selection using Meta plus mouse-2.
Select text with the mouse, then copy it to the kill-ring using M-w. Then select the text to replace with the mouse and use C-y to paste the copied text to replace it.
How can I mark a word in notepad++ and can easily insert a command, with the marked word as argument? E.g.: I have a text with the word "WORD1", I want to mark "WORD1" with the mouse, and after press any button/shortcut, or quick contextmenu with the right mouse-button, or anything like that, and it will make it to "\command{WORD1}".
Of course, I want to specify "\command", e.g. I can choose the needed command in a dropdown of the context menu, or choose a specific button/shortcut for any command.
Is that possible?
Try recording a macro doing what you want and then assigning a keyboard shortcut to it and from then on, you should be able to get it to do what you want.
Look at the Shortcut Mapper
Finding location of NP++ Macros
Type %appdata% in run and hit Enter, when the directory opens, locate Notepad++ and you see shortcuts.xml
Imagine you have these files in your project:
a/b/first.png
a/first.png
If I trigger projectile with C-c p f and write first.png, and I write first.png , it will show me both files. Is there a way to select the next file?
Example:
In the image below, the first file in the list is .document. Without writing any other letter, is it possible to switch through the list provided by projectile? Is there a combination that will cycle through those file names, like , press some key combination and then .gitignore is selected?
If I correctly understand, the projectile uses the ido package for file name completions, and other things. The ido (and many other packages) uses the C-s to switch to next file name, and C-r to switch to previous file. See "Using IDO" section in previous link
The keyboard arrow keys will toggle through options as well, and you can then hit enter when the file you want is highlighted next to the text you typed.