I am using Sublime Text Editor for Python development. If I create a new file by Ctrl + N, the default language setting for this file is Plain Text, so how to change the default language setting for the new file to be Python ?
Another question :If I write some code in the new file and have not save it to disk, it is impossible to run it and get the running result, is there a solution to remove this restriction so that we can run code in the new file without saving it to disk first?
There are several packages available for setting the default syntax for new files. One, as mentioned in the comments, is Default File Type
, but I actually prefer ApplySyntax
. It automagically detects what the syntax of a file should be, based on a bunch of (user-configurable, of course) rules, and also sets the default syntax for new files.
The only way to run unsaved code in Sublime is to install the excellent SublimeREPL
plugin. Among many other features, you can highlight and transfer code to a running REPL, or just enter the code directly in the REPL.
The second question about running without saving to hard disk:
1-press ctrl + shift + p
2- write install package and install it
3- write "auto save" and install it
4- go to preferences> package settings> Auto-save> Settings Default and copy all the code
5- go to preferences> package settings> Auto-save> Settings user and past it and change the first code from: "auto_save_on_modified": false, to "auto_save_on_modified": true,
good luck
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With