Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Fernando Tricas García
Fernando Tricas García

Posted on

     

So, you want to open two files in vim?

I'm preparing some shellscripts to avoid repetition of some usual tasks. Some of them involve opening a file and then using the:split command invim.
Is it possibleopen two files like this from thecommand line?

Indeed, it is, you can use thevim -o file1 file2 command. In this way vim will show the two files in split view, the first one in the upper section and the second one in the bottom section.

Top comments(2)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
moopet profile image
Ben Sinclair
I've been a professional C, Perl, PHP and Python developer.I'm an ex-sysadmin from the late 20th century.These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
  • Location
    Scotland
  • Education
    Something something cybernetics
  • Pronouns
    They/them
  • Work
    General-purpose software person
  • Joined

You can also use-O for vertical splits, and if you omit either flag (and presumably havehidden set), you will open them in hidden buffers, so you can navigate with:ls,:b <n> and:next and so on.

You can open all your buffers in splits at any time with the best command in Vim::vertical ball.

CollapseExpand
 
fernand0 profile image
Fernando Tricas García
El mundo es imperfecto. Puedes hacer algo para mejorarlo. O no. Puede que lo consigas. O no.
  • Location
    Zaragoza, Spain
  • Work
    Ass. Professor at Universidad de Zaragoza
  • Joined

Nice, thanks. For thist matter I prefer using horizontal split but sometimes vertical is useful also.

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

El mundo es imperfecto. Puedes hacer algo para mejorarlo. O no. Puede que lo consigas. O no.
  • Location
    Zaragoza, Spain
  • Work
    Ass. Professor at Universidad de Zaragoza
  • Joined

More fromFernando Tricas García

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp