I would like to type in a terminal:
openInVim file.txt
And it will open the file in my vim unique instance
For example if I type:
openInVim file1.txt
# do some stuff
openInVim file2.txt
I want to have one vim open with the two files load
How can I do that?
EDIT : I don't want open two files at the same time from the terminal I want to open a file in a single instance of vim from multiple terminal
Updated question - how to open a new file in an existing Vim window from the terminal (if i understand correctly).
Use the --remote
option:
$ gvim file1.txt
$ gvim --remote file2.txt
See http://vim.wikia.com/wiki/Open_file_in_already_running_vim_from_elsewhere for details.
Original question - Here's how you open 2 files from the terminal in a single Vim window (I'm assuming here that "openInVim" is actually the vim
or gvim
command).
Open 2 files in 2 buffers:
openInVim file1.txt file2.txt
Open 2 files in 2 tabs:
openInVim -p file1.txt file2.txt
Open 2 files in split window:
openInVim -o file1.txt file2.txt
Open 2 files in vertically split window:
openInVim -O file1.txt file2.txt
and of course, all of this works with more than 2 files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With