What is the equivalent shortcut for CTRL+D ("add selection to next find match") of VSCode in CLion? - visual-studio-code

Usually in Visual Studio Code, if I want to delete or modify a certain word from my file, I can highlight one of the words and then continuously press CTRL+D to highlight the rest of that same word in the file. But, in CLion, I am unable to find the equivalent shortcut.
I've Googled and searched here on StackOverflow but no luck. Maybe this shortcut doesn't exist in CLion? Can anyone confirm?
EDIT: It's also known as "Select next occurence" in other JetBrains products.
EDIT: The answer is ALT+J

it is alt+j in all of jetbrains products

So I just want to hit on a couple of options that you have, because I work with both CLion & VSCode as well, and needed the same exact keybinding in CLion.
KEYBINDING FUNCTIONALITY SEMANTICS
Unfortunately, it appears that no one cares about standardizing semantics when it comes to editor functionality/features, and keybindings. It can make moving from one editor to the next difficult, and flat out something many people just would rather not have to do.
Please Note:
_I am no expert on JetBrains IDE's, I am somewhat of an expert with VSCode though. I say this because, IDK how much JetBrains IDE's vary from one to the next, however, from having CLion, IntelliJ, and Access to Ryder I can tell you that in the standard IDE's the keymappings seem near Identical, but in Ryder, the keybindings are totally different.
DEV ENVIRONMENT
BOUND-KEYS (dev env's default)
SEMANTICS
CLion
ALT+J
"Add Selection for Next Occurrence"
Visual Studio Code
CTRL+D
"editor.action.addSelectionToNextFindMatch"
Visual Studio 2022 (IDE)
SHIFT+ALT+.
"Edit.insertNextMatchingCaret"
the The correct semantics for referring to the functionality you seek in CLion is contingent on the environment that its being implemented in. The following demonstrates how to correctly reference it in both JetBrains & Visual Studio Environments:
Add Selection To Next Find Match Ctrl+D editor.action.addSelectionToNextFindMatch
Once you know the semantics of the functionality that you want to customize, you no longer have to resort to using any editors default key mapping. You asked about, CLion, so I will demonstrate, in an image (or screenshot) below, how you can change the keybinding to be anything you want it to be.
To get to the window you see in the photo navigate by following the steps below.
Starting from the text editor, find the word 'FILE' on the 'MENUBAR' located at the very top of your screen.
Click on 'FILE' to drop open the 'FILE MENU'.
Scan through the __FILE MENU'_s ITEMS, until you see the selectable ITEM named 'SETTINGS' (it will have a wrench icon next to it).
4 Select 'SETTINGS' by left-clicking it, and you'll open the 'SETTINGS MENU' open.
Another 'LIST' will appear on the left side. There will be 'BOLD ITEMS' and regular weighted SUB ITEMS. Find the 'BOLD ITEM' that reads 'KEYMAP'.
Select 'KEYMAP'.
The image above shows the view in my IDE of the keymap menu. You can see a red arrow, as well as a green arrow, in the image.
GREEN ARROW
The green arrow shows where you can change the entire Keymap, as you can see in the image, mine is set to VSCode, and as far as I can tell, every keybinding is the same as in VSCode. You do have to download the VSCode keymap plugin though.
RED ARROW
The red arrow shows where the "Bound Keys" are listed. Right click on the keybinding and you'll see a menu that reads
Add Mouse Shortcut
Add Keyboard Shortcut
Add Abbreviation
"it may also have options for removing keybindings and mouse shortcuts, it all depends on how the keybinding you click on is configured"
To set the keybinding select Add Keyboard shortcut, and set it to what ever you want.

Related

How to get keyboard shortcut `Cmd + S` to save on VS Code?

When I attempt to save my file on Visual Studio Code with the cmd+s keyboard shortcut, it does not save the code. I have to manually click File, the Save, just to be able to save my progress. I'm using macOS Catalina version 10.15.7 and VC Code version 1.55.2.
How do I fix this?
Attempts:
-Checked if ⌘ Cmd + S keyboard shortcut is tied to the Save functionality
If you do it right this solution will fix your issue.
I have never had a problem saving with VS-Code personally, but I have had issues with keybindings. IDK if you write your own keybindings, but if you do, you might want to check the keybindings that you have wrote to make sure they do not conflict with [CTRL + S]. The keybindings.json file that you create custom keybindings in, overrides the default keybindings.json file that defines the keybindings that VS-Code ships with.
To check your keybindings.json file...
Hit the F1-Key
A menu will drop open type in "Keyboard Shortcuts"
There will be two Preferences: Keyboard Shortcuts
Make sure to select Preferences: Keyboard Shortcuts and not Preferences: Default Keyboard Shortcuts
If the file is empty you are good. If you have keybindings written in the file, you need to iterate through them by hand, checking each one. Make sure that none use [CTRL + S] together. Even if the keybinding uses [CTRL + S] and other keys, you will need to disable it, so you can test if it is causing an issue.
Debugging [CTRL + S]
If your keybindings.json file is all good, then great, that's one thing to scratch off the list. The only thing left to do now is debug the Bound Key ("Key Binding"). To debug keybindings, you will use a built in tool, that VS-Code offers. To start do the following:
Hit the F1-Key
When the quick input drops open type the following into the text input:
"Toggle Keyboard Shortcuts Troubleshooting"
Select the option: Developer: Toggle Keyboard Shortcuts Troubleshooting
It should automatically open the OUTPUT panel, which is located in the same panel that your terminal is. Make sure that the OUTPUT is set to LOG(Window) in the drop down. (I took a picture and posted it below if you can't find the Keyboard Shortcut Troubleshooter).
The image might have funny declensions because I am on a dual monitor setup with 1 1080x1920 curved screen and one 1080x720 screen.... I cropped it to a STD HD 1920 width.
I Got My Trouble-shooter working, and Output open, now What Jay?
Okay... Well your at the right spot. Now every-time you press some keys, you should see your OUTPUT WINDOW working like crazy. It should be logging all sorts of stuff, which is good, very good.
This Part Is Important! READ CAREFULLY
What you want to do is use your keybinding that you feel isn't working appropriately. Use it when focus is set on an editor, use it when focus is set on a different editor, use it when focus is set on the sidebar. Where you are focused at in the editor at any given time can greatly affect a keybinding. The output is gonna write lines every-time you use your keybinding. Try not to hit any other keys while doing this, so you have a column in you output that includes logging from the keybinding you are testing only. Read the output see what it says. See if it looks right, or wrong. If it looks wrong, you can visit this link, to the VSCode site that covers this topic, and see if you can fix it your self. If you can't fix it your self, come back here, and edit your question. When you edit your question make sure that it includes the Troubleshooter's Logging Output.
VSCode Troubleshooting Keybindings (Keyboard Shortcuts) # https://code.visualstudio.com/docs/getstarted/keybindings#_troubleshooting-keybindings
Image that shows how to open the Keyboard Debugger
Also shows how to set the OUTPUT to Log(Window)
StackOverflow-2021-JUNE-26018:34-PST
Another thing to check for is, for lack of a better term, combination key bindings. For example, I was having an issue with ⌘+s. VSCode gave a message that it was waiting for the second key binding. After looking at the keybindings.json, I noticed I had a key binding for opening up user snippets as
{
"key": "cmd+s cmd+n",
"command": "workbench.action.openSnippets"
}
The ⌘+s portion of this key binding conflicted with the default ⌘+s

See unsaved changes in vscode

Sometimes when closing vscode, or a tab therein, I get a dialogue asking "Do you want to save the changes you made to filename?" However, the unsaved edits are actually from a previous session that was closed without such a query, probably when turning off the computer, so I can't remember if it was meaningful edits, or maybe just an accidental key-press, like a shortcut gone wrong; and doing undo to revisit the last edits doesn't work either.
My question: How can I see the diff between the saved version of a file, and the version in the editor window? I think it would be nicest just to have a "show diff" option in the dialogue, but for now I'm also happy with a command line diff command.
I'm using ubuntu 20.04.
I'm using VSCode version 1.52.1 on MacOS and I had a similar problem that may not be the same problem, but I'm guessing it will work for you as well.
When you're in the Explorer view, in the upper left part of Explorer you have your "Open Editors." If that shows a dot to the left indicating that the buffer has changes in it, you can right click the file name and select "Compare with Saved." This will open another buffer to the side that will show you any unsaved changes.
To get rid of that window (it took me a bit to figure this out I'm sorry to say!), you can click the 'X' to the left of the extra buffer in "Open Editors."
Hope this works for you!
A few bright notes for the keyboard players out there:
The command you are asking about has a default shortcut. Unless you've applied a keyboard map extension, the Ctrl+Kd arpeggio opens the very same diff view between the active and saved versions of the current file. The default shortcut to close an editor tab (be it the diff or a file or anything at all) is Ctrl+W.
The command, like any command in VSCode, is also accessible via the Ctrl+Shift+P command dropdown (on Linux, F1 opens it too). Start typing e.g. compa sav (it saves your keyboard wear and tear to shorten words to a prefix which is unambiguous enough), and the list will shrink dynamically to just a few commands. Yours is File: Compare Active File with Saved. When it's close to the top enough, navigate the list of commands with the down arrow and execute it with Enter. As a bonus, you may click on the little gear to the right of the command currently highlighted in the list and redefine its shortcut, if you use it very often and prefer a chord shortcut to the default arpeggio one. Sorry, there does not seem to be a shortcut in lieu of the gear click. If there is, please let me know!
But if you really, really want to right-click on the filename in the Open Editors view of the Explorer sidebar, you can open that view directly with, you guessed it, a shortcut: Ctrl+Ke. And if you change your mind on a dime right at this moment, or realize that you in fact never had a mouse to do the right-click in the first place, use Shift+F10 to drop down the "right-click menu", properly called the context menu, which you navigate with arrows and execute with Enter (that's kinda a common theme, as you probably noticed). This works mostly anywhere the right-click does.
While in the Open Editors view, to switch to an editor file tab, move the selection to the desired file. Press Space to bring the file into view but stay in the Open Editors view, or Enter to bring the file into view and shift the keyboard focus to it. Pressing Ctrl+Shift+E brings focus back to the editor from any view in the Explorer sidebar. The same shortcut moves focus to the Explorer sidebar from the editor.
Happy ♬ k'boarding ♬!
ctrl+shift+P (or command+shift+P on mac) and fuzzy search for "compare changes with saved files"

VSCode: "Markdown Preview" SHIFT-COMMAND-P not working

Setup:
VSCode 1.50.1
MacOS High Sierra (10.13.6) - but I think this applies to any OS
Steps to Reproduce:
this is a quick simple one...
click on/hghlight/open a markdown file (.MD extension) in VSCode / from the Explorer tree hierarchy in the Left Nav Pane,
hit SHIFT-COMMAND-V per numerous instructional posts/tutorials - (you can also find the shortcut clearly labeled with that very same Shortcut Key-Combo:
if you RIGHT-CLICK on the file in question...
you will get a Context Menu with several options, include Markdown Preview
hitting the stated key combo of SHIFT-COMMAND-V does nothing,i.e.:
no observable effect in current window or tab
does not open any other tabs
does not render markdown
BEFORE YOU DO ANYTHING:
--
This may seem STUPID/OBVIOUS to most of you... I think I was still asleep when I first tried this... so:
make sure that your cursor is ACTIVE in your .MD markdown document, and NOT active on the filename in the Explorer
Tree in the left-hand Nav
apparently, in VSCode this shortcut SHIFT-COMMAND-V only works when you are ACTIVELY EDITING the file.
using the mouse on the RIGHT-CLICK context menu works fine
even if the .MD file isn't open AT ALL / in ANY EDITOR
even if you're actually actively editing A DIFFERENT FILE, if you hover over the filename in the Explorer/File-Folder Hierarchy,
RIGHT-CLICK and launch Mark Preview, it will work.
Quick Solution:
You most likely have a VSCode "Extension" installed and enabled within VSCode that is blocking the default VSCode shortcuts
in my case, this was Atom Keymap Extension (Here's link to extension in VS Marketplace)
IN VSCode, go to Extensions, find (you can search in the search bar at the top of the Extensions list/Nav Pane) Atom Keymap and UNINSTALL IT
alternately, you can just simplt DISABLE IT if you prefer to use it another time.
restart VSCode
SHIFT-COMMAND-V shortcut SHOULD BE WORKING NOW!
Troubleshooting:
Key Combo not recognized in VSCode (at least in VSCode, see#2 if blocked elsewhere)
If you look at the very bottom-middle/bottom-right of the VSCode window, you will notice the Status Bar (by default the whole bar is bright blue with white text)..
the status bar has several different sections, symbols, and text messages...
you will notice it changes/will indicate when you press a VALID Key-Combo... and that SHIFT-COMMAND-V literally does not result in ANY message on the status bar
But hitting COMMAND-V for instance is reflected in a real-time corresponding message in the status bar telling you that you DID press COMMAND-V
It appears NOT for any Key-Combo that includes SHIFT isn't recognized
confirm it's a VSCode thing only
go to your MacOS System Preferences > Keyboard > Shortcuts > look through each category of shortcuts - you should NOT SEE a key mapping for SHIFT-COMMAND-V

Disable multi cursor functionality

I do not like the Visual Studio multi cursor options, and I never use them.
Inevitably, I phantom-pressing some key combination that brings up a multi cursor option, then I write some code, and then the code is destroyed afterward. Please tell me how to completely disable all such functionality in Visual Studio Code. I am running on Ubuntu, but also interested in how to accomplish this on Windows (if there is any difference).
I should mention, that this happens literally once every 5 minutes to me on Ubuntu, but in Windows it happens much less frequently (like once an hour).
Un-check Selection->Column Selection Mode
You can remove the keyboard shortcut(s) that trigger this functionality.
Click on the gear on the bottom-left corner of the window and choose "Keyboard Shortcuts" from the menu. Type "Add Cursor" into the "Search" box and it shows only the commands that contain "Add Cursor" in their name.
Right-click on each command that add a cursor and has a keyboard shortcut associated and select "Remove Keybinding".
Also search for "Multi-Cursor". It could return the command "Toggle Multi-Cursor Modifier" that is associated to a combination of modifier keys (one or more of Ctrl, Alt, Shift). If such a combination of keys is pressed when you click in the editor window it adds a new text cursor at the click position. You should also removed these key bindings.
Set this settings in editor settings :
"editor.columnSelection": false,
In Android Studio :
Un-check Selection->Column Selection Mode

Visual Studio variables/methods outline and dropdown options?

Eclipse has something like this showing you the outlines of method declarations, imports, variables...
Is there something similar in Visual Studio 2010? I can't seem to find it.
Another thing is the context menu dropdowns.
In Visual Studio, I have to click on the underlined word:
And wait for that little blue underscore to pop up then I have to carefully hover over it like so:
for the drop down menu to pop up. Then I have to click on it to bring up the options.
In Eclipse I can hover over the underlined word and get the options about half a sec later OR hover over it and press F2 immediately to get the options.
Does anyone know if such features are available in VS2010?
For your first question, there is a window called "Class View" that may be similar to what you want. You can access it via CtrlWC.
For your second question, if your cursor is on the identifier that is underlined, you can type either of the following in order to open that same context menu:
Ctrl. (that's a period or dot)
AltShiftF10