简体   繁体   中英

How to create a directory faster in Sublime Text 3

Whenever I create a directory in Sublime Text 3 I just either:

  1. Open the directory tree in the sidebar, create the directory one folder at a time...
  2. Or do the same thing in the Finder window.
  3. Or (rarely) open up the terminal and do mkdir -p <path> .

Wondering if there is a plugin or a way or something to just do:

⌘p my/long/directory/name enter

Or the same thing for files

⌘p my/long/file/name.txt enter

And it creates it super fast if it doesn't exist. That would streamline the workflow quite a bit.

The FileManager plugin sounds like it might be of use to you. Among the features it provides, it's fm_create command allows you to create files or folders, including automatically creating any path elements that don't exist.

The command is bound to Alt+N by default (across all platforms) and is also available in the command palette as File Manager: New File . Despite the name of the command, it creates both files and folders and uses the last character to determine which you meant to create:

FileManager doesn't have a command create_new_file and create_new_folder. Just fm_create. It opens up an input, and the last character you type in is a / (or a ), it creates a folder instead of a file.

In addition the input supports auto-completion of paths and it's fairly customizable as well. For example, I added this command to a Defaults.sublime-commands in my User package to implement a command that allows me to easily create a file at the same path as the current file:

{
    "caption": "File Manager: New File Relative to Current View",
    "command": "fm_create",
    "args": { "initial_text": "$here/" }
},

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM