20

in most GUI text editor I can use ctrl click to open multiple files at once. I can't do that in gvim.
What the gvim way to do it?
Tnx.

-edit- ...using gui way instead of command line.

1
  • tnx 4 the answers but none are solutions that I really wanted. Btw, I use ubuntu linux.
    – mhd
    Mar 21, 2011 at 4:49

7 Answers 7

21

Easy:

gvim -p file1.c file3.c ...

or:

gvim -p *.c
3
  • 2
    Weird, this is only opening 10 files max for me on gvim 7.4 Ubuntu 16.04. Jul 29, 2016 at 6:24
  • Same thing just happened to me with vim 9.0 on Devuan 4. It seems to be a vim limitation.
    – Pierre
    Aug 11, 2023 at 16:47
  • The title bar will print how many files are open. Go to Buffers -> FILENAME (see list of files at the bottom) to navigate through the multiple open files.
    – Sergiu
    Dec 19, 2023 at 16:44
9

gVim opens multiple files in buffers.

:tab ball

will open these buffers in their own tabs. I guess you could add this command to your _vimrc to make it happen each time gvim runs.


In Windows: gvimext.dll: Support loading files into a VIM tab

  1. Select multiple files (with CTRL-Click)
  2. Right-Click to get context menu
  3. Click "Edit with single Vim using tabs"
3
  • The extension DLL seems to be out of date.
    – atoumey
    Apr 11, 2012 at 16:24
  • @atourney: The extension DLL works fine for me. I'm using gVim 7.3.46 with Windows 7 64.
    – Leftium
    Apr 12, 2012 at 0:58
  • For some reason, I don't have :tab command. But something similar exists on my gvim 7.2 - :tabnew. Sep 30, 2019 at 14:47
3

You can open multiple files in gvim. After you've selected the files you want to open, right-click and select "Edit with single Vim". Vim will initially display only the first file, but all the file names are in Vim's argument list. Execute

:n

to open each file in the list one at a time (:N to go back), or

:all

to see all the files at once, each in a different Vim window, or

:tab all

to see each in a different tab.

3

This is a partial registry fix (selecting multiple files and right-clicking Edit with gVim opens those files in different tabs in the same window)

[HKEY_CLASSES_ROOT\Applications\gvim.exe\shell\edit\command]  
@="C:\\Program Files\\Vim\\vim70\\gvim.exe --remote-tab-silent \"%1\""
1
  • In the PATH above - One has to FIX the value of version of VIM. As mentioned above, version of VIM in PATH is shown as "vim70" and needs to be changed according to the installation in target machine.
    – Amit Verma
    Jan 3, 2015 at 21:59
3
  • Open files:

    vim {file1,file2,...}
    

    in buffers, then use

    :ls (list), :n (next), :p (previous), :b<N> (open file N), :b [press TAB]
    
  • Open in tabs:

    vim -p <files> 
    

    as polemon wrote, then use same commands as above

  • Open in multiple windows :

    vim -o {file1,file2,...}
    

    Then see e.g. http://www.cs.oberlin.edu/~kuperman/help/vim/windows.html

2

You can open multiple files in single split window using

gvim -O file1.c file2.c ... (split vertically)
gvim -o file1.c file2.c ... (split horizontally)

or

in multiple tabs using

gvim -p file1.c file2.c ...

If you have more than 10 file to open then use following commands

:set tabpagemax=99 (or number of tabs you want to open)
:tab ball (to open all the files in buffer in tabs)
1
  • This works! Thanks..
    – Enis Arik
    Jan 10, 2023 at 11:03
0

You may also TRY following by adding:

autocmd BufReadPost * tab ball

in VIM RC file in VIM version 7.X (Works for Windows 7/8)

More Details Here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .