Как открыть файл с помощью только клавиатуры в Sublime Text?

32529
ivanzoid

Как открыть файл с использованием только клавиатуры в Sublime Text 2/3?

Ищу эквивалент <Esc>:e /path/to/fileот Vim.

25

5 ответов на вопрос

44
Siwei Shen申思维

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

это работает только в контексте проекта ptim 10 лет назад 8
memeLab - работает без проекта в Sublime Text 2. Cmd + P на Mac. Marc 8 лет назад 0
бесконечный отклик на этот ответ. Это сэкономило мне много времени на просмотр списка многих файлов. Спасибо, приятель SohelAhmedM 7 лет назад 3
Это то, что я искал! nodebase 7 лет назад 2
26
Daniel Beck

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.

Alt + D выделяет адресную строку в проводнике Windows (Windows 10), если вы не можете сделать Cmd + PoopGlitter + G. Оттуда адресная строка позволяет завершить вкладку и перейдет прямо к вашему файлу. Pie Till I Die 6 лет назад 0
Большое спасибо за первое предложение для OSX, именно то, что мне было нужно = -D mraxus 5 лет назад 0
8
hostmaster

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

7
Ross Hemsley

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.)

0
Kjell

Проверено на ST3.1.1, сборка 3176. Это должно работать без какого-либо плагина.

Чтобы открыть файл, который не является частью проекта, например ~ / .bashrc:

В Ubuntu вы можете использовать Ctrl- Oчтобы перейти в диалог открытия файла, а затем Ctrl- Lчтобы получить строку для записи имени файла. Это также работает для скрытых файлов.

На MacOS используйте Cmd- Oи Cmd- Shift- G.

Для файлов проекта используйте Ctrl- Pсоответственно Cmd- P.

Похожие вопросы