Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Pretty much explained in the title, I want to search for a term with command t and open more than one file at a time, so I would like to find a way to keep the search window open after opening a new file.

A function that would fuzzy search and open all files in new split windows would be ideal.

Thanks for your time

---- EDIT ----

I suppose I could make my question more clear, so here it is.

I am looking for a way to: 1) Find files containing a pattern 2) Select the ones I actually need to edit 3) Open them in split windows

I do not mind if I do it from withing vim or from the terminal.

For example, if I could open a CommandT file search window, and then map control+enter to open the selected file AND keep the list of search results open, I would have the ideal solution.

share|improve this question

Your question is not very clear. Do you want to do it with Command-T? With another plugin? With built-in Vim features?

With Command-T

A quick look at its documentation suggests that Command-T doesn't do that. Did you check the plugin's issue tracker? Maybe someone has submitted a patch or a feature request?

With another plugin

CtrlP is similar in spirit to Command-T but slightly different in design. It has the ability to open several files at once.

With built-in features

Vim can't do fuzzy matching but it is pretty powerful nonetheless. You can do:

:args file1 file2 file3 | argdo split

and benefit from * and ** as well as tab completion.

Drew Neil did a series on the arglist a few months ago. You can start with this one.

share|improve this answer
@romaini commandT does not provide that functionality indeed. I will try CtrlP and let you know, currently the way I do it is from terminal vi -o $(find * -name 'my_pattern'). by the way is there a better way to do it, even from the terminal? – ppp Jul 15 '13 at 13:48
Also, I have edited my question. I hope this is more clear now – ppp Jul 15 '13 at 13:55

To open multiple files at a time using vi/vim editor, use the following syntax:

$ vi file1.txt file2.txt file(N)

To list open files, use the command:



  1 %a   "file1.txt"                    linha 1
  2      "file2.txt"                    linha 0
Press ENTER or type command to continue

To switch to next file, use the command: :n or :bn. And to switch previous to file ,use the command: :p or :bp.

You can also switch between all open files, using the following syntax:

:b file

Note: :b choses the last visited file, so you can use it to switch quickly between two files.

share|improve this answer
I'm afraid this is not what I asked for. I am looking for a way to search for file names with a pattern and open them in new split windows. – ppp Jul 13 '13 at 17:07

You must log in to answer this question.

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