Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime Text 2 - How to open a file from open folders using the command pallet?

I want to open a file using some kind of fuzzy searching, and I'm pretty sure I've seen this functionality inside Sublime Text, but for some reason I can't find any mention of this anywhere.

I want to open the command pallet and be able to type a file name in there, and if the file is close, It will open the file for me, if it's open, it will activate it's window and group.

Is this possible?

like image 798
Eli Avatar asked Oct 03 '11 08:10

Eli


People also ask

How do I use the command palette in Sublime Text?

Using Command Palette To open a command palette in Sublime Text editor, you can use the shortcut key combination Ctrl+Shift+P on Windows and Cmd+Shift+P on OSX.

How do I open a file in sublime?

Just Use the command subl to open sublime text from terminal. if you want to open a specific file use subl path/to/the/file .

How do I open Sublime Text in a folder?

If you often work on the different projects in Sublime Text being able to open the current path in Terminal is a big time saver. Run this command in Terminal now when you type subl Sublime Text should open. Now to open a folder type subl . will open the current folder in Sublime Text.

How do I open Sublime Text from command prompt?

Open any program file in the sublime editor and Right-click (context menu). You can see the Cmd menu in the Context menu options. Click on it. The command prompt will be opened through which you can compile and run your program.


1 Answers

I see you already found ctrl+p, but the original announcement of this feature has some good information on usage so I thought I'd post it.

The biggest change here is that the Ctrl+P dialog has been reworked into a more general "Goto Anything" popup. From this, you can:

Type, to search through files (open files, recently closed files, and files in open folders)

@foo, to search through symbols in the current file

:foo, to go to the given line number

#foo, to do a fuzzy search in the current file for foo

These can be combined: "foo@bar" will search for the file that best matches "foo", and go to the symbol in that file that best matches "bar". "foo:100" would go to line 100 of the same file. You can use this to preview a location in another file, then hit escape to go back to where you where.

like image 112
Allen Avatar answered Nov 04 '22 14:11

Allen