In VSCode, how do I create a heterogeneous vertical split contained completely within a single column? I would like to define a column such that the terminal is on top, a text editor is on the bottom, and neither this terminal nor this editor intrudes into the other columns. Is that possible?
This will be very easy with vscode1.58, due out this week. Because you can drag a terminal to the editor area.
First create your vertical split so you have two columns. Then just drag a terminal into the upper half of the right-hand split. Then close your Panel (where the terminal was).
Also there are some move the terminal commands you can make keybindings out of:
See more https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_58.md#terminals-in-the-editor-area
Related
I'm a longterm user of Notepad++ and new user of VSCode, where I think the column mode workflow is rather poor. I'm seeking help to reproduce the NPP workflow so far as is possible.
In NPP it goes like this:
hold down AltGR (right hand Alt key)
select column with mouse
copy to clipboard
choose destination top left anchor
paste
Pasting overwrites whatever was there before with the clipped column, which is clear and obvious.
The column always pastes exactly as selected. Whitespace is auto-created before the column if it's pasted into a blank area.
In VSCode I have to
select top or bottom corner of intended column
hold down left hand Alt plus shift
select column with mouse
copy to clipboard
use same technique to choose destination column
paste
I use a mouse in my left hand. The key combination requires a really awkward reach across the keyboard. Attempting to use AltGR as a keybinding shows it to be 'Alt' the same as the key on the left. But it doesn't work as Alt for binding column mode so I can't use the right hand pair.
Unless the destination column is accurately chosen pasting will overwrite with the clipped contents including introduced linebreaks but not respecting the column indentation. For instance clipping a 3 line column and pasting into a 2 line selection produces the most extraordinary mess. Counting lines manually is fine with just two or three but rapidly becomes absurd.
Pasting into a blank area isn't possible.
Pasting into whitespace is governed by indentation rules. I've turned them off, so pasting a column puts the first line in the right place and the rest at the margin. That isn't ever likely to be what's actually wanted.
To my mind the workflow is backwards: in my head it goes 'I want column mode, now I'll choose the column' not 'I'll choose some anchor and then invoke column mode'. Maybe that's just me.
So I'm finding it all very unnatural. Can anyone suggest which if any parts of this can be changed for the better please.
You can use middle-click-drag to do what you want, although it's pretty awful.
In the Search pane of the program, after I hit Enter, all files are listed, with some expanded to show results in a file, and others collapsed. I'm wondering firstly what determines the expansion of any given file, and secondly what I can do to expand all of them at once.
This question seems closest to mine, but it's about a different IDE, and the key commands it suggests for Windows had no apparent effect: Automatically expand all in Eclipse Search results
See this setting:
Search: Collapse Results in the Settings UI or
search.collapseResults: alwaysExpand in your settings.json file
The options are auto,alwaysCollapse, and alwaysExpand. auto is the default.
auto: Files with less than 10 results are expanded. Others are collapsed.
So you want the alwaysExpand option.
You can also toggle any file expanded/collapsed with the Space key or just expand any collapsed file with RightArrow.
Collapse with LeftArrow and collapse all with Ctrl+LeftArrow. Oddly, there is no expandAll binding or command.
And see https://stackoverflow.com/a/67307225/836330 for a command to collapse all the results that you can set to a keybinding:
workbench.files.action.collapseExplorerFolders as in
{
"key": "alt+l", // whatever you want
"command": "search.action.collapseSearchResults",
"when": "searchViewletFocus" // if you want to limit it when focus is already on the search results area
}
in your keybindings.json.
v1.41 is making expanded search results the default, see https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_41.md#search
Expand all search results by default
Previously, if a full text search returned more than 10 results in a
single file, it would appear collaped in the results tree. However,
this sometimes made finding a particular result difficult, so with
this release all results will appear expanded. You can set
search.collapseResults to auto to revert to the old behaviour.
And see Visual Studio Code - Include context in search results for showing the search results in an editor.
There are two quick ways to expand all at any time:
Click the icon in the top right of the search panel that has a "+" inside a square. This toggles all items expanded/collapsed.
Use the command palette (Cmd-Shift-P) to trigger the "Search: Expand All" command. To make it quicker to access, you can add a custom keyboard shortcut: when looking at the "Expand All" search result in the command palette, click the gear icon next to it and it will take you to an editor for adding a shortcut binding.
Both of these only work for the Search panel though – despite the similarity, they do not work for the "Find All References" results panel.
In Sublime Text I can use the following shortkeys:
ALT+SHIFT+2 : create two columns
ALT+SHIFT+3 : create three columns
...
I want to be able to do the exact same thing in VSCode (without downloading the Sublime Text keybinding since I want the rest to stay the same)
If you search for columns within the "Keyboard Shortcuts" editor, you wil see these options:
workbench.action.editorLayoutTwoColumns
workbench.action.editorLayoutThreeColumns
They are unbound to any keyboard shortcut by default. Click the plus sign to the left of each of these commands in turn and you will get a dialog box where you can enter your chosen keybinding for each and you are done.
I like the split view mode in VS Code but one thing I can't figure out is how to maximize a split view temporarily.
I would like to be able to maximize a split window (as in on one of the windows of a split) for a moment and then restore the layout when I am done with it.
v1.38 has a new command:
workbench.action.toggleEditorWidths
which can be useful here. It is unbound to a keybinding by default.
Say you bind it like so:
{
"key": "ctrl+alt+b",
"command": "workbench.action.toggleEditorWidths"
}
Then use it once to maximize one of the splits - after that switching focus to either one will maximize that one easily. Basically, using the workbench.action.toggleEditorWidths command once will do the work of manually dragging the separator bar for you.
Before v1.38
From the July 2018 Release Notes: Automated maximize of minimized editors.
To get this to work you have to first manually minimize one of the splits (or editors in an editor group).
Drag the separator bar between the editors as far left (or right) as it will go.
Or use the command View: Maximize Editor Group.
Then clicking in or otherwise focussing (perhaps with workbench.action.focusLeftGroup or similar) the other split will maximize it.
Note: You can always maximize the active editor via View: Maximize Editor Group (workbench.action.minimizeOtherEditors) or reset all editor sizes via View: Reset Editor Group Sizes (workbench.action.evenEditorWidths).
Command + J and Control + B can be used for Mac.
View: Toggle Side Bar Visibility
View: Toggle Panel
Or, Just double click at the file name in the title bar (tab bar) (the one inside your split panel, not the top most one).
I'm trying to use the multi cursor functionality of vscode on a large(ish) file.
the file is too large to select every line individually with ctrl-alt-up or down. In sublime-text I would select everything and push ctrl-shift-l. Is there a similar thing in vscode. I've tried using a regex search for ^, but that gives me an error stating "Expression matches everything".
The command Selection / Add Cursors to Line Ends altshifti will put a cursor on every line in the current selection. (For mac use optshifti)
Tip: You can pull up the keyboard shortcut reference sheet with ctrlk,ctrls (as in, those two keyboard combos in sequence).
(For mac use cmdk,cmds)
Hold Alt+Shift and select the block. Then press End or Right button.
You get selected individual lines.
I use version VSCode 1.5.3 in Windows.
Hold Alt+Shift+i
Hold Home (fn+-> Mac) for right-most or End for left most(fn+<- Mac)
This feature is actually called split selection into lines in many editors.
Sublime Text uses the default keybinding, CTRLSHIFT L
VSCode uses ALTSHIFTI
For Atom you actually need to edit your keymap to something like this
'.platform-win32 .editor, .platform-linux .editor':
'ctrl-shift-L': 'editor:split-selections-into-lines'
Real Lines vs Display Lines
First we have to understand the difference between Real Lines and Display Lines to completely understand the answer of the question.
When Word Wrap is enabled, each line of text that exceeds the width of the window will display as wrapped. As a result, a single line in the file may be represented by multiple lines on the display.
The easiest way to tell the difference between Real Lines and Display Lines is by looking at the line number in the left margin of the text editor. Lines that begin with a number correspond to the real lines, which may span one or more display lines. Each time a line is wrapped to fit inside the window, it begins without a line number.
Cursor At the Beginning of each Display Lines:
Cursor At the Beginning of each Real Lines:
Answer to the Question
Now that we know the difference between Display Lines and Real Lines, we can now properly answer the actual question.
Hold AltShift and select the text block.
Press Home to put cursor on the beginning of every Display Line.
Press End to put cursor on the end of every Display Line.
Press HomeHome (Home twice) to put cursor on the beginning of every Real Line.
Press EndEnd (End twice) to put cursor on the end of every Real Line.
Please understand that AltShiftI put cursor on the end of every Real Line.
Install the extension Sublime Commands.
[Sublime Commands] Adds commands from Sublime Text to VS Code: Transpose, Expand Selection to Line, Split into Lines, Join Lines.
(Don't forget to add the keybinding(s) from the extensions details page to your keybindings.json)
Doesn't VS Code already have a "split into lines" command?
Yes, yes it does. However it differs from the one in Sublime.
In VS Code, when you split into lines your selection gets deselected and a cursor appears at the end of each line that was selected (except for the last line where the cursor appears at the end of the selection).
In Sublime, when you split into lines a cursor appears at the end of each line (with the same exception as in VS Code) and the selection is divided on each line and "given" to the same line.
I have the same problem, i'm used to Alt + drag to do 'box selections' in visual studio but it does'n work in code.
It seems to be impossible for now to do it differently than by selecting every single line.
However plugins should be supported soon so we will likely see a plugin for this if not implemented directly by microsoft.
From visual studio uservoice forums:
We plan to offer plugin support for Visual Studio Code. Thank you for your interests and look for more details in our blog in the coming weeks. http://blogs.msdn.com/b/vscode.
For the preview we are looking for exactly this type of feedback. Keep it coming.
Sean McBreen – VS Code Team Member