Configure C # compiling and running environment for Sublime Text 2 in OS X
Sublime Text 2 is an extremely sexy tool for programmers. In her work, she modified some code segments and gradually replaced the text editor in the operating system. ST2 is a paid software priced at $70.00. You can try it out without a registered version. She is highly scalable and supports multiple development languages. However, the C # support is not very friendly by default. To use ST2 iN OS X as the C # code editor, you need to customize it.
C # compiling environment installation in OS X
During non-working hours, I used the OS X operating system. The available C # compiler only has Mono. Project homepage: http://mono-project.com/main_page. : Http://www.go-mono.com/mono-downloads/download.html. The download and installation steps are skipped. After the installation is successful, open the terminal and enter "mono -- version", indicating that the installation is successful.
Sublime Text 2: two key commands for compiling and running C #
"Mcs" -- compile the *. cs FILE command. Description of "mcs": http://www.mono-project.com/CSharp_Compiler
"Mono" -- run the *. exe file generated after compilation.
You can enter the command name + "-- help" in the terminal to view the usage and parameters of these two commands.
Configure C # Build System for Sublime Text 2
Open ST2 and select Tools> Build System> New Build System:
Enter the following code:
{ "cmd": ["mcs", "$file"], "file_regex": "^(...*?):([0-9]*):?([0-9]*)", "selector": "source.cs", "encoding": "GBK", "variants": [ { "name": "Run", "cmd": ["Mono", "${file_path}/${file_base_name}.exe"] } ] }
For details about parameters of ST2 Build System, see http://www.sublimetext.com/docs/build. Click Save and enter the file name C #. sublime-build. The file will be saved to the Packages/User folder by default. Now, ST2 configuration is complete.
Test the compiling and running environment
I wrote a piece of cool code.
Compile "batch + B", and the sexiness prompt jumps out. An exe file with the same name will be generated under the *. cs directory.
"Pull + Shift + B": Run it again.
Recommended plug-ins
I am used to manually format the code in ST2. Here we recommend the C # Smart reminder plug-in> CompleteSharp.
The environment for compiling and running C # In Sublime Text 2 under OS X is successfully established.
Ubuntu 12.10 install and crack Sublime Text 2
Install Sublime Text 2 on Ubuntu 13.04
Code artifact-Sublime Text package management tools and extensions
How to Develop the Sublime Text 2 plug-in
Install and crack the Sublime Text 2 editor in Windows Mac Linux
Text Editor Sublime Text User Experience
This article permanently updates the link address: