I was looking at default keybindings but didn't find it.
Is it even possible by default to toggle between opened tabs in VS Code?
If no, maybe you know extension for doing so?
Thanks!
On a Mac, ctrl-tab does exactly what you're asking for. I'm not sure what the equivalent is for Windows or Linux.
In windows CTRL+PgUp to previous tab and CTRL+PgDown to next tab.
When using Visual Studio Code on Linux/Windows, you can use CTRL + PAGE_UP to switch to the previous tab, and CTRL + PAGE_DN to switch to the next tab. You also have the ability to switch to tabs based on their (non-zero relative) index. You can do so, by pressing and holding ALT , followed by a number (1 through 9).
For more details: check here
Related
(* I repost a question I asked previously, because I found the accepted solution was not perfect. *)
I'm using a Mac.
I have several VSCode windows opened.
I would like to switch between only 2 (last viewed) windows. Does anyone know what is the keyboard shortcut to do so?
I tried command + `, but it went through all the opened VSCode windows one by one. Similarly for option + tab.
I tried control + w, it went through all the opened VSCode window too unless you use up and down keys to select.
I also adopted [the solution]((https://stackoverflow.com/a/74924591/702977) by adding {"key": "alt+tab", "command": "workbench.action.quickOpenRecent", "when": "!inRecentFilesPicker"},. However the problem is, after switching window, we lost the focus, we need to click on the editor again before editing.
Could anyone help?
Use whichever solution from that previous question you posted that you prefer, and then use ctrl+<number> to focus the editor pane you want, where <number> is the 1-indexed number of the editor pane you want to focus. (it's 1-indexed because ctrl+0 is for focusing the sidebar).
This tells me that I could use ⌃ + Space combination in order to display suggestions for my code. However, ctrl + Space ( ^ key is ctrl as far as I know) only seems to change the input language keyboard in my system. Nothing else seems to work.
Try Option + Escape, on mac.
The mac keyboard shortcut ctrl + space for switching input sources overrides the VSCode one. Because of this, VSCode added a new keybinding just for mac, Option + Escape
This is actually called intellisense, and the new keyboard shortcut was added in the November 2019 update.
You can disable the macOS shortcut in System Preferences → Keyboard → Shortcuts.
Alternatively you can set up a custom keybinding for this command in VS Code, so that it no longer conflicts with your system shortcut. Please refer to the official documentation.
Recently, ⌘I (i.e. command + i) is also a by default key binding for triggering suggestions.
On MacOS Ventura,
Go to System Settings
Select Keyboard on the Left panel
Select "Keyboard Shortcuts"
Select Input Sources and toggle the switch labelled "Select the previous input source".
Quit vscode and relaunch
Tab key is not working for abbreviation in visual studio code.I have tried lot.How can I fix the problem?I am frustrated.Thinking of using Bracket instead of visual studio code.
In my case
Using (Ctrl + M) return Tab button to its normal working status.
I think you may be asking about this setting:
// Insert snippets when their prefix matches. Works best when
'quickSuggestions' aren't enabled.
"editor.tabCompletion": true,
That is set to false by default, change it to true.
Don't change any keyboard shortcut or something else. You should change the language mod right bottom on the editor. It was selected javascript by default. You should change with Javascript React after that this changes all emmets suggestions is working.
For Visual Studio code version 1.33, go to File > Preferences > Settings Search for tabcompletion and by default it is off, select on, that is it, you are done.
Pressing Ctrl+M did not disable the mode for me, however the right side of the bar along the bottom of vs-code shows Tab Moves Focus as enabled, which you can click to disable.
How can I set bookmarks in Visual Studio Code? I can't find any keyboard shortcuts.
Or is there anything else that I can use instead?
Yes, via extensions. Try Bookmarks extension on marketplace.visualstudio.com
Hit Ctrl+Shift+P and type the install extensions and press enter, then type Bookmark and press enter.
Next you may wish to customize what keys are used to make a bookmark and move to it. For that see this question.
You need to do this via an extension as of the version 1.8.1.
Go to View → Extensions. This will open Extensions Panel.
Type bookmark to list all related extensions.
Install
I personally like "Numbered Bookmarks" - it is pretty simple and powerful.
Go to the line you need to create a bookmark.
Click Ctrl + Shift + [some number]
Ex: Ctrl + Shift + 2
Now you can jump to this line from anywhere by pressing Ctrl + number
Ex: Ctrl + 2
Visual Studio Code currently does not support bookmarks natively. Please add this as feature request to our Git Hub issue list (https://github.com/Microsoft/vscode).
In the meantime there are some ways to navigate around the code based on your navigation history. You can Ctrl+Tab to quickly jump to previously opened files. You can also navigate within your code based on cursor positions using Goto | Back and Goto | Forward.
Both VS Code extensions can be used:
'Bookmarks'
'Numbered Bookmarks'
Personally, I'm suggesting:
Numbered Bookmarks, with 'navigate through all files' option:
ctrl + Shift + P in VS Code
In newly open field, type: Open User Settings
Paste this key/value: "numberedBookmarks.navigateThroughAllFiles": "allowDuplicates" (allow duplicates of bookmarks),
Or, paste this key/value: "numberedBookmarks.navigateThroughAllFiles": "replace"
NOTE
Either way, be careful with shortcuts (Ctrl+1, Ctrl+Shift+1,..) that are already assigned.
Personally, mine were in 2 conflicts, with:
VS Code shortcuts, that already exists,
Ditto clipboard (I've got paste on each call of bookmark)
The bookmarks extension mentioned in the accepted answer conflicts with toggling breakpoints via the margin.
You could do the same with breakpoints and select the debug tab on the left to see them listed. Better yet, use File, Preferences, Keyboard Shortcuts and set (Shift+)Ctrl+F9 to navigate between them, even across files:
If you are using vscodevim extension, then you can harness the power of vim keyboard moves. When you are on a line that you would like to bookmark, in normal mode, you can type:
m {a-z A-Z} for a possible 52 bookmarks within a file. Small letter alphabets are for bookmarks within a single file. Capital letters preserve their marks across files.
To navigate to a bookmark from within any file, you then need to hit ' {a-z A-Z}. I don't think these bookmarks stay across different VSCode sessions though.
More vim shortcuts here.
No extension
As an alternative you can do Ctrl + P as "Go to file" in your workspace and type:
partial name of your file and/or extension.
type # + any name of method, property, variable, class (symbol) etc.
in currently opened file navigate between symbols with #
I found it more convenient than Bookmarks extension. Of course it depends a lot on your naming conventions and how well you know your codebase.
Under the general heading of 'editors always forget to document getting out…' to toggle go to another line and press the combination ctrl+shift+'N' to erase the current bookmark do the same on marked line…
I use TAB and Shift-Tab in Visual Studio to indent an entire selection. This does nothing in Eclipse, and I can't seem to find another way to do it.
Update: I wasn't really paying all that much attention to this initially and did not ask the question correctly.
I now realized that it is in XML files where TAB still does not indent a selection. I did not find a setting for this in the properties, so I assume it is not possible.
Tab and Shift+Tab are the normal ways to do this in Eclipse, just like in Visual Studio.
In addition to the keyboard shortcuts, you can also do this from the Source menu. Source -> Shift Left, and Source -> Shift Right.
Have you checked to make sure tab/shift tabbing is working as you expect in other applications? Is there a stuck key on your keyboard preventing the shortcuts from working? Could another application be stealing the keyboard shortcuts? (as odd as that sounds...)
Also, try restarting Eclipse.
ctrl + i ---> it is for making accurate indentation to a block of source code.
Go to Window Menu -> Preferences -> Java -> Editor -> Typing and make sure the `'Tab key adjusts the indentation of the current line' checkbox is ticked.