vimer launches a new instance of GVim or MacVim.vimer foo.txt bar.txt opens both files in the same instance of GVim or MacVim.There is a script called Vimer that takes care of these corner cases and opens files in existing instance of GVim or MacVim. However, running gvimrem alone would lead to an error because the -remote-silent option must always be followed by one or more filenames. Otherwise, a new gvim instance is started.įor interactive shell sessions, it would help to define a shorter alias, such as:Īlias gvimrem='/usr/local/bin/gvim -remote-silent' If gvim is already running, the file is opened there. usr/local/bin/gvim -remote-silent FILENAME " If the v:servername ends with a number, then this is for sure a secondĮcho "MyWarning: Another copy of gvim or Vim is probably loaded!"įor users running gvim on Unixes, an alternative is to always use I am using gvim on Windows, but this will probably also work with gvim in other systems. Read Vimer's Getting Started Guide for more details.įor example: opening a file already open in the first Vim instance within a second instance of Vim gives an error message, because the swap file is already in use (not to mention that this might cause a loss of data). If you would rather want to open the files as new tabs (not buffers) in existing instance of GVim/MacVim, then use the -t option with Vimer like this: vi -t foo.txt. ![]() ![]() Then just run vi foo.txt on the terminal and Vimer will ensure that the new file is always opened in a buffer of an existing instance of GVim/MacVim (not a new one). You can download the script and just rename it to vi (on Linux or macOS) or vi.cmd (on Windows) and place the script in a directory that appears in the PATH environment variable. This script is available for Windows, Linux and macOS. Use Vimer tool to ensure that whenever a new file is opened from terminal, it opens as a new buffer in an existing GVim/MacVim window (not a new instance of GVim/MacVim). For me, the most irritating thing when using GVim/MacVim is starting a second copy of GVim/MacVim while a first one was already running.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |