How to avoid opening duplicate files in new windows in gedit?

Having already opened several text files with each in one tab in a window, now open another text file,

  1. gedit sometimes creates another window instead of a session under the current window. I wonder if it is possible to control whether to open the next file under the current window, or in a new one?
  2. if the text file has already been opened, gedit sometimes open it again in another window, and ask me if I want to edit or not. I was wondering how to make gedit not to open a file already opened?

Thanks!


If you open the file from gedit (Ctrl+O, or use the big 'Open' button shown) it will open the new file in a new tab. If you open new files from Nautilus (or another file manager), it may or may not. Also, as @harisibrahimkv points out, files with different permissions/users will be handled differently.

gedit file open dialog