Sublime Input
Send STDIN input to programs using comments in Sublime Text 2/3
Details
Installs
- Total 21K
- Win 13K
- Mac 4K
- Linux 4K
Sep 26 | Sep 25 | Sep 24 | Sep 23 | Sep 22 | Sep 21 | Sep 20 | Sep 19 | Sep 18 | Sep 17 | Sep 16 | Sep 15 | Sep 14 | Sep 13 | Sep 12 | Sep 11 | Sep 10 | Sep 9 | Sep 8 | Sep 7 | Sep 6 | Sep 5 | Sep 4 | Sep 3 | Sep 2 | Sep 1 | Aug 31 | Aug 30 | Aug 29 | Aug 28 | Aug 27 | Aug 26 | Aug 25 | Aug 24 | Aug 23 | Aug 22 | Aug 21 | Aug 20 | Aug 19 | Aug 18 | Aug 17 | Aug 16 | Aug 15 | Aug 14 | Aug 13 | Aug 12 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 3 | 14 | 14 | 12 | 11 | 12 | 8 | 10 | 14 | 10 | 11 | 18 | 8 | 13 | 10 | 10 | 13 | 10 | 9 | 12 | 6 | 9 | 16 | 6 | 8 | 4 | 10 | 9 | 11 | 14 | 11 | 5 | 7 | 4 | 15 | 13 | 9 | 8 | 3 | 5 | 8 | 12 | 6 | 12 | 7 | 9 |
Mac | 1 | 3 | 2 | 2 | 2 | 3 | 3 | 3 | 0 | 2 | 1 | 2 | 1 | 2 | 4 | 1 | 3 | 0 | 2 | 2 | 1 | 1 | 1 | 3 | 1 | 2 | 2 | 3 | 3 | 6 | 1 | 2 | 1 | 1 | 1 | 3 | 4 | 3 | 0 | 0 | 3 | 0 | 0 | 1 | 0 | 0 |
Linux | 2 | 1 | 1 | 1 | 2 | 4 | 4 | 0 | 0 | 0 | 0 | 1 | 0 | 3 | 4 | 0 | 1 | 1 | 2 | 1 | 1 | 1 | 1 | 1 | 2 | 0 | 0 | 2 | 3 | 1 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 0 |
Readme
- Source
- raw.githubusercontent.com
Sublime Input
Sublime Input is a Sublime Text 2/3 plugin which gives STDIN input through comments to a program.
Installation
With the Package Control plugin (Recommended):
- Bring up the Command Palette (Cmd+Shift+P on OS X, Ctrl+Shift+P on Linux/Windows).
- Select “Package Control: Install Package”, wait while Package Control fetches the latest package list, then select Sublime Input.
- The advantage of using this method is that Package Control will automatically keep Sublime Input up to date with the latest version.
Alternate Method:
- Go to Preferences | Browse Packages
- Browse up a folder and then into the Installed Packages/ folder
- Downlad and
Sublime.Input.sublime-package
file - Rename the
Sublime.Input.sublime-package
file toSublime Input.sublime-package
- Put the
Sublime Input.sublime-package
file in the Installed Packages/ folder - Restart Sublime Text
Usage
Insert a multi-line comment at the top of program.
Examples, using the default format:
Python:
'''input
2
foo
bar
'''
a=input()
for i in xrange(a):
a=raw_input()
print a
C/C++
/*input
2
foo
bar
*/
#include <stdio.h>
int main() {
int n,i;
char s[10];
scanf("%d",&n);
for(i=0;i<n;i++) {
scanf("%s",s);
printf("%s\n",s);
} }
Both the programs will print the following output:
foo
bar
Configure
Set the build schemas in Preferences: Package Settings > SublimeInput > Settings – User
Example schema :
{
"build_schemas" : {
"cpp" : {
"shell_cmd" : "g++ \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\"",
"input_start" : "/*input",
"input_end" : "*/"
}
}
}
build_schemas
contains key-value pairs, where the key's the filetype (cpp
in this example), and a dictionary as its value.
shell_cmd
stores the command to execute on build.
{file}
- Complete address of the file
{file_path}
- The address of the directory the file is stored in
{file_base_name}
- Just the filename, without the extension
{file_extension}
- The extension of the file
input_start
stores the start of the input comment block.
input_end
stores the end of the input comment block.
The default schema can be found in Preferences: Package Settings > SublimeInput > Settings – Default
The following schemas have been included by default: - C - C++ - Python - Java
Keyboard Shortcuts
- Ctrl + Alt + B - Build/Run program
- Ctrl + Alt + C - Cancel the running pogram
Current Status
The Plugin is in active development. Windows users may encounter some bugs.