Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How do I open a file using only keyboard in Sublime Text 2/3?

Looking for equivalent of <Esc>:e /path/to/file from Vim.

share|improve this question

4 Answers 4

up vote 13 down vote accepted

On OS X, Press Cmd-O to open the file browser.

Then, Cmd-Shift-G allows you to enter the name of the folder to go to.

Screenshot of file dialog

Finally, just type the file name (or a unique prefix) to select the file you want. You can also navigate using the arrow keys.


Plugin for opening files by name

The following plugin allows you to type a file name and have it opened in Sublime Text 2. It should work on any OS.

import sublime, sublime_plugin

def open_file(window, filename):
    window.open_file(filename, sublime.ENCODED_POSITION)

class OpenFileByNameCommand(sublime_plugin.WindowCommand):
    def run(self):
        fname = self.window.active_view().file_name()
        if fname == None:
            fname = ""

        def done(filename):
            open_file(self.window, filename)

        self.window.show_input_panel(
            "file to open: ", fname, done, None, None)

This allows you to encode a position in that file in the file name:

  • /path/to/file:42 will open the file and go to line 42
  • /path/to/file:42:23 will open the file and go to line 42, column 23

Selecting a file:

Screenshot 1

After selection:

Screenshot 2

For information how plugins work and how you can integrate this in the UI, see this answer.

share|improve this answer

Sublime Files Sublime Text 2 plugin for keyboard driven file navigation. It is more less like Emacs file opening interface

Take a look at Sublime-File-Navigator plugin it is more VIM-ish

share|improve this answer

Why don't you just use the Ctrl-P? (Goto -> Goto anything)

share|improve this answer
    
this only works in the context of a project –  memeLab May 8 at 5:55

I recently wrote a plugin, iOpener, that will open files from path using completion, directory listings and history. It also sensibly opens folders by adding the into the side bar of a new window.

I tried to emulate the functionality of emacs were possible.

https://github.com/rosshemsley/iOpener

(I know this question is for ST2. I could always back-port the code if there were enough demand. Though I suspect most people use ST3 now.)

share|improve this answer
    
+1 just for the name :-) –  Karsten Sep 3 at 10:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.