dkundel / vscode-new-file

📄 'Advanced New File' extension for Visual Studio Code
MIT License
96 stars 20 forks source link

Set the cursor in a specific line when creating a file #51

Open dann1 opened 6 years ago

dann1 commented 6 years ago

I have a file template with #!/usr/bin/python on the first line. I would like when opening the file to have the cursor on a specific line. With sublime text's advanced new file I was able to do this with:

"file_templates": {
        "py": "#!/usr/bin/python2\n\n",
        "sh": "#!/bin/bash\n\n",
                "fish": "#!/usr/bin/fish\n\n"
    },
dkundel commented 6 years ago

That sounds like a good idea. I don't have time to implement this at the moment but if you would be interested in implementing this and submitting a PR I would be excited to merge it.

Cheers, Dominik

Telokis commented 6 years ago

Are we supporting file templates? Or is it something handled by another extension? @dann1 With the config you provided does Sublime text put your cursor at the end of the file or can you tell it to put it wherever you want?

Edit: Alright, after looking inside the code I noticed that we have kind of a skeleton for templates. It's not documented, though.