1

I noticed a useful feature while watching angular.js how to video:

http://www.youtube.com/watch?feature=player_embedded&v=WuiHuZq_cg4#t=56s

That feature is creating a file (filename + file extention) based on what you write in html/css code.

Is this possible with sublime text2? If so, is there such plugin i could use?

1 Answer 1

2

I watched the how-to video and did find this feature useful. Inspired by this, I created a plugin that emulates this behavior:

https://github.com/gregsadetsky/NewFileFromScope

(installation instructions appear in the plugin description text, near the bottom)


Shortly, this plugin adds a "New File From Scope" command to the Command Palette which will pseudo-smartly try to extract a file name from the current scope, and create a new file named correspondingly.

For instance, if you have the following line:

<link href="app.css" rel="stylesheet">

placing your cursor anywhere in the app.css text (or selecting it) and invoking the command will create a new, empty file named "app.css".

Enjoy!

Sign up to request clarification or add additional context in comments.

2 Comments

this definately saves time a bit, ill try to scrub in when i find some time (hope to create folders this way if its gonna be possible) :)
Creating folders shouldn't be too hard -- use posixpath's 'split' function to get directory names, and create them as necessary (i.e., when they don't already exist). I've documented another possible addition here: this would allow to invoke the command with the cursor positioned anywhere on the line, not specifically at the 'app.css' text.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.