Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I open a file in another window in VIM through the terminal?

Tags:

linux

vim

ubuntu

Say I want to open the file "main.cpp". I have my linux terminal open in the correct directory. Normally, I just type "vi main.cpp", but this opens the file in the shell window. How do I open the file in another window?


1 Answers

You can do it using two steps:

  1. :vs (vertical split) or :split (horizontal split)
  2. :open (path to filename)
like image 131
Royston Pinto Avatar answered Oct 26 '25 06:10

Royston Pinto



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!