Stop notepad from opening multiple same instances - notepad

How do I open only one instance of the same text file using Windows Notepad (Not Notepad++)?
For example right now if I open my notes.txt, it opens an instance, but if I click and open the same notes.txt again, it opens another same instance thus having two same files left opened. This causes confusion when it comes to saving my work sometime.
How do I resolve this? Thank you.

On Windows 7 and 10 you can create a shortcut to the txt file and it will go to the open Notepad window for that file instead of opening a second instance.
Sadly as of Windows 11 this no longer works.

Related

Open Same VSCode File Buffer in Multiple Windows

Is it possible to open the same file buffer(editor) in multiple VSCode windows? This is not the same as opening the same file more than once. In the later, if you forget to save edits in one window, and then save different edits in another window, you end up with conflicts. I'm curious if it's possible to have the same buffer opened (mirrored?) in different windows, such that the view is identical for that file across all windows. So if I make changes in the file (even before saving), those changes also show in every other window that the buffer is opened in. I've searched around a lot but can't really find anything. Thanks.
Use the Split Editor command: Ctrl + \.
You can also use the icon in the top right. Hold Alt to split down.

Avoid VIsual Studio Code terminal to change its size when opening a file from it

In the Visual Studio terminal, having it expanded to full size (that is, it occupies the whole editor), if a file is opened by writing code <name_of_file>, the file will open and the terminal will be restored to a smaller size.
Is there any way to modify this behavior so, when opening a file, the terminal window either does nothing or it gets completely minimized and the focus is transferred to the new file editor?
After investigating a bit, as this youtube tutorialvideo explains, a partial solution for the problem above is using Panel: Opens Maximized. I say partial because, while that option will make the terminal always open maximized, if a file is opened from it, it will still be restored to a 'medium' size.

VSCode: Can I open individual files instead of workspaces?

Opening whole directories (each one requiring a new window) doesn’t play well with editing lots of little scripts/config files scattered in different folders.
Yes, you can! Here are three ways:
Either by running code {yourfilename here} in a terminal.
Dragging the file from a file explorer onto the open VSCode window.
Use the menu item "File/Open file... (Ctrl + O)", see image.
You don't have to open a folder in VSCode!
In VSCode create a New Window (instance) and open all the files you're interested in from anywhere on your disk.
If you want to keep this selection for later, you can Save Workspace As .. for later usage.

How to get VSCode to "open as new file" from Go To File dialog

I have recently switched to VSCode, and am loving it, except for one specific thing that drives me nuts.
My "goto" command is {Command+P}, the easy search-and-open-file bar. If I type the name of a file into this bar and it does not exist, I want to be able to hit ENTER and have it open a tab editing that file as a new file. This is the behavior I would get in old-school Windows Notepad, or in mvim :e <filename>, but I can't figure out how to do it in VSCode.
Is there a toggle or a plugin I can use to get this behavior straight out of the Go To File dialog?
Answering my own question:
No, there's no way to do this using {Command+P}. This is strictly a file finder and I've yet to see any plugin that changes the behavior.
If you're using the VsCodeVim plugin, an almost-as-good approach is just :e <file> - immediately open a new buffer editing the given file. There's no tab autocomplete this way, but you just have to live with that.

Visual Studio Code - Tabs (editors) of the same project in multiple screens

Using multiple screens I normally place multiple classes (files) in different screens, this helps me a lot while refactoring, checking tests and comparing changes.
Visual Studio Code does not allow me to drag a tab outside the window and view it in (for example) another monitor.
I checked the documentation and plugins, but the only way I found, is to open two windows, pointing to the same project (folder) and put those in different screens.
I don't like this solution, that causes also some problem when I watch code changes using TypeScript.
Any suggestion?
I use Windows 10, latest version of VSCode.
A solution is to press CTRL+K and after releasing CTRL, press O.
This will open the current file in a new window.
There are few things I don't like about this solution:
- Drag and Drop does not work
- Create a new instance of VS Code resulting in (for me) 180MB of ram used
- To open the file it takes to me few seconds (quite slow)
- The file remains open in the original window as well
Update 20/03/2019:
There is a feature request you can track here:
https://github.com/Microsoft/vscode/issues/10121
And an explanation about why this is difficult to implement here:
https://github.com/Microsoft/vscode/issues/10121#issuecomment-345770248
Update 20/03/2019:
Another important side effect highlighted by #Mär is that:
the IntelliSense fails to establish references it had when the file
was opened in the window, where the entire project is opened
The easy way but with the same drawbacks. More ram and resources will be used. Is to wrap your project in a folder.
It's the best possible thing. As by now!
=> Duplicate the workspace.
Open the command pannel ctrl+shift+p or F1.
Then write dupl
You'll get that
That's it.
More
If you want to add more folder to the working space.
=> go to File then Add Folder To Workspace
You can add as many as you like.
 Also better more
You can open a new window (ex: ctrl+n)
And then go File > Add Folder To Workspace.
And start adding folders to your new Workspace. You can add any folder, that is already open or not. That's too way great. You can have all the needed folders for example in the second screen.
A little hack I used is to just stretch the editor window to fill both screens and split the view pane between the monitors such that both screens show just one open file.
This is a cheap hack that works without opening multiple instances of VSC.
It may not be the proper solution, but it works without eating up all my system memory.
I found the following way to work on multiple monitors (important: they must be the same size and resolution):
open a visual studio in windowed mode on the 1st monitor (in my case it is a left monitor)
move the window to the (left) top corner
stretch window to the 2nd monitor (right) bottom corner
split screen by clicking “split editor” several times
move the code sections separator to the edge between the monitors
This is old qestion, but such way can be useful for someone. It is not very convenient, but it works. The solution may have already appeared in the VS itself, but I didn't find it.
Visual Studio Code does not allow me to drag a tab outside the window and view it in (for example) another monitor
Actually, VSCode 1.57 (May 2021, 4 years later) will propose something close:
Improved editor drag and drop across windows
Support for dragging editors to other windows was improved in this release. You can now drag diff editors, custom editors and the entire editor group to another window to open the editors there.
My solution was to use Remote-ssh to connect to self and open in another window. This does take extra resources. But I find this comfortable as I don't need to create additional workspace.
For me on Ubuntu the solution was to create a project folder symlink and ope it in a new window (as it won't open the same folder in another window)