How can I select active (focused) editor in the page when I have multiple CodeMirror editors?
Loop through each codemirror instance and detect focus using editor.hasFocus().
Related
In VS Code, whenever I'm in the split view (when I have multiple editor groups) and want to switch tabs with ctrl+tab, the tab switches fine until I reach the last tab on that active window (editor group). Then, instead of looping back to the first tab, it switches to the other split view window (editor group) instead.
I tried to see if there was any setting to disable this behavior but I couldn't find anything. Duplicating the other window instead of using split view works but isn't the best for my workflow.
Does anyone know of any setting to change the behavior so that it goes back to the first tab instead of switching to the other split window?
Note: I cannot reproduce this on Ubuntu.
For me, I can focus editor groups (what you are calling "splits") by number by using ctrl+<number>, or by directional navigation using ctrl+k,ctrl+<direction>, and open a quick cycle popup to cycle between editor tabs in the focused editor group by using ctrl+tab and ctrl+shift+tab. I can also focus editor tabs in an editor group by index in that editor group using alt+<index>.
For more similar info including default keybindings on other OSes, see Is there a quick change tabs function in Visual Studio Code?.
What you are probably interested in is the distinction between the following commands:
View: Open Next Editor (bound by defaut on Windows and Linux to ctrl+PgUp)
View: Open Next Editor in Group (bound by defaut on Windows and Linux to ctrl+k,ctrl+PgUp)
The first is for cycling through editor tabs in all editor groups (which is the behaviour you don't want), and the second is for cycling through editor tabs in the currently focused editor group (which is the behaviour you do want, and which has no default keybinding).
If you don't like the default keybindings, just edit them to your liking (edit keybindings for the workbench.action.nextEditorInGroup command).
How to set the keyboard shortcut in vscode to alt + left_click for placing multiple cursors?
I could not find it in the 'keyboard shortcuts' section.
I found one named createCursor but couldn't add any mouse input.
You set the modifier in your settings.json or with the GUI
editor.multiCursorModifier
search for multi cursor in the GUI
How can I change activeEditor programetically in tinyMCE.
Ex:
Like if I have two editors in same page, How can I switch between them programetically?
The activeEditor will switch when you focus a different editor so the method is to call focus on the editor you want to be active. You can choose to not actually focus the editor by passing false.
https://www.tiny.cloud/docs/api/tinymce/tinymce.editor/#focus
Extract from that page:
focus
focus(skipFocus:Boolean)
Focuses/activates the editor. This will set this editor as the
activeEditor in the tinymce collection it will also place DOM focus
inside the editor.
Parameters
skipFocus (Boolean) - Skip DOM focus. Just set is as the active editor.
We can get any instance of TinyMCE by tinyMCE.get('field-name') or by tinyMCE['field-name'] here field name will be the field TinyMCE is associated with.
How do you unsplit an editor, go back from 2 code views to 1, same with terminal.
Editor Groups
To "unsplit" editor groups without closing any open files, use the menu-bars: View > Editor Layout > Single (or, while in the editor, press and release ALT and then type vls).
Editor groups are also closed by default when they become empty. You can empty an editor group by closing tabs/files or by dragging all of the tabs from that group to another.
Hints:
Grabbing the area to the right of the tabs allows you to drag/drop all tabs in a group at once.
The "Open Editors" section of the "Explorer" panel lets you use CTRL and SHIFT to select and drag/close multiple editors at once. (If you don't have an "Open Editors" section, use the "..." menu of the Explorer panel to enable it.)
Terminal Groups
Terminals work differently than editor groups and are more limited:
You can open new terminal groups by pressing the '+' icon in the terminal tab of the panel.
"Splitting" a terminal (done by clicking the split icon in the terminal tab of the panel) really just opens an additional terminal in the same group and displays it side-by-side with the others in the group.
So, two ways to "unsplit" terminals:
Kill terminals (e.g. with the trashcan icon) until there is only one left in the group.
Switch to a new terminal group with only a single terminal in it.
(as of Visual Studio Code version 1.29.1)
By mouse
To close or unsplit a split Editor you need to
either close all the tabs in the split side you want to close
or right-click on one of the tabs in the section you want to close and select Close All.
By keyboard
To close or unsplit split Terminals:
type exit in the terminal you want to close.
Note
The split Editors will not close when you close the tabs if you have in your settings "workbench.editor.closeEmptyGroup" : false
Editors:
View: Join Editor Group with Next Group workbench.action.joinTwoGroups
View: Join All Editor Groups workbench.action.joinAllGroups
Terminal:
Terminal: Kill the Active Terminal Instance workbench.action.terminal.kill
ctrl+\ to split
ctrl+w to unsplit
F1 > View: Join Editors of Two Groups
Default keybindungs for join/split editor (macOS)
join current view/group with next group (just press multiple times if you have multiple groups):
alt+cmd+1
split current view/group:
alt+cmd+2
To avoid this "VSCode irritation no. 1", you also have, beside "View: Join Editor Group with Next Group", a way to avoid the issue entirely, with VSCode 1.52 (Nov. 2020)
New setting to disable editor group splitting on drag & drop
A new setting workbench.editor.splitOnDragAndDrop allows to disable editor group splitting when using drag & drop of editors.
There is also a way to toggle this conditionally during the drag and drop operation when you press and hold Shift key (macOS) or Alt key (Windows, Linux).
Split current file (Ctrl+\) is a combination I can constantly hitting by mistake so I just removed the shortcut.
Command Palette
Preferences: Open Keyboard Shortcuts (JSON)
Paste the following object in the array:
{
"key": "ctrl+oem_5",
"command": "-workbench.action.splitEditor"
}
I'm working on VSCode (last version) and sometimes I work with splitted panels.
I can't find a way to achieve same behavior than a Ctrl + Tab but for panels.
It currently sends me to another tab in the current panel.
In vscode these are referred to as editor groups and can be switched between using either:
CTRL+K, CTRL+LeftArrow/RightArrow
to move focus through the editor groups. If you only have two active groups then this is equivalent to what you describe. This is the under Focus Next Group/Focus Previous Group in the keyboard shortcut settings so you could remap this to something else if you prefer.
or
CTRL+1/2/3
To specify focus in editor group 1/2/3