mirror of
https://github.com/sstent/sublime-text-3.git
synced 2026-01-25 22:51:41 +00:00
backing up sublime settings
This commit is contained in:
3
Packages/SublimeREPL/.gitignore
vendored
Normal file
3
Packages/SublimeREPL/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
*.pyc
|
||||
*.bak
|
||||
doc/_build
|
||||
3
Packages/SublimeREPL/.hgignore
Normal file
3
Packages/SublimeREPL/.hgignore
Normal file
@@ -0,0 +1,3 @@
|
||||
syntax: glob
|
||||
*.pyc
|
||||
doc/_build/*
|
||||
1
Packages/SublimeREPL/.no-sublime-package
Normal file
1
Packages/SublimeREPL/.no-sublime-package
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
6
Packages/SublimeREPL/Context.sublime-menu
Normal file
6
Packages/SublimeREPL/Context.sublime-menu
Normal file
@@ -0,0 +1,6 @@
|
||||
[
|
||||
{"caption": "-"},
|
||||
{"command": "repl_kill", "caption": "Kill"},
|
||||
{"command": "repl_restart", "caption": "Restart"},
|
||||
{"command": "subprocess_repl_send_signal", "caption": "Send other SIGNAL"}
|
||||
]
|
||||
116
Packages/SublimeREPL/Default (Linux).sublime-keymap
Normal file
116
Packages/SublimeREPL/Default (Linux).sublime-keymap
Normal file
@@ -0,0 +1,116 @@
|
||||
[
|
||||
{ "keys": ["up"], "command": "repl_view_previous",
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.history_arrows", "operator": "equal", "operand": true },
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true },
|
||||
{ "key": "auto_complete_visible", "operator": "equal", "operand": false }
|
||||
]
|
||||
},
|
||||
{ "keys": ["alt+p"], "command": "repl_view_previous",
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.history_arrows", "operator": "equal", "operand": false },
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["down"], "command": "repl_view_next",
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.history_arrows", "operator": "equal", "operand": true },
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true },
|
||||
{ "key": "auto_complete_visible", "operator": "equal", "operand": false }
|
||||
]
|
||||
},
|
||||
{ "keys": ["alt+n"], "command": "repl_view_next",
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.history_arrows", "operator": "equal", "operand": false },
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["enter"], "command": "repl_enter", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true },
|
||||
{ "key": "auto_complete_visible", "operator": "equal", "operand": false }
|
||||
]
|
||||
},
|
||||
{ "keys": ["enter"], "command": "repl_enter", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true },
|
||||
{ "key": "setting.auto_complete_commit_on_tab", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["escape"], "command": "repl_escape", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "auto_complete_visible", "operator": "equal", "operand": false },
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["backspace"], "command": "repl_backspace", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true },
|
||||
{ "key": "setting.repl_sublime2", "operator": "equal", "operand": true },
|
||||
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["ctrl+backspace"], "command": "repl_ctrl_backspace", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true },
|
||||
{ "key": "setting.repl_sublime2", "operator": "equal", "operand": true },
|
||||
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["left"], "command": "repl_left", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["home"], "command": "repl_home", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["shift+left"], "command": "repl_shift_left", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["shift+home"], "command": "repl_shift_home", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["ctrl+l"], "command": "repl_clear",
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["shift+ctrl+c"], "command": "subprocess_repl_send_signal", "args": {"signal": 2}, // sigint
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
{ "keys": ["ctrl+,", "s"], "command": "repl_transfer_current", "args": {"scope": "selection"}},
|
||||
{ "keys": ["ctrl+shift+,", "s"], "command": "repl_transfer_current", "args": {"scope": "selection", "action":"view_write"}},
|
||||
{ "keys": ["ctrl+,", "f"], "command": "repl_transfer_current", "args": {"scope": "file"}},
|
||||
{ "keys": ["shift+ctrl+,", "f"], "command": "repl_transfer_current", "args": {"scope": "file", "action":"view_write"}},
|
||||
{ "keys": ["ctrl+,", "l"], "command": "repl_transfer_current", "args": {"scope": "lines"}},
|
||||
{ "keys": ["shift+ctrl+,", "l"], "command": "repl_transfer_current", "args": {"scope": "lines", "action":"view_write"}},
|
||||
{ "keys": ["ctrl+,", "b"], "command": "repl_transfer_current", "args": {"scope": "block"}},
|
||||
{ "keys": ["shift+ctrl+,", "b"], "command": "repl_transfer_current", "args": {"scope": "block", "action":"view_write"}}
|
||||
]
|
||||
|
||||
135
Packages/SublimeREPL/Default (OSX).sublime-keymap
Normal file
135
Packages/SublimeREPL/Default (OSX).sublime-keymap
Normal file
@@ -0,0 +1,135 @@
|
||||
[
|
||||
{ "keys": ["up"], "command": "repl_view_previous",
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.history_arrows", "operator": "equal", "operand": true },
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true },
|
||||
{ "key": "auto_complete_visible", "operator": "equal", "operand": false }
|
||||
]
|
||||
},
|
||||
{ "keys": ["ctrl+p"], "command": "repl_view_previous",
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.history_arrows", "operator": "equal", "operand": false },
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["down"], "command": "repl_view_next",
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.history_arrows", "operator": "equal", "operand": true },
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true },
|
||||
{ "key": "auto_complete_visible", "operator": "equal", "operand": false }
|
||||
]
|
||||
},
|
||||
{ "keys": ["ctrl+n"], "command": "repl_view_next",
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.history_arrows", "operator": "equal", "operand": false },
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["enter"], "command": "repl_enter", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true },
|
||||
{ "key": "auto_complete_visible", "operator": "equal", "operand": false }
|
||||
]
|
||||
},
|
||||
{ "keys": ["enter"], "command": "repl_enter", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true },
|
||||
{ "key": "setting.auto_complete_commit_on_tab", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["escape"], "command": "repl_escape", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "auto_complete_visible", "operator": "equal", "operand": false },
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["backspace"], "command": "repl_backspace", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true },
|
||||
{ "key": "setting.repl_sublime2", "operator": "equal", "operand": true },
|
||||
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["ctrl+backspace"], "command": "repl_ctrl_backspace", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true },
|
||||
{ "key": "setting.repl_sublime2", "operator": "equal", "operand": true },
|
||||
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["super+backspace"], "command": "repl_super_backspace", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true },
|
||||
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["alt+backspace"], "command": "repl_ctrl_backspace", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true },
|
||||
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["left"], "command": "repl_left", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["home"], "command": "repl_home", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["ctrl+a"], "command": "repl_home", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["shift+left"], "command": "repl_shift_left", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["shift+home"], "command": "repl_shift_home", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["ctrl+l"], "command": "repl_clear",
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["shift+ctrl+c"], "command": "subprocess_repl_send_signal", "args": {"signal": 2}, // sigint
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
{ "keys": ["ctrl+,", "s"], "command": "repl_transfer_current", "args": {"scope": "selection"}},
|
||||
{ "keys": ["ctrl+shift+,", "s"], "command": "repl_transfer_current", "args": {"scope": "selection", "action":"view_write"}},
|
||||
{ "keys": ["ctrl+,", "f"], "command": "repl_transfer_current", "args": {"scope": "file"}},
|
||||
{ "keys": ["shift+ctrl+,", "f"], "command": "repl_transfer_current", "args": {"scope": "file", "action":"view_write"}},
|
||||
{ "keys": ["ctrl+,", "l"], "command": "repl_transfer_current", "args": {"scope": "lines"}},
|
||||
{ "keys": ["shift+ctrl+,", "l"], "command": "repl_transfer_current", "args": {"scope": "lines", "action":"view_write"}},
|
||||
{ "keys": ["ctrl+,", "b"], "command": "repl_transfer_current", "args": {"scope": "block"}},
|
||||
{ "keys": ["shift+ctrl+,", "b"], "command": "repl_transfer_current", "args": {"scope": "block", "action":"view_write"}}
|
||||
]
|
||||
109
Packages/SublimeREPL/Default (Windows).sublime-keymap
Normal file
109
Packages/SublimeREPL/Default (Windows).sublime-keymap
Normal file
@@ -0,0 +1,109 @@
|
||||
[
|
||||
{ "keys": ["up"], "command": "repl_view_previous",
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.history_arrows", "operator": "equal", "operand": true },
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true },
|
||||
{ "key": "auto_complete_visible", "operator": "equal", "operand": false }
|
||||
]
|
||||
},
|
||||
{ "keys": ["alt+p"], "command": "repl_view_previous",
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.history_arrows", "operator": "equal", "operand": false },
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["down"], "command": "repl_view_next",
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.history_arrows", "operator": "equal", "operand": true },
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true },
|
||||
{ "key": "auto_complete_visible", "operator": "equal", "operand": false }
|
||||
]
|
||||
},
|
||||
{ "keys": ["alt+n"], "command": "repl_view_next",
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.history_arrows", "operator": "equal", "operand": false },
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["enter"], "command": "repl_enter", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true },
|
||||
{ "key": "auto_complete_visible", "operator": "equal", "operand": false }
|
||||
]
|
||||
},
|
||||
{ "keys": ["enter"], "command": "repl_enter", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true },
|
||||
{ "key": "setting.auto_complete_commit_on_tab", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["escape"], "command": "repl_escape", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "auto_complete_visible", "operator": "equal", "operand": false },
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["backspace"], "command": "repl_backspace", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true },
|
||||
{ "key": "setting.repl_sublime2", "operator": "equal", "operand": true },
|
||||
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["ctrl+backspace"], "command": "repl_ctrl_backspace", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true },
|
||||
{ "key": "setting.repl_sublime2", "operator": "equal", "operand": true },
|
||||
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["left"], "command": "repl_left", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["home"], "command": "repl_home", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["shift+left"], "command": "repl_shift_left", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["shift+home"], "command": "repl_shift_home", "args": {},
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
{ "keys": ["shift+ctrl+c"], "command": "repl_clear",
|
||||
"context":
|
||||
[
|
||||
{ "key": "setting.repl", "operator": "equal", "operand": true }
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
{ "keys": ["ctrl+,", "s"], "command": "repl_transfer_current", "args": {"scope": "selection"}},
|
||||
{ "keys": ["ctrl+shift+,", "s"], "command": "repl_transfer_current", "args": {"scope": "selection", "action":"view_write"}},
|
||||
{ "keys": ["ctrl+,", "f"], "command": "repl_transfer_current", "args": {"scope": "file"}},
|
||||
{ "keys": ["shift+ctrl+,", "f"], "command": "repl_transfer_current", "args": {"scope": "file", "action":"view_write"}},
|
||||
{ "keys": ["ctrl+,", "l"], "command": "repl_transfer_current", "args": {"scope": "lines"}},
|
||||
{ "keys": ["shift+ctrl+,", "l"], "command": "repl_transfer_current", "args": {"scope": "lines", "action":"view_write"}},
|
||||
{ "keys": ["ctrl+,", "b"], "command": "repl_transfer_current", "args": {"scope": "block"}},
|
||||
{ "keys": ["shift+ctrl+,", "b"], "command": "repl_transfer_current", "args": {"scope": "block", "action":"view_write"}}
|
||||
]
|
||||
6
Packages/SublimeREPL/Default.sublime-commands
Normal file
6
Packages/SublimeREPL/Default.sublime-commands
Normal file
@@ -0,0 +1,6 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Restart REPL",
|
||||
"command": "repl_restart"
|
||||
}
|
||||
]
|
||||
278
Packages/SublimeREPL/GPL-LICENSE.TXT
Normal file
278
Packages/SublimeREPL/GPL-LICENSE.TXT
Normal file
@@ -0,0 +1,278 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
11
Packages/SublimeREPL/LICENSE-LIB.txt
Normal file
11
Packages/SublimeREPL/LICENSE-LIB.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
LICENSE Libraries and external dependencies
|
||||
|
||||
SublimeREPL is not a monolithic block of code and some REPLs / functions depends on external libraries.
|
||||
|
||||
This means that, although the parts of SublimeREPL that I (wuub) wrote are published under BSD license and you're free to reuse them as you wish, the whole SublimeREPL package is as of now licensed under GPLv2.
|
||||
|
||||
- Remote Python depends on a fantastic execnet library by Holger Krekel (https://bitbucket.org/hpk42/execnet & http://codespeak.net/execnet/ & https://twitter.com/hpk42. execnet is licensed under GPLv2. As a result repls/execnet_repl.py and lang_integration:ExecnetVirtualenvRepl are licensed under GPLv2 as well!
|
||||
|
||||
- Persistent history depends on buzhug library by Pierre Quentel. (http://buzhug.sourceforge.net/ buzhug is published under the revised BSD licence.
|
||||
|
||||
- subprocess_repl depends on killableprocess by Peter Astrand, Mike Taylor and Mikeal Rogers. Please see killableprocess.py for details.
|
||||
3
Packages/SublimeREPL/LICENSE.TXT
Normal file
3
Packages/SublimeREPL/LICENSE.TXT
Normal file
@@ -0,0 +1,3 @@
|
||||
The whole SublimeREPL package is licensed under GNU GENERAL PUBLIC LICENSE Version 2.
|
||||
|
||||
Parts of SublimeREPL might be usable under more permisive terms. See LICENSE-LIB.txt for details.
|
||||
70
Packages/SublimeREPL/Main.sublime-menu
Normal file
70
Packages/SublimeREPL/Main.sublime-menu
Normal file
@@ -0,0 +1,70 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"caption": "Eval in REPL",
|
||||
"children":
|
||||
[
|
||||
{"caption": "Selection", "command": "repl_transfer_current", "args": {"scope": "selection"}},
|
||||
{"caption": "File", "command": "repl_transfer_current", "args": {"scope": "file"}},
|
||||
{"caption": "Lines", "command": "repl_transfer_current", "args": {"scope": "lines"}},
|
||||
{"caption": "Block", "command": "repl_transfer_current", "args": {"scope": "block"}}
|
||||
]},
|
||||
{"caption": "Transfer to REPL",
|
||||
"children":
|
||||
[
|
||||
{"caption": "Selection", "command": "repl_transfer_current", "args": {"scope": "selection", "action":"view_write"}},
|
||||
{"caption": "File", "command": "repl_transfer_current", "args": {"scope": "file", "action":"view_write"}},
|
||||
{"caption": "Lines", "command": "repl_transfer_current", "args": {"scope": "lines", "action":"view_write"}},
|
||||
{"caption": "Block", "command": "repl_transfer_current", "args": {"scope": "block", "action":"view_write"}}
|
||||
]
|
||||
},
|
||||
{ "caption": "-" }
|
||||
]
|
||||
}]
|
||||
},
|
||||
|
||||
{
|
||||
"caption": "Preferences",
|
||||
"mnemonic": "n",
|
||||
"id": "preferences",
|
||||
"children":
|
||||
[
|
||||
{
|
||||
"caption": "Package Settings",
|
||||
"mnemonic": "P",
|
||||
"id": "package-settings",
|
||||
"children":
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{
|
||||
"command": "open_file", "args":
|
||||
{
|
||||
"file": "${packages}/SublimeREPL/SublimeREPL.sublime-settings"
|
||||
},
|
||||
"caption": "Settings – Default"
|
||||
},
|
||||
{
|
||||
"command": "open_file", "args":
|
||||
{
|
||||
"file": "${packages}/User/SublimeREPL.sublime-settings"
|
||||
},
|
||||
"caption": "Settings – User"
|
||||
},
|
||||
{ "caption": "-" }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
105
Packages/SublimeREPL/README.md
Normal file
105
Packages/SublimeREPL/README.md
Normal file
@@ -0,0 +1,105 @@
|
||||
SublimeREPL for SublimeText (2 and 3)
|
||||
=====================================
|
||||
|
||||
[](http://waffle.io/wuub/SublimeREPL)
|
||||
|
||||
If you would like to donate to support SublimeREPL development, you can do so using [GitTip](https://www.gittip.com/wuub/) or [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=4DGEPH7QAVHH6&lc=GB&item_name=SublimeREPL¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted). Someone willing to take care of documentation would also be very welcome :-)
|
||||
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
#### Common
|
||||
* Run an interpreter (REPL) inside SublimeText2 view/tab.
|
||||
* Per-language persistent REPL history.
|
||||
* Easily evaluate code in the running REPL
|
||||
* Replace your current build system, and use stdin in your programs.
|
||||
* Rich configuration with platform specific settings, project/file dependent environment variables and sane defaults.
|
||||
|
||||
#### Python
|
||||
* Launch python in local or remote(1) virtualenv.
|
||||
* Quickly run selected script or launch PDB.
|
||||
* Use SublimeText2 Python console with history and multiline input.
|
||||
|
||||
(1) - (ssh, linux/osx only)
|
||||
|
||||
Screenshots
|
||||
-----------
|
||||
#### Running python code in SublimeREPL
|
||||

|
||||
#### R on Windows
|
||||

|
||||
|
||||
Videos
|
||||
------
|
||||
*  [Python & virtualenv over SSH](http://youtu.be/zodAqBvKQm0)
|
||||
*  [SBT integration demo](http://youtu.be/1Y7Mr_RJpmU)
|
||||
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
1. Install Package Control. [http://wbond.net/sublime_packages/package_control](http://wbond.net/sublime_packages/package_control)
|
||||
2. Install SublimeREPL
|
||||
1. `Preferences | Package Control | Package Control: Install Package`
|
||||
2. Choose `SublimeREPL`
|
||||
3. Restart SublimeText2
|
||||
4. Configure `SublimeREPL` (default settings in `Preferences | Package Settings | SublimeREPL | Settings - Default` should be modified in `Preferences | Package Settings | SublimeREPL | Settings - User`, this way they will survive package upgrades!
|
||||
|
||||
Documentation
|
||||
=============
|
||||
|
||||
Very basic documentation will soon be available on RTD: [http://sublimerepl.readthedocs.org/](http://sublimerepl.readthedocs.org/)
|
||||
|
||||
#### Getting started
|
||||
|
||||
* Create or open your file with code.
|
||||
* Menu / Tools / Command Palette (OS X: `⇧⌘P`)
|
||||
then type "SublimeREPL" and select the approperiate language.
|
||||
* Menu / View / Layout / Rows: 2 (OS X: `⌥⇧⌘2`).
|
||||
* Menu / View / Move File to Group / Group 2 (`⌃⇧2`).
|
||||
|
||||
#### Keybindings
|
||||
|
||||
* Evaluate in REPL:
|
||||
* <kbd>ctrl+,</kbd>, <kbd>s</kbd> Selection
|
||||
* <kbd>ctrl+,</kbd>, <kbd>f</kbd> File
|
||||
* <kbd>ctrl+,</kbd>, <kbd>l</kbd> Lines
|
||||
* <kbd>ctrl+,</kbd>, <kbd>b</kbd> Block
|
||||
* Transfer in REPL (just copy, without evaluating it):
|
||||
* <kbd>ctrl+shift+,</kbd>, <kbd>s</kbd> Selection
|
||||
* <kbd>ctrl+shift+,</kbd>, <kbd>f</kbd> File
|
||||
* <kbd>ctrl+shift+,</kbd>, <kbd>l</kbd> Lines
|
||||
* <kbd>ctrl+shift+,</kbd>, <kbd>b</kbd> Block
|
||||
|
||||
Note: <kbd>ctrl+,</kbd>, <kbd>f</kbd> means: press Ctrl and Comma, release all, press F.
|
||||
|
||||
|
||||
License and Price
|
||||
=================
|
||||
|
||||
Since version 1.2.0 SublimeREPL is licensed under GPL. Previous versions were licensed under BSD.
|
||||
If you're using SublimeREPL in commercial environment a donation is strongly encouraged ;-)
|
||||
|
||||
Compatibility
|
||||
================
|
||||
|
||||
SublimeREPL is developed against the latest dev build of SublimeText3.
|
||||
Ubuntu 13.04 is main target platform with OSX closely after.
|
||||
Windows is tested from time to time.
|
||||
|
||||
Sublime Text 2 compatibility is maintained where possible, but it's not a priority.
|
||||
|
||||
|
||||
FAQ
|
||||
---
|
||||
|
||||
### 1. Is this a terminal emulator?
|
||||
|
||||
No. Shell (cmd.exe/bash) REPL can be used for simple tasks (file creation, `git init` etc.) but anything _terminal like_ (mc, vim) will not work! SublimeREPL has a sister project: [SublimePTY](https://github.com/wuub/SublimePTY) that aims to bring real terminal emulator to SublimeText2.
|
||||
|
||||
### 2. Is IPython supported?
|
||||
|
||||
Yes, with autocompletion and some windowed `%pylab`. Inline `%pylab` is unfortuneatly not possible right now.
|
||||
|
||||
|
||||
4
Packages/SublimeREPL/SublimeREPL (OSX).sublime-settings
Normal file
4
Packages/SublimeREPL/SublimeREPL (OSX).sublime-settings
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
// Add to PATH /usr/local/bin by default on OSX.
|
||||
"default_extend_env": {"PATH": "{PATH}:/usr/local/bin"}
|
||||
}
|
||||
78
Packages/SublimeREPL/SublimeREPL.sublime-settings
Normal file
78
Packages/SublimeREPL/SublimeREPL.sublime-settings
Normal file
@@ -0,0 +1,78 @@
|
||||
{
|
||||
// default_extend_env are used to augment any environment variables
|
||||
// that should be visible for all subprocess repls launched within
|
||||
// SublimeREPL. This is a very good place to add PATH extension
|
||||
// once "PATH": "{PATH}:/home/username/mylocalinstalls/bin" or whatever
|
||||
"default_extend_env": {},
|
||||
|
||||
// Specify whether to move repls to a different Sublime Text group (frame)
|
||||
// immediately on opening. Setting this to true will simply move it to
|
||||
// the 'next' group from the one that was in focus when it was opened
|
||||
// (one down with row layout, one to the right with column and grid
|
||||
// layout). Alternatively, you can set this to the index of the group in
|
||||
// which you want all repls to be opened (index 0 being the top-left group).
|
||||
// Activating this option will NOT automatically change your layout/create
|
||||
// a new group if it isn't open.
|
||||
"open_repl_in_group": true,
|
||||
|
||||
// Persistent history is stored per REPL external_id, it means that all python
|
||||
// REPLS will share history. If you wish you can disable history altogether
|
||||
"persistent_history_enabled": true,
|
||||
|
||||
// By default SublimeREPL leaves REPL view open once the underlying subprocess
|
||||
// dies or closes connection. This is useful when the process dies for an unexpected
|
||||
// reason as it allows you to inspect it output. If you want. Setting this
|
||||
// to true will cause SublimreREPL to close view once the process died.
|
||||
"view_auto_close": false,
|
||||
|
||||
// Some terminals output ascii color codes which are not currently supported
|
||||
// enable this option to filter them out.
|
||||
"filter_ascii_color_codes": true,
|
||||
|
||||
// Where to look for python virtualenvs
|
||||
"python_virtualenv_paths": [
|
||||
"~/.virtualenvs", // virtualenvwrapper
|
||||
"~/.venv" // venv.bash https://github.com/wuub/venv
|
||||
],
|
||||
|
||||
// Use arrows for history navigation instead of Alt+[P|N]/Ctrl+[P|N]
|
||||
"history_arrows": true,
|
||||
|
||||
// standard sublime view settings that will be overwritten on each repl view
|
||||
// this has to be customized as a whole dictionary
|
||||
"repl_view_settings": {
|
||||
"translate_tabs_to_spaces": false,
|
||||
"auto_indent": false,
|
||||
"smart_indent": false,
|
||||
"spell_check": false,
|
||||
"indent_subsequent_lines": false,
|
||||
"detect_indentation": false,
|
||||
"auto_complete": true,
|
||||
"line_numbers": false,
|
||||
"gutter": false
|
||||
},
|
||||
|
||||
// this settings exposes additional variables in repl config files, especially
|
||||
// those related to sublime projects that are not available through standard API
|
||||
// WARNING: this will switch your build system back to Automatic each time a REPL
|
||||
// is started so beware!
|
||||
"use_build_system_hack": false,
|
||||
|
||||
// IP address used to setup autocomplete server in sublimerepl.
|
||||
// changing this is usefull when you want to exclude one address
|
||||
// from proxychains/tsocks routing
|
||||
"autocomplete_server_ip": "127.0.0.1",
|
||||
|
||||
// Mapping is used, when external_id of REPL does not match
|
||||
// source.[xxx] scope of syntax definition used to highlight
|
||||
// files from which text is being transfered. For example octave
|
||||
// repls use source.matlab syntax files and w/o this mapping text transfer
|
||||
// will not work
|
||||
"external_id_mapping": {
|
||||
"octave": "matlab"
|
||||
},
|
||||
|
||||
// If set to true, SublimeREPL will try to append evaluated code to repl
|
||||
// output before evaluation (e.g. Ctrl+, f)
|
||||
"show_transferred_text": false
|
||||
}
|
||||
1
Packages/SublimeREPL/__init__.py
Normal file
1
Packages/SublimeREPL/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from __future__ import absolute_import, unicode_literals, print_function, division
|
||||
41
Packages/SublimeREPL/completions.py
Normal file
41
Packages/SublimeREPL/completions.py
Normal file
@@ -0,0 +1,41 @@
|
||||
from __future__ import absolute_import, unicode_literals, print_function, division
|
||||
|
||||
import sublime
|
||||
import sublime_plugin
|
||||
|
||||
|
||||
|
||||
class SublimeREPLCompletions(sublime_plugin.EventListener):
|
||||
def on_query_completions(self, view, prefix, locations):
|
||||
try:
|
||||
from .sublimerepl import manager
|
||||
except ValueError:
|
||||
from sublimerepl import manager
|
||||
|
||||
if not view.settings().get("repl"):
|
||||
return True
|
||||
|
||||
rv = manager.repl_view(view)
|
||||
if not rv:
|
||||
return []
|
||||
|
||||
repl = rv.repl
|
||||
if not repl.autocomplete_available():
|
||||
return []
|
||||
|
||||
line = view.line(locations[0])
|
||||
|
||||
start = max(line.begin(), rv._output_end)
|
||||
end = line.end()
|
||||
|
||||
whole_line = view.substr(sublime.Region(start, end))
|
||||
pos_in_line = locations[0] - start
|
||||
whole_prefix = whole_line[:pos_in_line]
|
||||
|
||||
completions = repl.autocomplete_completions(
|
||||
whole_line=whole_line,
|
||||
pos_in_line=pos_in_line,
|
||||
prefix=prefix,
|
||||
whole_prefix=whole_prefix,
|
||||
locations=locations)
|
||||
return completions, sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS
|
||||
10
Packages/SublimeREPL/config/Clisp/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/Clisp/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Clisp",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_clisp",
|
||||
"file": "config/Clisp/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
26
Packages/SublimeREPL/config/Clisp/Main.sublime-menu
Normal file
26
Packages/SublimeREPL/config/Clisp/Main.sublime-menu
Normal file
@@ -0,0 +1,26 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"id": "repl_clisp",
|
||||
"caption": "Clisp",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"cmd": ["clisp", "-disable-readline"],
|
||||
"cwd": "$file_path",
|
||||
"syntax": "Packages/Lisp/Lisp.tmLanguage",
|
||||
"external_id": "lisp"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
18
Packages/SublimeREPL/config/Clojure/Default.sublime-commands
Normal file
18
Packages/SublimeREPL/config/Clojure/Default.sublime-commands
Normal file
@@ -0,0 +1,18 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Clojure",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_clojure",
|
||||
"file": "config/Clojure/Main.sublime-menu"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption": "SublimeREPL: Clojure-Telnet",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_clojure_telnet",
|
||||
"file": "config/Clojure/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,4 @@
|
||||
[
|
||||
{ "keys": ["ctrl+f12", "c", "s"], "command": "run_existing_window_command", "args": {"id": "repl_clojure", "file": "config/Clojure/Main.sublime-menu"}},
|
||||
{ "keys": ["ctrl+f12", "c", "t"], "command": "run_existing_window_command", "args": {"id": "repl_clojure_telnet", "file": "config/Clojure/Main.sublime-menu"}}
|
||||
]
|
||||
38
Packages/SublimeREPL/config/Clojure/Main.sublime-menu
Normal file
38
Packages/SublimeREPL/config/Clojure/Main.sublime-menu
Normal file
@@ -0,0 +1,38 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"caption": "Clojure",
|
||||
"id": "Clojure",
|
||||
"children":[
|
||||
{"command": "repl_open",
|
||||
"caption": "Clojure",
|
||||
"id": "repl_clojure",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"cmd": {"windows": ["lein.bat", "repl"],
|
||||
"linux": ["lein", "repl"],
|
||||
"osx": ["lein", "repl"]},
|
||||
"soft_quit": "\n(. System exit 0)\n",
|
||||
"cwd": {"windows":"c:/Clojure",
|
||||
"linux": "$file_path",
|
||||
"osx": "$file_path"},
|
||||
"syntax": "Packages/Clojure/Clojure.tmLanguage",
|
||||
"external_id": "clojure",
|
||||
"extend_env": {"INSIDE_EMACS": "1"}
|
||||
}
|
||||
},
|
||||
{"command": "clojure_auto_telnet_repl",
|
||||
"id": "repl_clojure_telnet",
|
||||
"caption": "Clojure-Telnet"}]}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,18 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: ClojureScript Browser REPL",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_clojurescript_browser",
|
||||
"file": "config/ClojureScript/Main.sublime-menu"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption": "SublimeREPL: ClojureScript",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_clojurescript",
|
||||
"file": "config/ClojureScript/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
54
Packages/SublimeREPL/config/ClojureScript/Main.sublime-menu
Normal file
54
Packages/SublimeREPL/config/ClojureScript/Main.sublime-menu
Normal file
@@ -0,0 +1,54 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"caption": "ClojureScript",
|
||||
"id": "ClojureScript",
|
||||
"children":[
|
||||
{"command": "repl_open",
|
||||
"caption": "ClojureScript Browser REPL",
|
||||
"id": "repl_clojurescript_browser",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"cmd": {"windows": ["lein.bat", "trampoline", "cljsbuild", "repl-listen"],
|
||||
"linux": ["lein", "trampoline", "cljsbuild", "repl-listen"],
|
||||
"osx": ["lein", "trampoline", "cljsbuild", "repl-listen"]},
|
||||
"soft_quit": "\n(. System exit 0)\n",
|
||||
"cwd": {"windows":"c:/Clojure",
|
||||
"linux": "$file_path",
|
||||
"osx": "$file_path"},
|
||||
"syntax": "Packages/Clojure/Clojure.tmLanguage",
|
||||
"external_id": "clojurescript",
|
||||
"extend_env": {"INSIDE_EMACS": "1"}
|
||||
}
|
||||
},
|
||||
{"command": "repl_open",
|
||||
"caption": "ClojureScript",
|
||||
"id": "repl_clojurescript",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"cmd": {"windows": ["lein.bat", "trampoline", "cljsbuild", "repl-rhino"],
|
||||
"linux": ["lein", "trampoline", "cljsbuild", "repl-rhino"],
|
||||
"osx": ["lein", "trampoline", "cljsbuild", "repl-rhino"]},
|
||||
"soft_quit": "\n(. System exit 0)\n",
|
||||
"cwd": {"windows":"c:/Clojure",
|
||||
"linux": "$file_path",
|
||||
"osx": "$file_path"},
|
||||
"syntax": "Packages/Clojure/Clojure.tmLanguage",
|
||||
"external_id": "clojurescript",
|
||||
"extend_env": {"INSIDE_EMACS": "1"}
|
||||
}
|
||||
}
|
||||
]}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>comment</key>
|
||||
<string>ClojureScript</string>
|
||||
<key>name</key>
|
||||
<string>ClojureScript</string>
|
||||
<key>fileTypes</key>
|
||||
<array>
|
||||
<string>cljs</string>
|
||||
</array>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>include</key>
|
||||
<string>source.clojure</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>scopeName</key>
|
||||
<string>source.clojurescript</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: CoffeeScript",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_coffeescript",
|
||||
"file": "config/CoffeeScript/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
28
Packages/SublimeREPL/config/CoffeeScript/Main.sublime-menu
Normal file
28
Packages/SublimeREPL/config/CoffeeScript/Main.sublime-menu
Normal file
@@ -0,0 +1,28 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"id": "repl_coffeescript",
|
||||
"caption": "CoffeeScript",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"cmd": ["coffee", "-i"],
|
||||
"cwd": "$file_path",
|
||||
"syntax": "Packages/CoffeeScript/CoffeeScript.tmLanguage",
|
||||
"external_id": "coffeescript",
|
||||
"additional_scopes": ["coffee"],
|
||||
"extend_env": {"NODE_DISABLE_COLORS": "1"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
10
Packages/SublimeREPL/config/Elixir/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/Elixir/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Elixir",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_elixir",
|
||||
"file": "config/Elixir/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
27
Packages/SublimeREPL/config/Elixir/Main.sublime-menu
Normal file
27
Packages/SublimeREPL/config/Elixir/Main.sublime-menu
Normal file
@@ -0,0 +1,27 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"id": "repl_elixir",
|
||||
"caption": "Elixir",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"cmd": ["iex"],
|
||||
"cwd": "$file_path",
|
||||
"syntax": "Packages/Elixir/Elixir.tmLanguage",
|
||||
"external_id": "elixir",
|
||||
"extend_env": {"NODE_DISABLE_COLORS": "1"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
10
Packages/SublimeREPL/config/Erlang/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/Erlang/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Erlang",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_erlang",
|
||||
"file": "config/Erlang/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
27
Packages/SublimeREPL/config/Erlang/Main.sublime-menu
Normal file
27
Packages/SublimeREPL/config/Erlang/Main.sublime-menu
Normal file
@@ -0,0 +1,27 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"id": "repl_erlang",
|
||||
"caption": "Erlang",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"cmd": ["erl", "-i"],
|
||||
"cwd": "$file_path",
|
||||
"syntax": "Packages/Erlang/Erlang.tmLanguage",
|
||||
"external_id": "erlang",
|
||||
"extend_env": {"NODE_DISABLE_COLORS": "1"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
10
Packages/SublimeREPL/config/Execnet/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/Execnet/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Python - execnet",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_sublime_execnet",
|
||||
"file": "config/Execnet/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
21
Packages/SublimeREPL/config/Execnet/Main.sublime-menu
Normal file
21
Packages/SublimeREPL/config/Execnet/Main.sublime-menu
Normal file
@@ -0,0 +1,21 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children": [
|
||||
{"caption": "Python",
|
||||
"id": "Python",
|
||||
"children": [
|
||||
{
|
||||
"command": "execnet_virtualenv_repl",
|
||||
"id": "repl_sublime_execnet",
|
||||
"caption": "Python - execnet"
|
||||
}
|
||||
]}
|
||||
]}
|
||||
]
|
||||
}]
|
||||
10
Packages/SublimeREPL/config/F/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/F/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: F#",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_f#",
|
||||
"file": "config/F/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
31
Packages/SublimeREPL/config/F/Main.sublime-menu
Normal file
31
Packages/SublimeREPL/config/F/Main.sublime-menu
Normal file
@@ -0,0 +1,31 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"caption": "F#",
|
||||
"id": "repl_f#",
|
||||
"mnemonic": "f",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"external_id": "fsharp",
|
||||
"encoding": "utf8",
|
||||
"cmd": {
|
||||
"windows": ["fsi.exe", "--utf8output", "--gui-"],
|
||||
"osx": ["fsharpi", "--utf8output", "--readline-"],
|
||||
"linux": ["fsi", "--utf8output", "--readline-"]},
|
||||
"cmd_postfix": ";;\n",
|
||||
"cwd": "$file_path",
|
||||
"syntax": "Packages/F#/F#.tmLanguage"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
10
Packages/SublimeREPL/config/GDB/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/GDB/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: GDB",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_gdb",
|
||||
"file": "config/GDB/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
26
Packages/SublimeREPL/config/GDB/Main.sublime-menu
Normal file
26
Packages/SublimeREPL/config/GDB/Main.sublime-menu
Normal file
@@ -0,0 +1,26 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"caption": "GDB",
|
||||
"id": "repl_gdb",
|
||||
"mnemonic": "d",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"cmd": ["gdb"],
|
||||
"cwd": "$file_path",
|
||||
"external_id": "gdb"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
10
Packages/SublimeREPL/config/Groovy/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/Groovy/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Groovy",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_groovy",
|
||||
"file": "config/Groovy/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
35
Packages/SublimeREPL/config/Groovy/Main.sublime-menu
Normal file
35
Packages/SublimeREPL/config/Groovy/Main.sublime-menu
Normal file
@@ -0,0 +1,35 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"id": "repl_groovy",
|
||||
"caption": "Groovy",
|
||||
"mnemonic": "g",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"external_id": "groovy",
|
||||
"cmd": {"linux": ["groovysh", "--terminal=none"],
|
||||
"osx": ["groovysh", "--terminal=none"],
|
||||
"windows": ["groovysh.bat", "--terminal=none"]},
|
||||
"soft_quit": "\nexit\n",
|
||||
"cwd": "$file_path",
|
||||
"cmd_postfix": "\n",
|
||||
"extend_env": {"osx": {"PATH": "{PATH}:/usr/local/bin"},
|
||||
"linux": {"PATH": "{PATH}:/usr/local/bin"},
|
||||
"windows": {}},
|
||||
"suppress_echo": false,
|
||||
"syntax": "Packages/Groovy/Groovy.tmLanguage"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
10
Packages/SublimeREPL/config/Haskell/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/Haskell/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Haskell",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_haskell",
|
||||
"file": "config/Haskell/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
27
Packages/SublimeREPL/config/Haskell/Main.sublime-menu
Normal file
27
Packages/SublimeREPL/config/Haskell/Main.sublime-menu
Normal file
@@ -0,0 +1,27 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"caption": "Haskell",
|
||||
"id": "repl_haskell",
|
||||
"mnemonic": "h",
|
||||
"args": {
|
||||
"type": "sublime_haskell",
|
||||
"encoding": "utf8",
|
||||
"cmd": ["ghci"],
|
||||
"cwd": "$file_path",
|
||||
"external_id": "haskell",
|
||||
"syntax": "Packages/Haskell/Haskell.tmLanguage"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
10
Packages/SublimeREPL/config/Io/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/Io/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Io",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_io",
|
||||
"file": "config/Io/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
255
Packages/SublimeREPL/config/Io/Io.tmLanguage
Normal file
255
Packages/SublimeREPL/config/Io/Io.tmLanguage
Normal file
@@ -0,0 +1,255 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>keyEquivalent</key>
|
||||
<string>^~I</string>
|
||||
<key>name</key>
|
||||
<string>Io Repl</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>meta.empty-parenthesis.io</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>comment</key>
|
||||
<string>we match this to overload return inside () --Allan; scoping rules for what gets the scope have changed, so we now group the ) instead of the ( -- Rob</string>
|
||||
<key>match</key>
|
||||
<string>\((\))</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>meta.comma-parenthesis.io</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>comment</key>
|
||||
<string>We want to do the same for ,) -- Seckar; same as above -- Rob</string>
|
||||
<key>match</key>
|
||||
<string>\,(\))</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>\b(if|ifTrue|ifFalse|ifTrueIfFalse|for|loop|reverseForeach|foreach|map|continue|break|while|do|return)\b</string>
|
||||
<key>name</key>
|
||||
<string>keyword.control.io</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>/\*</string>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.definition.comment.io</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>\*/</string>
|
||||
<key>name</key>
|
||||
<string>comment.block.io</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^[ \t]+)?(?=//)</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.whitespace.comment.leading.io</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>(?!\G)</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>//</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.definition.comment.io</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>\n</string>
|
||||
<key>name</key>
|
||||
<string>comment.line.double-slash.io</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>(^[ \t]+)?(?=#)</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.whitespace.comment.leading.io</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>(?!\G)</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>#</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.definition.comment.io</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>\n</string>
|
||||
<key>name</key>
|
||||
<string>comment.line.number-sign.io</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>comment</key>
|
||||
<string>I wonder if some of this isn't variable.other.language? --Allan; scoping this as variable.language to match Objective-C's handling of 'self', which is inconsistent with C++'s handling of 'this' but perhaps intentionally so -- Rob</string>
|
||||
<key>match</key>
|
||||
<string>\b(self|sender|target|proto|protos|parent)\b</string>
|
||||
<key>name</key>
|
||||
<string>variable.language.io</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string><=|>=|=|:=|\*|\||\|\||\+|-|/|&|&&|>|<|\?|@|@@|\b(and|or)\b</string>
|
||||
<key>name</key>
|
||||
<string>keyword.operator.io</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>\bGL[\w_]+\b</string>
|
||||
<key>name</key>
|
||||
<string>constant.other.io</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>\b([A-Z](\w+)?)\b</string>
|
||||
<key>name</key>
|
||||
<string>support.class.io</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>\b(clone|call|init|method|list|vector|block|(\w+(?=\s*\()))\b</string>
|
||||
<key>name</key>
|
||||
<string>support.function.io</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>\b(gl(u|ut)?[A-Z]\w+)\b</string>
|
||||
<key>name</key>
|
||||
<string>support.function.open-gl.io</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>"""</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.definition.string.begin.io</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>"""</string>
|
||||
<key>endCaptures</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.definition.string.end.io</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>name</key>
|
||||
<string>string.quoted.triple.io</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>\\.</string>
|
||||
<key>name</key>
|
||||
<string>constant.character.escape.io</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>"</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.definition.string.begin.io</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>end</key>
|
||||
<string>"</string>
|
||||
<key>endCaptures</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>punctuation.definition.string.end.io</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>name</key>
|
||||
<string>string.quoted.double.io</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>\\.</string>
|
||||
<key>name</key>
|
||||
<string>constant.character.escape.io</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f)?\b</string>
|
||||
<key>name</key>
|
||||
<string>constant.numeric.io</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>(Lobby)\b</string>
|
||||
<key>name</key>
|
||||
<string>variable.other.global.io</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>\b(TRUE|true|FALSE|false|NULL|null|Null|Nil|nil|YES|NO)\b</string>
|
||||
<key>name</key>
|
||||
<string>constant.language.io</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>scopeName</key>
|
||||
<string>source.io</string>
|
||||
<key>uuid</key>
|
||||
<string>52E416F3-9DF2-4579-8BC6-C54EBEF94423</string>
|
||||
</dict>
|
||||
</plist>
|
||||
32
Packages/SublimeREPL/config/Io/Main.sublime-menu
Normal file
32
Packages/SublimeREPL/config/Io/Main.sublime-menu
Normal file
@@ -0,0 +1,32 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"caption": "Io",
|
||||
"id": "repl_io",
|
||||
"mnemonic": "i",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"cmd": {"linux": ["io", "${packages}/SublimeREPL/config/Io/repl.io"],
|
||||
"windows": ["io", "${packages}/SublimeREPL/config/Io/repl.io"],
|
||||
"osx": ["io", "${packages}/SublimeREPL/config/Io/repl.io"]},
|
||||
"cwd": "$file_path",
|
||||
"external_id": "io",
|
||||
"suppress_echo": {"linux": true,
|
||||
"windows": false,
|
||||
"osx": true},
|
||||
"syntax": "Packages/SublimeREPL/config/Io/Io.tmLanguage"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
147
Packages/SublimeREPL/config/Io/repl.io
Normal file
147
Packages/SublimeREPL/config/Io/repl.io
Normal file
@@ -0,0 +1,147 @@
|
||||
# This code is modified Z_CLI.io from https://github.com/stevedekorte/io/blob/master/libs/iovm/io/Z_CLI.io
|
||||
Locals removeSlot("doFile")
|
||||
|
||||
DummyLine := File standardInput do(
|
||||
readLine := method(prompt,
|
||||
if(prompt, prompt print; File flush)
|
||||
resend
|
||||
)
|
||||
)
|
||||
|
||||
CLI := Object clone do(
|
||||
prompt ::= "Io> "
|
||||
outPrompt ::= "==> "
|
||||
continuedLinePrompt ::= "... "
|
||||
|
||||
isRunning ::= true # Get rid of this ...
|
||||
commandLineLabel ::= "Command Line" # and this?
|
||||
|
||||
context ::= lazySlot(
|
||||
Lobby do(
|
||||
# Python-style underscore, stores the result of the previous computation.
|
||||
# Example:
|
||||
# Io> 1 + 1
|
||||
# ==> 2
|
||||
# Io> _ == 2
|
||||
# ==> true
|
||||
_ ::= nil
|
||||
|
||||
exit := method(CLI stop)
|
||||
)
|
||||
)
|
||||
|
||||
lineReader := lazySlot(
|
||||
# This might look as a `hack`, but why not use stdin as the default
|
||||
# reader, since it shares the same interface with Read(Edit)Line,
|
||||
# i.e. <reader> readLine.
|
||||
reader := DummyLine
|
||||
|
||||
# Trying to use GNU ReadLine as the default line reader, falling
|
||||
# back to EditLine, if the attempt failed.
|
||||
try(reader := ReadLine) catch(Exception,
|
||||
try(reader := EditLine)
|
||||
)
|
||||
reader
|
||||
)
|
||||
|
||||
# A list of error messages for the errors we understand.
|
||||
knownErrors := lazySlot(
|
||||
list("(", "[", "{", "\"\"\"", "(x,") map(error,
|
||||
self errorMessage(try(error asMessage) error)
|
||||
)
|
||||
)
|
||||
|
||||
errorMessage := method(error, error beforeSeq(" on line"))
|
||||
|
||||
doFile := method(path,
|
||||
System launchPath = if(Path isPathAbsolute(path),
|
||||
path
|
||||
,
|
||||
System launchPath asMutable appendPathSeq(path)
|
||||
) pathComponent
|
||||
|
||||
System launchScript = path
|
||||
|
||||
context doFile(path)
|
||||
)
|
||||
|
||||
doLine := method(lineAsMessage,
|
||||
# Execute the line and report any exceptions which happened.
|
||||
executionError := try(result := context doMessage(lineAsMessage))
|
||||
if(executionError,
|
||||
executionError showStack
|
||||
,
|
||||
# Write out the command's result to stdout; nothing is written
|
||||
# if the CLI is terminated, this condition is satisfied, only
|
||||
# when CLI exit() was called.
|
||||
if(isRunning,
|
||||
context set_(getSlot("result"))
|
||||
writeCommandResult(getSlot("result")))
|
||||
)
|
||||
)
|
||||
|
||||
doIorc := method(
|
||||
# Note: Probably won't work on Windows, since it uses %HOMEPATH%
|
||||
# and %HOMEDRIVE% pair to indentify user's home directory.
|
||||
home := System getEnvironmentVariable("HOME")
|
||||
if(home,
|
||||
path := Path with(home, ".iorc")
|
||||
if(File with(path) exists,
|
||||
context doFile(path)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
writeWelcomeBanner := method("Io #{System version}" interpolate println)
|
||||
writeCommandResult := method(result,
|
||||
outPrompt print
|
||||
|
||||
if(exc := try(getSlot("result") asString println),
|
||||
"<exception while dislaying result>" println
|
||||
exc showStack
|
||||
)
|
||||
)
|
||||
|
||||
stop := method(setIsRunning(false))
|
||||
|
||||
interactive := method(
|
||||
# Start with the default prompt. The prompt is changed for continued lines,
|
||||
# and errors.
|
||||
prompt := self prompt
|
||||
line := ""
|
||||
# If there are unmatched (, {, [ or the command ends with a \ then we'll
|
||||
# need to read multiple lines.
|
||||
loop(
|
||||
# Write out prompt and read line.
|
||||
if(nextLine := lineReader readLine(prompt),
|
||||
# Add what we read to the line we've been building up
|
||||
line = line .. nextLine
|
||||
,
|
||||
# Note: readLine method returns nil if ^D was pressed.
|
||||
context exit
|
||||
"\n" print # Fixing the newline issue.
|
||||
)
|
||||
|
||||
compileError := try(
|
||||
lineAsMessage := line asMessage setLabel(commandLineLabel)
|
||||
)
|
||||
|
||||
if(compileError,
|
||||
# Not sure that, displaying a different notification for
|
||||
# each error actually makes sense.
|
||||
if(nextLine size > 0 and errorMessage(compileError error) in(knownErrors),
|
||||
prompt = continuedLinePrompt
|
||||
continue
|
||||
)
|
||||
# If the error can't be fixed by continuing the line - report it.
|
||||
compileError showStack
|
||||
,
|
||||
doLine(lineAsMessage)
|
||||
)
|
||||
|
||||
return if(isRunning, interactive, nil)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
CLI interactive
|
||||
10
Packages/SublimeREPL/config/Lua/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/Lua/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Lua",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_lua",
|
||||
"file": "config/Lua/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
27
Packages/SublimeREPL/config/Lua/Main.sublime-menu
Normal file
27
Packages/SublimeREPL/config/Lua/Main.sublime-menu
Normal file
@@ -0,0 +1,27 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"caption": "Lua",
|
||||
"id": "repl_lua",
|
||||
"mnemonic": "l",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"cmd": ["lua", "-i"],
|
||||
"cwd": "$file_path",
|
||||
"external_id": "lua",
|
||||
"syntax": "Packages/Lua/Lua.tmLanguage"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
29
Packages/SublimeREPL/config/Main.sublime-menu.template
Normal file
29
Packages/SublimeREPL/config/Main.sublime-menu.template
Normal file
@@ -0,0 +1,29 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
// {"command": "repl_open",
|
||||
// "caption": "Command Caption in Menu",
|
||||
// "mnemonic": "m",
|
||||
// "args": {
|
||||
// "type": "subprocess|telnet",
|
||||
// "encoding": "utf8",
|
||||
// "cmd": ["bash", "-i"] or "bash -i" on windows,
|
||||
// "cwd": "$file_path",
|
||||
// "env": {}, // clean environment for subprocess repl
|
||||
// "extend_env": {}, // variables to be added to standard env
|
||||
// "cmd_postfix": "\n", // postfix that will be automatically added after a line in repl
|
||||
// "suppress_echo": false, // try to remove remote echo
|
||||
// "syntax": "Packages/Text/Plain text.tmLanguage"
|
||||
// }
|
||||
// },
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
10
Packages/SublimeREPL/config/Matlab/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/Matlab/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Matlab",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_matlab",
|
||||
"file": "config/Matlab/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
27
Packages/SublimeREPL/config/Matlab/Main.sublime-menu
Normal file
27
Packages/SublimeREPL/config/Matlab/Main.sublime-menu
Normal file
@@ -0,0 +1,27 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"caption": "Matlab",
|
||||
"id": "repl_matlab",
|
||||
"mnemonic": "m",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"cmd": ["matlab", "-nodesktop","-nosplash"],
|
||||
"cwd": "$file_path",
|
||||
"external_id": "matlab",
|
||||
"syntax": "Packages/Matlab/Matlab.tmLanguage"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
10
Packages/SublimeREPL/config/Maxima/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/Maxima/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Maxima",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_maxima",
|
||||
"file": "config/Maxima/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
26
Packages/SublimeREPL/config/Maxima/Main.sublime-menu
Normal file
26
Packages/SublimeREPL/config/Maxima/Main.sublime-menu
Normal file
@@ -0,0 +1,26 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"caption": "Maxima",
|
||||
"id": "repl_maxima",
|
||||
"mnemonic": "m",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"cmd": ["maxima"],
|
||||
"cwd": "$file_path",
|
||||
"external_id": "maxima"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
10
Packages/SublimeREPL/config/MozRepl/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/MozRepl/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: MozRepl",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_mozrepl",
|
||||
"file": "config/MozRepl/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
26
Packages/SublimeREPL/config/MozRepl/Main.sublime-menu
Normal file
26
Packages/SublimeREPL/config/MozRepl/Main.sublime-menu
Normal file
@@ -0,0 +1,26 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"caption": "MozRepl",
|
||||
"mnemonic": "m",
|
||||
"id": "repl_mozrepl",
|
||||
"args": {
|
||||
"type": "telnet",
|
||||
"encoding": "utf8",
|
||||
"host":"localhost",
|
||||
"port": 4242,
|
||||
"syntax": "Packages/JavaScript/JavaScript.tmLanguage"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
10
Packages/SublimeREPL/config/NodeJS/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/NodeJS/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Node",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_node",
|
||||
"file": "config/NodeJS/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
31
Packages/SublimeREPL/config/NodeJS/Main.sublime-menu
Normal file
31
Packages/SublimeREPL/config/NodeJS/Main.sublime-menu
Normal file
@@ -0,0 +1,31 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"caption": "Node",
|
||||
"id": "repl_node",
|
||||
"mnemonic": "n",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"cmd": {"linux": ["node", "${packages}/SublimeREPL/config/NodeJS/repl.js"],
|
||||
"osx": ["node", "${packages}/SublimeREPL/config/NodeJS/repl.js"],
|
||||
"windows": ["node.exe", "${packages}/SublimeREPL/config/NodeJS/repl.js"]},
|
||||
"cwd": "$file_path",
|
||||
"syntax": "Packages/JavaScript/JavaScript.tmLanguage",
|
||||
"external_id": "js",
|
||||
"autocomplete_server": true,
|
||||
"extend_env": {"NODE_NO_READLINE": 1}
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
38
Packages/SublimeREPL/config/NodeJS/repl.js
Normal file
38
Packages/SublimeREPL/config/NodeJS/repl.js
Normal file
@@ -0,0 +1,38 @@
|
||||
(function () {
|
||||
|
||||
var repl = require('repl');
|
||||
|
||||
var rep = repl.start({
|
||||
prompt: null, //'> ',
|
||||
source: null, //process.stdin,
|
||||
eval: null, //require('vm').runInThisContext,
|
||||
useGlobal: true, //false
|
||||
useColors: false
|
||||
});
|
||||
|
||||
|
||||
var net = require('net');
|
||||
var ac_port = process.env.SUBLIMEREPL_AC_PORT;
|
||||
var client = new net.Socket();
|
||||
client.connect(ac_port, "localhost", function() {});
|
||||
|
||||
client.on('data', function(data) {
|
||||
var strData = data.toString();
|
||||
var index = strData.indexOf(":");
|
||||
var json = strData.slice(index+1, strData.length - 1)
|
||||
var inData = JSON.parse(json);
|
||||
var wordIndex = inData.line.slice(inData.cursor_pos).search(/\b/);
|
||||
if(wordIndex !== 0){
|
||||
inData.line = inData.line.slice(0, inData.cursor_pos);
|
||||
}
|
||||
|
||||
var send = function (_, completions) {
|
||||
var comps = completions[0];
|
||||
var msg = JSON.stringify([inData.line, comps]);
|
||||
var payload = msg.length + ":" + msg + ",";
|
||||
client.write(payload)
|
||||
}
|
||||
rep.rli.completer(inData.line, send);
|
||||
});
|
||||
|
||||
})();
|
||||
10
Packages/SublimeREPL/config/Octave/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/Octave/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Octave",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_octave",
|
||||
"file": "config/Octave/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
28
Packages/SublimeREPL/config/Octave/Main.sublime-menu
Normal file
28
Packages/SublimeREPL/config/Octave/Main.sublime-menu
Normal file
@@ -0,0 +1,28 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"caption": "Octave",
|
||||
"id": "repl_octave",
|
||||
"mnemonic": "o",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"cmd": ["octave", "-i"],
|
||||
"cwd": "$file_path",
|
||||
"external_id": "octave",
|
||||
"additional_scopes": ["matlab"],
|
||||
"syntax": "Packages/Matlab/Matlab.tmLanguage"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
10
Packages/SublimeREPL/config/PHP/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/PHP/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: PHP",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_php",
|
||||
"file": "config/PHP/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
33
Packages/SublimeREPL/config/PHP/Main.sublime-menu
Normal file
33
Packages/SublimeREPL/config/PHP/Main.sublime-menu
Normal file
@@ -0,0 +1,33 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"caption": "PHP",
|
||||
"id": "repl_php",
|
||||
"mnemonic": "s",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": {"windows": "$win_cmd_encoding",
|
||||
"linux": "utf-8",
|
||||
"osx": "utf-8"},
|
||||
"cmd": {"windows": ["php.exe", "-a"],
|
||||
"linux": ["php", "-a"],
|
||||
"osx": ["php", "-a"]},
|
||||
"cwd": "$file_path",
|
||||
"cmd_postfix": "\n",
|
||||
"env": {},
|
||||
"suppress_echo": false,
|
||||
"syntax": "Packages/Text/Plain text.tmLanguage"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
10
Packages/SublimeREPL/config/Perl/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/Perl/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Perl",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_Perl",
|
||||
"file": "config/Perl/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
27
Packages/SublimeREPL/config/Perl/Main.sublime-menu
Normal file
27
Packages/SublimeREPL/config/Perl/Main.sublime-menu
Normal file
@@ -0,0 +1,27 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"caption": "Perl",
|
||||
"id": "repl_Perl",
|
||||
"mnemonic": "p",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"cmd": ["perl","${packages}/SublimeREPL/config/Perl/re.pl"],
|
||||
"cwd": "$file_path",
|
||||
"external_id": "perl",
|
||||
"syntax": "Packages/Perl/Perl.tmLanguage"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
13
Packages/SublimeREPL/config/Perl/re.pl
Normal file
13
Packages/SublimeREPL/config/Perl/re.pl
Normal file
@@ -0,0 +1,13 @@
|
||||
$| = 1;
|
||||
|
||||
while(true) {
|
||||
print "perl> ";
|
||||
$line=<>;
|
||||
$value=eval($line);
|
||||
$error=$@;
|
||||
if( $error ne "" ) {
|
||||
print $error;
|
||||
} else {
|
||||
print "$value\n";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: PowerShell",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_powershell",
|
||||
"file": "config/PowerShell/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
27
Packages/SublimeREPL/config/PowerShell/Main.sublime-menu
Normal file
27
Packages/SublimeREPL/config/PowerShell/Main.sublime-menu
Normal file
@@ -0,0 +1,27 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"caption": "PowerShell",
|
||||
"id": "repl_powershell",
|
||||
"mnemonic": "p",
|
||||
"args": {
|
||||
"type": "powershell",
|
||||
"encoding": "",
|
||||
"cmd": ["powershell", "-"],
|
||||
"cwd": "$file_path",
|
||||
"external_id": "powershell",
|
||||
"syntax": "Packages/PowerShell/Support/PowershellSyntax.tmLanguage"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
38
Packages/SublimeREPL/config/Python/Default.sublime-commands
Normal file
38
Packages/SublimeREPL/config/Python/Default.sublime-commands
Normal file
@@ -0,0 +1,38 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Python",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_python",
|
||||
"file": "config/Python/Main.sublime-menu"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption": "SublimeREPL: Python - PDB current file",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_python_pdb",
|
||||
"file": "config/Python/Main.sublime-menu"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption": "SublimeREPL: Python - RUN current file",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_python_run",
|
||||
"file": "config/Python/Main.sublime-menu"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command": "python_virtualenv_repl",
|
||||
"caption": "SublimeREPL: Python - virtualenv"
|
||||
},
|
||||
{
|
||||
"caption": "SublimeREPL: Python - IPython",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_python_ipython",
|
||||
"file": "config/Python/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
86
Packages/SublimeREPL/config/Python/Main.sublime-menu
Normal file
86
Packages/SublimeREPL/config/Python/Main.sublime-menu
Normal file
@@ -0,0 +1,86 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"caption": "Python",
|
||||
"id": "Python",
|
||||
|
||||
"children":[
|
||||
{"command": "repl_open",
|
||||
"caption": "Python",
|
||||
"id": "repl_python",
|
||||
"mnemonic": "p",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"cmd": ["python", "-i", "-u"],
|
||||
"cwd": "$file_path",
|
||||
"syntax": "Packages/Python/Python.tmLanguage",
|
||||
"external_id": "python",
|
||||
"extend_env": {"PYTHONIOENCODING": "utf-8"}
|
||||
}
|
||||
},
|
||||
{"command": "python_virtualenv_repl",
|
||||
"id": "python_virtualenv_repl",
|
||||
"caption": "Python - virtualenv"},
|
||||
{"command": "repl_open",
|
||||
"caption": "Python - PDB current file",
|
||||
"id": "repl_python_pdb",
|
||||
"mnemonic": "d",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"cmd": ["python", "-i", "-u", "-m", "pdb", "$file_basename"],
|
||||
"cwd": "$file_path",
|
||||
"syntax": "Packages/Python/Python.tmLanguage",
|
||||
"external_id": "python",
|
||||
"extend_env": {"PYTHONIOENCODING": "utf-8"}
|
||||
}
|
||||
},
|
||||
{"command": "repl_open",
|
||||
"caption": "Python - RUN current file",
|
||||
"id": "repl_python_run",
|
||||
"mnemonic": "d",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"cmd": ["python", "-u", "$file_basename"],
|
||||
"cwd": "$file_path",
|
||||
"syntax": "Packages/Python/Python.tmLanguage",
|
||||
"external_id": "python",
|
||||
"extend_env": {"PYTHONIOENCODING": "utf-8"}
|
||||
}
|
||||
},
|
||||
{"command": "repl_open",
|
||||
"caption": "Python - IPython",
|
||||
"id": "repl_python_ipython",
|
||||
"mnemonic": "p",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"autocomplete_server": true,
|
||||
"cmd": {
|
||||
"osx": ["python", "-u", "${packages}/SublimeREPL/config/Python/ipy_repl.py"],
|
||||
"linux": ["python", "-u", "${packages}/SublimeREPL/config/Python/ipy_repl.py"],
|
||||
"windows": ["python", "-u", "${packages}/SublimeREPL/config/Python/ipy_repl.py"]
|
||||
},
|
||||
"cwd": "$file_path",
|
||||
"syntax": "Packages/Python/Python.tmLanguage",
|
||||
"external_id": "python",
|
||||
"extend_env": {
|
||||
"PYTHONIOENCODING": "utf-8",
|
||||
"SUBLIMEREPL_EDITOR": "$editor"
|
||||
}
|
||||
}
|
||||
}
|
||||
]}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
118
Packages/SublimeREPL/config/Python/ipy_repl.py
Normal file
118
Packages/SublimeREPL/config/Python/ipy_repl.py
Normal file
@@ -0,0 +1,118 @@
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import socket
|
||||
import threading
|
||||
|
||||
activate_this = os.environ.get("SUBLIMEREPL_ACTIVATE_THIS", None)
|
||||
|
||||
# turn off pager
|
||||
os.environ['TERM'] = 'emacs'
|
||||
|
||||
if activate_this:
|
||||
with open(activate_this, "r") as f:
|
||||
exec(f.read(), {"__file__": activate_this})
|
||||
|
||||
try:
|
||||
import IPython
|
||||
IPYTHON = True
|
||||
except ImportError:
|
||||
IPYTHON = False
|
||||
|
||||
if not IPYTHON:
|
||||
# for virtualenvs w/o IPython
|
||||
import code
|
||||
code.InteractiveConsole().interact()
|
||||
|
||||
from IPython.config.loader import Config
|
||||
|
||||
editor = "subl -w"
|
||||
|
||||
cfg = Config()
|
||||
cfg.InteractiveShell.use_readline = False
|
||||
cfg.InteractiveShell.autoindent = False
|
||||
cfg.InteractiveShell.colors = "NoColor"
|
||||
cfg.InteractiveShell.editor = os.environ.get("SUBLIMEREPL_EDITOR", editor)
|
||||
|
||||
try:
|
||||
# IPython 1.0.0
|
||||
from IPython.terminal.console.app import ZMQTerminalIPythonApp
|
||||
|
||||
def kernel_client(zmq_shell):
|
||||
return zmq_shell.kernel_client
|
||||
except ImportError:
|
||||
# Older IPythons
|
||||
from IPython.frontend.terminal.console.app import ZMQTerminalIPythonApp
|
||||
|
||||
def kernel_client(zmq_shell):
|
||||
return zmq_shell.kernel_manager
|
||||
|
||||
|
||||
embedded_shell = ZMQTerminalIPythonApp(config=cfg, user_ns={})
|
||||
embedded_shell.initialize()
|
||||
|
||||
if os.name == "nt":
|
||||
# OMG what a fugly hack
|
||||
import IPython.utils.io as io
|
||||
io.stdout = io.IOStream(sys.__stdout__, fallback=io.devnull)
|
||||
io.stderr = io.IOStream(sys.__stderr__, fallback=io.devnull)
|
||||
embedded_shell.shell.show_banner() # ... my eyes, oh my eyes..
|
||||
|
||||
|
||||
ac_port = int(os.environ.get("SUBLIMEREPL_AC_PORT", "0"))
|
||||
ac_ip = os.environ.get("SUBLIMEREPL_AC_IP", "127.0.0.1")
|
||||
if ac_port:
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.connect((ac_ip, ac_port))
|
||||
|
||||
|
||||
def read_netstring(s):
|
||||
size = 0
|
||||
while True:
|
||||
ch = s.recv(1)
|
||||
if ch == b':':
|
||||
break
|
||||
size = size * 10 + int(ch)
|
||||
msg = b""
|
||||
while size != 0:
|
||||
msg += s.recv(size)
|
||||
size -= len(msg)
|
||||
ch = s.recv(1)
|
||||
assert ch == b','
|
||||
return msg
|
||||
|
||||
|
||||
def send_netstring(sock, msg):
|
||||
payload = b"".join([str(len(msg)).encode("ascii"), b':', msg.encode("utf-8"), b','])
|
||||
sock.sendall(payload)
|
||||
|
||||
|
||||
def complete(zmq_shell, req):
|
||||
kc = kernel_client(zmq_shell)
|
||||
msg_id = kc.shell_channel.complete(**req)
|
||||
msg = kc.shell_channel.get_msg(timeout=0.5)
|
||||
if msg['parent_header']['msg_id'] == msg_id:
|
||||
return msg["content"]["matches"]
|
||||
return []
|
||||
|
||||
|
||||
def handle():
|
||||
while True:
|
||||
msg = read_netstring(s).decode("utf-8")
|
||||
try:
|
||||
req = json.loads(msg)
|
||||
completions = complete(embedded_shell, req)
|
||||
result = (req["text"], completions)
|
||||
res = json.dumps(result)
|
||||
send_netstring(s, res)
|
||||
except Exception:
|
||||
send_netstring(s, b"[]")
|
||||
|
||||
if ac_port:
|
||||
t = threading.Thread(target=handle)
|
||||
t.start()
|
||||
|
||||
embedded_shell.start()
|
||||
|
||||
if ac_port:
|
||||
s.close()
|
||||
10
Packages/SublimeREPL/config/R/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/R/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: R",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_r",
|
||||
"file": "config/R/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
42
Packages/SublimeREPL/config/R/Main.sublime-menu
Normal file
42
Packages/SublimeREPL/config/R/Main.sublime-menu
Normal file
@@ -0,0 +1,42 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"caption": "R",
|
||||
"id": "repl_r",
|
||||
"mnemonic": "r",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"external_id": "r",
|
||||
"additional_scopes": ["tex.latex.knitr"],
|
||||
"encoding": {
|
||||
"windows": "$win_cmd_encoding",
|
||||
"linux": "utf8",
|
||||
"osx": "utf8"
|
||||
},
|
||||
"soft_quit": "\nquit(save=\"no\")\n",
|
||||
"cmd": {"linux": ["R", "--interactive", "--no-readline"],
|
||||
"osx": ["R", "--interactive", "--no-readline"],
|
||||
"windows": ["Rterm.exe", "--ess", "--encoding=$win_cmd_encoding"]},
|
||||
"cwd": "$file_path",
|
||||
"extend_env": {"osx": {"PATH": "{PATH}:/usr/local/bin"},
|
||||
"linux": {"PATH": "{PATH}:/usr/local/bin"},
|
||||
"windows": {}},
|
||||
"cmd_postfix": "\n",
|
||||
"suppress_echo": {"osx": true,
|
||||
"linux": true,
|
||||
"windows": false},
|
||||
"syntax": "Packages/R/R Console.tmLanguage"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
10
Packages/SublimeREPL/config/Racket/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/Racket/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Racket",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_plt_racket",
|
||||
"file": "config/Racket/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
28
Packages/SublimeREPL/config/Racket/Main.sublime-menu
Normal file
28
Packages/SublimeREPL/config/Racket/Main.sublime-menu
Normal file
@@ -0,0 +1,28 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children": [
|
||||
{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children": [
|
||||
{
|
||||
"command": "repl_open",
|
||||
"caption": "Racket",
|
||||
"id": "repl_plt_racket",
|
||||
"mnemonic": "n",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"cmd": ["racket"],
|
||||
"cwd": "$file_path",
|
||||
"syntax": "Packages/Racket/Racket.tmLanguage",
|
||||
"external_id": "racket"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
10
Packages/SublimeREPL/config/Rails/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/Rails/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Rails",
|
||||
"command": "run_existing_window_command",
|
||||
"args": {
|
||||
"id": "repl_rails",
|
||||
"file": "config/Rails/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
37
Packages/SublimeREPL/config/Rails/Main.sublime-menu
Normal file
37
Packages/SublimeREPL/config/Rails/Main.sublime-menu
Normal file
@@ -0,0 +1,37 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "Rails",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{
|
||||
"command": "repl_open",
|
||||
"caption": "Rails",
|
||||
"id": "repl_rails",
|
||||
"external_id":"rails",
|
||||
"mnemonic": "r",
|
||||
"args":
|
||||
{
|
||||
"type": "subprocess",
|
||||
"encoding": {"windows": "$win_cmd_encoding",
|
||||
"linux": "utf-8",
|
||||
"osx": "utf-8"},
|
||||
"cmd": { "windows": ["ruby.exe", "${packages}/SublimeREPL/config/Rails/pry_repl.rb", "$editor"],
|
||||
"linux": ["ruby", "${packages}/SublimeREPL/config/Rails/pry_repl.rb", "$editor"],
|
||||
"osx": ["ruby", "${packages}/SublimeREPL/config/Rails/pry_repl.rb", "$editor"] },
|
||||
"env": {},
|
||||
"soft_quit":"\nexit\n",
|
||||
"cwd":"$folder",
|
||||
"cmd_postfix":"\n",
|
||||
"autocomplete_server": true,
|
||||
"syntax": "Packages/Ruby/Ruby.tmLanguage"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
71
Packages/SublimeREPL/config/Rails/pry_repl.rb
Normal file
71
Packages/SublimeREPL/config/Rails/pry_repl.rb
Normal file
@@ -0,0 +1,71 @@
|
||||
# Simply merged `pry_repl.rb` from the Ruby REPL and - https://github.com/doitian/rails-console-pry
|
||||
|
||||
require 'rubygems'
|
||||
gem 'pry'
|
||||
require 'pry'
|
||||
require 'thread'
|
||||
require 'json'
|
||||
require 'pry-rails/version'
|
||||
pry_rails_path = Gem.loaded_specs['pry-rails']
|
||||
|
||||
class PryInput
|
||||
def readline(prompt)
|
||||
$stdout.print prompt
|
||||
$stdout.flush
|
||||
$stdin.readline
|
||||
end
|
||||
end
|
||||
|
||||
class PryOutput
|
||||
def puts(data="")
|
||||
$stdout.puts(data.gsub('`', "'"))
|
||||
$stdout.flush
|
||||
end
|
||||
end
|
||||
|
||||
Pry.config.input = PryInput.new()
|
||||
Pry.config.output = PryOutput.new()
|
||||
Pry.config.color = false
|
||||
Pry.config.editor = ARGV[0]
|
||||
Pry.config.auto_indent = false
|
||||
Pry.config.correct_indent = false
|
||||
|
||||
port = ENV["SUBLIMEREPL_AC_PORT"].to_i
|
||||
|
||||
completer = Pry::InputCompleter.build_completion_proc(binding)
|
||||
|
||||
def read_netstring(s)
|
||||
size = 0
|
||||
while true
|
||||
ch = s.recvfrom(1)[0]
|
||||
if ch == ':'
|
||||
break
|
||||
end
|
||||
size = size * 10 + ch.to_i
|
||||
end
|
||||
msg = ""
|
||||
while size != 0
|
||||
msg += s.recvfrom(size)[0]
|
||||
size -= msg.length
|
||||
end
|
||||
ch = s.recvfrom(1)[0]
|
||||
return msg
|
||||
end
|
||||
|
||||
ENV['RAILS_ENV'] = "development"
|
||||
|
||||
APP_PATH = File.expand_path('config/application')
|
||||
require APP_PATH
|
||||
|
||||
if ::Rails::VERSION::MAJOR >= 3
|
||||
class ::Rails::Console
|
||||
end
|
||||
end
|
||||
|
||||
ARGV.unshift "console"
|
||||
|
||||
$: << File.join(pry_rails_path.full_gem_path, 'lib')
|
||||
require 'pry-rails'
|
||||
|
||||
require 'rails/commands'
|
||||
|
||||
18
Packages/SublimeREPL/config/Ruby/Default.sublime-commands
Normal file
18
Packages/SublimeREPL/config/Ruby/Default.sublime-commands
Normal file
@@ -0,0 +1,18 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Ruby",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_ruby",
|
||||
"file": "config/Ruby/Main.sublime-menu"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption": "SublimeREPL: Ruby IRB (deprecated)",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_ruby_irb",
|
||||
"file": "config/Ruby/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
85
Packages/SublimeREPL/config/Ruby/Main.sublime-menu
Normal file
85
Packages/SublimeREPL/config/Ruby/Main.sublime-menu
Normal file
@@ -0,0 +1,85 @@
|
||||
[
|
||||
{
|
||||
"id":"tools",
|
||||
"children":[
|
||||
{
|
||||
"caption":"SublimeREPL",
|
||||
"mnemonic":"r",
|
||||
"id":"SublimeREPL",
|
||||
"children":[
|
||||
{
|
||||
"caption":"Ruby",
|
||||
"children":[
|
||||
{
|
||||
"command":"repl_open",
|
||||
"caption":"Ruby",
|
||||
"id":"repl_ruby",
|
||||
"mnemonic":"r",
|
||||
"args":{
|
||||
"type":"subprocess",
|
||||
"external_id":"ruby",
|
||||
"encoding":"utf8",
|
||||
"cmd":{
|
||||
"windows":[
|
||||
"ruby.exe",
|
||||
"${packages}/SublimeREPL/config/Ruby/pry_repl.rb",
|
||||
"$editor"
|
||||
],
|
||||
"linux":[
|
||||
"ruby",
|
||||
"${packages}/SublimeREPL/config/Ruby/pry_repl.rb",
|
||||
"$editor"
|
||||
],
|
||||
"osx":[
|
||||
"ruby",
|
||||
"${packages}/SublimeREPL/config/Ruby/pry_repl.rb",
|
||||
"$editor"
|
||||
]
|
||||
},
|
||||
"soft_quit":"\nexit\n",
|
||||
"cwd":"$file_path",
|
||||
"cmd_postfix":"\n",
|
||||
"autocomplete_server": true,
|
||||
"syntax":"Packages/Ruby/Ruby.tmLanguage"
|
||||
}
|
||||
},
|
||||
{
|
||||
"command":"repl_open",
|
||||
"caption":"Ruby - IRB (deprecated)",
|
||||
"id":"repl_ruby_irb",
|
||||
"mnemonic":"r",
|
||||
"args":{
|
||||
"type":"subprocess",
|
||||
"external_id":"ruby",
|
||||
"encoding":"utf8",
|
||||
"cmd":{
|
||||
"windows":[
|
||||
"irb.bat",
|
||||
"--noreadline",
|
||||
"--inf-ruby-mode"
|
||||
],
|
||||
"linux":[
|
||||
"irb",
|
||||
"--noreadline",
|
||||
"--inf-ruby-mode"
|
||||
],
|
||||
"osx":[
|
||||
"irb",
|
||||
"--noreadline",
|
||||
"--inf-ruby-mode"
|
||||
]
|
||||
},
|
||||
"soft_quit":"\nexit\n",
|
||||
"cwd":"$file_path",
|
||||
"cmd_postfix":"\n",
|
||||
"suppress_echo":true,
|
||||
"syntax":"Packages/Ruby/Ruby.tmLanguage"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
72
Packages/SublimeREPL/config/Ruby/pry_repl.rb
Normal file
72
Packages/SublimeREPL/config/Ruby/pry_repl.rb
Normal file
@@ -0,0 +1,72 @@
|
||||
require 'rubygems'
|
||||
gem 'pry'
|
||||
require 'pry'
|
||||
require 'socket'
|
||||
require 'thread'
|
||||
require 'json'
|
||||
|
||||
include Socket::Constants
|
||||
|
||||
class PryInput
|
||||
def readline(prompt)
|
||||
$stdout.print prompt
|
||||
$stdout.flush
|
||||
$stdin.readline
|
||||
end
|
||||
end
|
||||
|
||||
class PryOutput
|
||||
def puts(data="")
|
||||
$stdout.puts(data.gsub('`', "'"))
|
||||
$stdout.flush
|
||||
end
|
||||
end
|
||||
|
||||
Pry.config.input = PryInput.new()
|
||||
Pry.config.output = PryOutput.new()
|
||||
Pry.config.color = false
|
||||
Pry.config.editor = ARGV[0]
|
||||
Pry.config.auto_indent = false
|
||||
Pry.config.correct_indent = false
|
||||
|
||||
port = ENV["SUBLIMEREPL_AC_PORT"].to_i
|
||||
|
||||
socket = Socket.new(AF_INET, SOCK_STREAM, 0)
|
||||
sockaddr = Socket.pack_sockaddr_in(port, '127.0.0.1')
|
||||
socket.connect(sockaddr)
|
||||
completer = Pry::InputCompleter.build_completion_proc(binding)
|
||||
|
||||
def read_netstring(s)
|
||||
size = 0
|
||||
while true
|
||||
ch = s.recvfrom(1)[0]
|
||||
if ch == ':'
|
||||
break
|
||||
end
|
||||
size = size * 10 + ch.to_i
|
||||
end
|
||||
msg = ""
|
||||
while size != 0
|
||||
msg += s.recvfrom(size)[0]
|
||||
size -= msg.length
|
||||
end
|
||||
ch = s.recvfrom(1)[0]
|
||||
return msg
|
||||
end
|
||||
|
||||
# Thread.abort_on_exception = true
|
||||
t1 = Thread.new do
|
||||
while true
|
||||
data = read_netstring(socket)
|
||||
req = JSON.parse(data)
|
||||
line = req["line"]
|
||||
completions = completer.call(req["line"])
|
||||
response = [line, completions]
|
||||
response_msg = JSON.dump(response)
|
||||
payload = response_msg.length.to_s + ":" + response_msg + ","
|
||||
socket.write(payload)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Pry.start self
|
||||
10
Packages/SublimeREPL/config/SML/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/SML/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: SML",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_sml",
|
||||
"file": "config/SML/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
26
Packages/SublimeREPL/config/SML/Main.sublime-menu
Normal file
26
Packages/SublimeREPL/config/SML/Main.sublime-menu
Normal file
@@ -0,0 +1,26 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"caption": "SML",
|
||||
"id": "repl_sml",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"cmd": ["sml"],
|
||||
"cwd": "$file_path",
|
||||
"external_id": "sml",
|
||||
"syntax": "Packages/SML (Standard ML)/sml.tmLanguage"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
18
Packages/SublimeREPL/config/Scala/Default.sublime-commands
Normal file
18
Packages/SublimeREPL/config/Scala/Default.sublime-commands
Normal file
@@ -0,0 +1,18 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Scala",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_scala",
|
||||
"file": "config/Scala/Main.sublime-menu"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption": "SublimeREPL: SBT for opened folder",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_sbt",
|
||||
"file": "config/Scala/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
61
Packages/SublimeREPL/config/Scala/Main.sublime-menu
Normal file
61
Packages/SublimeREPL/config/Scala/Main.sublime-menu
Normal file
@@ -0,0 +1,61 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"caption": "Scala",
|
||||
"id": "Scala",
|
||||
|
||||
"children":[
|
||||
{"command": "repl_open",
|
||||
"caption": "scala REPL",
|
||||
"id": "repl_scala",
|
||||
"mnemonic": "s",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"external_id": "scala",
|
||||
"cmd": {"linux": ["scala"],
|
||||
"osx": ["scala"],
|
||||
"windows": ["scala.bat", "-i"]},
|
||||
"soft_quit": "\nexit\n",
|
||||
"cwd": "$file_path",
|
||||
"cmd_postfix": "\n",
|
||||
"extend_env": {"osx": {"EMACS": "1", "PATH": "{PATH}:/usr/local/bin"},
|
||||
"linux": {"EMACS": "1", "PATH": "{PATH}:/usr/local/bin"},
|
||||
"windows": {"EMACS": "1"}},
|
||||
"suppress_echo": false,
|
||||
"syntax": "Packages/Scala/Scala.tmLanguage"
|
||||
}
|
||||
},
|
||||
{"command": "repl_open",
|
||||
"caption": "SBT for opened folder",
|
||||
"id": "repl_sbt",
|
||||
"mnemonic": "b",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"external_id": "scala",
|
||||
"cmd": {"linux": ["sbt"],
|
||||
"osx": ["sbt"],
|
||||
"windows": ["sbt"]},
|
||||
"soft_quit": "\nexit\n",
|
||||
"cwd": "$folder",
|
||||
"cmd_postfix": "\n",
|
||||
"extend_env": {"osx": {"EMACS": "1", "PATH": "{PATH}:/usr/local/bin"},
|
||||
"linux": {"EMACS": "1", "PATH": "{PATH}:/usr/local/bin"},
|
||||
"windows": {"EMACS": "1"}},
|
||||
"suppress_echo": false,
|
||||
"syntax": "Packages/Scala/Scala.tmLanguage"
|
||||
}
|
||||
}
|
||||
]}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
26
Packages/SublimeREPL/config/Scheme/Default.sublime-commands
Normal file
26
Packages/SublimeREPL/config/Scheme/Default.sublime-commands
Normal file
@@ -0,0 +1,26 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Scheme",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_scheme",
|
||||
"file": "config/Scheme/Main.sublime-menu"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption": "SublimeREPL: Gauche",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_gauche",
|
||||
"file": "config/Scheme/Main.sublime-menu"
|
||||
}
|
||||
},
|
||||
{
|
||||
"caption": "SublimeREPL: Petite Chez Scheme",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_petite",
|
||||
"file": "config/Scheme/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
73
Packages/SublimeREPL/config/Scheme/Main.sublime-menu
Normal file
73
Packages/SublimeREPL/config/Scheme/Main.sublime-menu
Normal file
@@ -0,0 +1,73 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"caption": "Scheme",
|
||||
"id": "Scheme",
|
||||
|
||||
"children":[
|
||||
{"command": "repl_open",
|
||||
"caption": "Scheme",
|
||||
"id": "repl_scheme",
|
||||
"mnemonic": "r",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"external_id": "scheme",
|
||||
"cmd": {"linux": ["scheme"],
|
||||
"osx": ["scheme"],
|
||||
"windows": ["scheme"]},
|
||||
"soft_quit": "\nexit\n",
|
||||
"cwd": "$folder",
|
||||
"cmd_postfix": "\n",
|
||||
"extend_env": {"INSIDE_EMACS": "1"},
|
||||
"syntax": "Packages/sublime-scheme-syntax/Scheme.tmLanguage"
|
||||
}
|
||||
},
|
||||
{"command": "repl_open",
|
||||
"caption": "Gauche",
|
||||
"id": "repl_gauche",
|
||||
"mnemonic": "r",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"external_id": "gauche",
|
||||
"cmd": {"linux": ["gosh", "-i"],
|
||||
"osx": ["gosh", "-i"],
|
||||
"windows": ["gosh", "-i"]},
|
||||
"soft_quit": "\n(exit)\n",
|
||||
"cwd": "$folder",
|
||||
"cmd_postfix": "\n",
|
||||
"extend_env": {"INSIDE_EMACS": "1"},
|
||||
"syntax": "Packages/Gauche/Gauche.tmLanguage"
|
||||
}
|
||||
},
|
||||
{"command": "repl_open",
|
||||
"caption": "Petite Chez Scheme",
|
||||
"id": "repl_petite",
|
||||
"mnemonic": "r",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"external_id": "petite",
|
||||
"cmd": {"linux": ["petite"],
|
||||
"osx": ["petite"],
|
||||
"windows": ["petite"]},
|
||||
"soft_quit": "\n(exit)\n",
|
||||
"cwd": "$folder",
|
||||
"cmd_postfix": "\n",
|
||||
"extend_env": {"INSIDE_EMACS": "1"},
|
||||
"syntax": "Packages/sublime-scheme-syntax/Scheme.tmLanguage"
|
||||
}
|
||||
}
|
||||
]}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: ScriptCS",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_scriptcs",
|
||||
"file": "config/ScriptCS/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
31
Packages/SublimeREPL/config/ScriptCS/Main.sublime-menu
Normal file
31
Packages/SublimeREPL/config/ScriptCS/Main.sublime-menu
Normal file
@@ -0,0 +1,31 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"caption": "ScriptCS",
|
||||
"id": "repl_scriptcs",
|
||||
"mnemonic": "scs",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"external_id": "scriptcs",
|
||||
"encoding": "utf8",
|
||||
"cmd": {
|
||||
"windows": ["scriptcs"],
|
||||
"osx": ["scriptcs"],
|
||||
"linux": ["scriptcs"]},
|
||||
"cwd": "$file_path",
|
||||
"additional_scopes": ["csx"],
|
||||
"syntax": "Packages/scriptcs/ScriptCs.tmLanguage"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
10
Packages/SublimeREPL/config/Shell/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/Shell/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Shell",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_shell",
|
||||
"file": "config/Shell/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
34
Packages/SublimeREPL/config/Shell/Main.sublime-menu
Normal file
34
Packages/SublimeREPL/config/Shell/Main.sublime-menu
Normal file
@@ -0,0 +1,34 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"caption": "Shell",
|
||||
"id": "repl_shell",
|
||||
"mnemonic": "s",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": {"windows": "$win_cmd_encoding",
|
||||
"linux": "utf-8",
|
||||
"osx": "utf-8"},
|
||||
"cmd": {"windows": ["cmd.exe"],
|
||||
"linux": ["bash", "-i"],
|
||||
"osx": ["bash", "-i"]},
|
||||
"cwd": "$file_path",
|
||||
"cmd_postfix": "\n",
|
||||
"env": {},
|
||||
"suppress_echo": true,
|
||||
"external_id": "shell",
|
||||
"syntax": "Packages/Text/Plain text.tmLanguage"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
10
Packages/SublimeREPL/config/Sublime/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/Sublime/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Python - Sublime Text Console",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_sublime_python",
|
||||
"file": "config/Sublime/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
23
Packages/SublimeREPL/config/Sublime/Main.sublime-menu
Normal file
23
Packages/SublimeREPL/config/Sublime/Main.sublime-menu
Normal file
@@ -0,0 +1,23 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"caption": "Sublime",
|
||||
"id": "repl_sublime_python",
|
||||
"args": {
|
||||
"type": "sublime_python",
|
||||
"encoding": "utf8",
|
||||
"syntax": "Packages/Python/Python.tmLanguage"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
10
Packages/SublimeREPL/config/Tower/Default.sublime-commands
Normal file
10
Packages/SublimeREPL/config/Tower/Default.sublime-commands
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Tower Console",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
"id": "repl_tower",
|
||||
"file": "config/Tower/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
27
Packages/SublimeREPL/config/Tower/Main.sublime-menu
Normal file
27
Packages/SublimeREPL/config/Tower/Main.sublime-menu
Normal file
@@ -0,0 +1,27 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"id": "repl_tower",
|
||||
"caption": "Tower Console",
|
||||
"args": {
|
||||
"cwd": "$file_path",
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"cmd": ["tower", "console", "-c"],
|
||||
"syntax": "Packages/CoffeeScript/CoffeeScript.tmLanguage",
|
||||
"external_id": "tower",
|
||||
"extend_env": {"NODE_DISABLE_COLORS": "1"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
153
Packages/SublimeREPL/doc/Makefile
Normal file
153
Packages/SublimeREPL/doc/Makefile
Normal file
@@ -0,0 +1,153 @@
|
||||
# Makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = sphinx-build
|
||||
PAPER =
|
||||
BUILDDIR = _build
|
||||
|
||||
# Internal variables.
|
||||
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||
PAPEROPT_letter = -D latex_paper_size=letter
|
||||
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
# the i18n builder cannot share the environment and doctrees with the others
|
||||
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
|
||||
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
|
||||
|
||||
help:
|
||||
@echo "Please use \`make <target>' where <target> is one of"
|
||||
@echo " html to make standalone HTML files"
|
||||
@echo " dirhtml to make HTML files named index.html in directories"
|
||||
@echo " singlehtml to make a single large HTML file"
|
||||
@echo " pickle to make pickle files"
|
||||
@echo " json to make JSON files"
|
||||
@echo " htmlhelp to make HTML files and a HTML help project"
|
||||
@echo " qthelp to make HTML files and a qthelp project"
|
||||
@echo " devhelp to make HTML files and a Devhelp project"
|
||||
@echo " epub to make an epub"
|
||||
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
||||
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
||||
@echo " text to make text files"
|
||||
@echo " man to make manual pages"
|
||||
@echo " texinfo to make Texinfo files"
|
||||
@echo " info to make Texinfo files and run them through makeinfo"
|
||||
@echo " gettext to make PO message catalogs"
|
||||
@echo " changes to make an overview of all changed/added/deprecated items"
|
||||
@echo " linkcheck to check all external links for integrity"
|
||||
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
||||
|
||||
clean:
|
||||
-rm -rf $(BUILDDIR)/*
|
||||
|
||||
html:
|
||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
||||
|
||||
dirhtml:
|
||||
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
||||
|
||||
singlehtml:
|
||||
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
||||
|
||||
pickle:
|
||||
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
||||
@echo
|
||||
@echo "Build finished; now you can process the pickle files."
|
||||
|
||||
json:
|
||||
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
||||
@echo
|
||||
@echo "Build finished; now you can process the JSON files."
|
||||
|
||||
htmlhelp:
|
||||
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
||||
".hhp project file in $(BUILDDIR)/htmlhelp."
|
||||
|
||||
qthelp:
|
||||
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
||||
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
||||
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/SublimeREPL.qhcp"
|
||||
@echo "To view the help file:"
|
||||
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/SublimeREPL.qhc"
|
||||
|
||||
devhelp:
|
||||
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
||||
@echo
|
||||
@echo "Build finished."
|
||||
@echo "To view the help file:"
|
||||
@echo "# mkdir -p $$HOME/.local/share/devhelp/SublimeREPL"
|
||||
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/SublimeREPL"
|
||||
@echo "# devhelp"
|
||||
|
||||
epub:
|
||||
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
||||
@echo
|
||||
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
||||
|
||||
latex:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo
|
||||
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
||||
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
||||
"(use \`make latexpdf' here to do that automatically)."
|
||||
|
||||
latexpdf:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo "Running LaTeX files through pdflatex..."
|
||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||
|
||||
text:
|
||||
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
||||
@echo
|
||||
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
||||
|
||||
man:
|
||||
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
||||
@echo
|
||||
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
||||
|
||||
texinfo:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo
|
||||
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
|
||||
@echo "Run \`make' in that directory to run these through makeinfo" \
|
||||
"(use \`make info' here to do that automatically)."
|
||||
|
||||
info:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo "Running Texinfo files through makeinfo..."
|
||||
make -C $(BUILDDIR)/texinfo info
|
||||
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
||||
|
||||
gettext:
|
||||
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
||||
@echo
|
||||
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
||||
|
||||
changes:
|
||||
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
||||
@echo
|
||||
@echo "The overview file is in $(BUILDDIR)/changes."
|
||||
|
||||
linkcheck:
|
||||
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
||||
@echo
|
||||
@echo "Link check complete; look for any errors in the above output " \
|
||||
"or in $(BUILDDIR)/linkcheck/output.txt."
|
||||
|
||||
doctest:
|
||||
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
||||
@echo "Testing of doctests in the sources finished, look at the " \
|
||||
"results in $(BUILDDIR)/doctest/output.txt."
|
||||
BIN
Packages/SublimeREPL/doc/_static/menu.png
vendored
Normal file
BIN
Packages/SublimeREPL/doc/_static/menu.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
BIN
Packages/SublimeREPL/doc/_static/palette.png
vendored
Normal file
BIN
Packages/SublimeREPL/doc/_static/palette.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
242
Packages/SublimeREPL/doc/conf.py
Normal file
242
Packages/SublimeREPL/doc/conf.py
Normal file
@@ -0,0 +1,242 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# SublimeREPL documentation build configuration file, created by
|
||||
# sphinx-quickstart on Sun Feb 26 16:38:41 2012.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its containing dir.
|
||||
#
|
||||
# Note that not all possible configuration values are present in this
|
||||
# autogenerated file.
|
||||
#
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
import sys, os
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
# -- General configuration -----------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#needs_sphinx = '1.0'
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be extensions
|
||||
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||
extensions = []
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# The suffix of source filenames.
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The encoding of source files.
|
||||
#source_encoding = 'utf-8-sig'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = 'SublimeREPL'
|
||||
copyright = '2012, Wojciech Bederski'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '1.0'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '1.0.30'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#language = None
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
#today = ''
|
||||
# Else, today_fmt is used as the format for a strftime call.
|
||||
#today_fmt = '%B %d, %Y'
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
exclude_patterns = ['_build']
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all documents.
|
||||
#default_role = None
|
||||
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
#add_function_parentheses = True
|
||||
|
||||
# If true, the current module name will be prepended to all description
|
||||
# unit titles (such as .. function::).
|
||||
#add_module_names = True
|
||||
|
||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||
# output. They are ignored by default.
|
||||
#show_authors = False
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# A list of ignored prefixes for module index sorting.
|
||||
#modindex_common_prefix = []
|
||||
|
||||
|
||||
# -- Options for HTML output ---------------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
html_theme = 'default'
|
||||
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#html_theme_options = {}
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
#html_theme_path = []
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
#html_title = None
|
||||
|
||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||
#html_short_title = None
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top
|
||||
# of the sidebar.
|
||||
#html_logo = None
|
||||
|
||||
# The name of an image file (within the static path) to use as favicon of the
|
||||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||
# pixels large.
|
||||
#html_favicon = None
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
#html_last_updated_fmt = '%b %d, %Y'
|
||||
|
||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||
# typographically correct entities.
|
||||
#html_use_smartypants = True
|
||||
|
||||
# Custom sidebar templates, maps document names to template names.
|
||||
#html_sidebars = {}
|
||||
|
||||
# Additional templates that should be rendered to pages, maps page names to
|
||||
# template names.
|
||||
#html_additional_pages = {}
|
||||
|
||||
# If false, no module index is generated.
|
||||
#html_domain_indices = True
|
||||
|
||||
# If false, no index is generated.
|
||||
#html_use_index = True
|
||||
|
||||
# If true, the index is split into individual pages for each letter.
|
||||
#html_split_index = False
|
||||
|
||||
# If true, links to the reST sources are added to the pages.
|
||||
#html_show_sourcelink = True
|
||||
|
||||
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||
#html_show_sphinx = True
|
||||
|
||||
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||
#html_show_copyright = True
|
||||
|
||||
# If true, an OpenSearch description file will be output, and all pages will
|
||||
# contain a <link> tag referring to it. The value of this option must be the
|
||||
# base URL from which the finished HTML is served.
|
||||
#html_use_opensearch = ''
|
||||
|
||||
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||
#html_file_suffix = None
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'SublimeREPLdoc'
|
||||
|
||||
|
||||
# -- Options for LaTeX output --------------------------------------------------
|
||||
|
||||
latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#'papersize': 'letterpaper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#'preamble': '',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title, author, documentclass [howto/manual]).
|
||||
latex_documents = [
|
||||
('index', 'SublimeREPL.tex', 'SublimeREPL Documentation',
|
||||
'Wojciech Bederski', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
# the title page.
|
||||
#latex_logo = None
|
||||
|
||||
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||
# not chapters.
|
||||
#latex_use_parts = False
|
||||
|
||||
# If true, show page references after internal links.
|
||||
#latex_show_pagerefs = False
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#latex_show_urls = False
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#latex_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#latex_domain_indices = True
|
||||
|
||||
|
||||
# -- Options for manual page output --------------------------------------------
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('index', 'sublimerepl', 'SublimeREPL Documentation',
|
||||
['Wojciech Bederski'], 1)
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#man_show_urls = False
|
||||
|
||||
|
||||
# -- Options for Texinfo output ------------------------------------------------
|
||||
|
||||
# Grouping the document tree into Texinfo files. List of tuples
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
('index', 'SublimeREPL', 'SublimeREPL Documentation',
|
||||
'Wojciech Bederski', 'SublimeREPL', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#texinfo_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#texinfo_domain_indices = True
|
||||
|
||||
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||
#texinfo_show_urls = 'footnote'
|
||||
398
Packages/SublimeREPL/doc/index.rst
Normal file
398
Packages/SublimeREPL/doc/index.rst
Normal file
@@ -0,0 +1,398 @@
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
SublimeREPL
|
||||
===========
|
||||
|
||||
SublimeREPL is a plugin for Sublime Text 2 that lets you run interactive
|
||||
interpreters of several languages within a normal editor tab. It also allows
|
||||
connecting to a running remote interpreter (e.g. Clojure/Lein) though a telnet
|
||||
port.
|
||||
|
||||
SublimeREPL has a built-in support for command history and transferring code
|
||||
from open buffers to the interpreters for evaluation, enabling interactive
|
||||
programming.
|
||||
|
||||
.. note::
|
||||
This documentation is work in progress. Details on language integrations are
|
||||
sorely missing. Please contribute!
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Download `Package Control`__, select Install Package and pick SublimeREPL from the list of
|
||||
available packages. You should have Package Control anyway.
|
||||
|
||||
__ http://wbond.net/sublime_packages/package_control
|
||||
|
||||
|
||||
Quick Start
|
||||
-----------
|
||||
|
||||
SublimeREPL adds itself as a submenu in Tools. You can choose any one of the
|
||||
preconfigured REPLs and if it's available in your SYSTEM PATH [#]_, it will
|
||||
be launched immediately.
|
||||
|
||||
.. image:: _static/menu.png
|
||||
|
||||
Second and more user friendly way to launch any given REPL is through Command
|
||||
Palette. Bring up Command Palette and type "repl". You will be presented with
|
||||
all preconfigured REPLs. Running REPL through Command Palette has exactly the
|
||||
same result as picking it from *Tools > SublimeREPL* menu.
|
||||
|
||||
.. image:: _static/palette.png
|
||||
|
||||
.. [#] One of the most frequently reported errors is SublimeREPL not being able
|
||||
to find interpreter executable, even if it's visible in your shell. There are several way to fix this problem that we'll discuss in FAQ.
|
||||
|
||||
You may now use a source buffer to either evaluate text from the buffer in
|
||||
the REPL or copy text over to the REPL without evaluation. For this to work,
|
||||
ensure that the language syntax definition for your source buffer matches
|
||||
the REPL.
|
||||
|
||||
Keyboard shortcuts
|
||||
------------------
|
||||
|
||||
The default shortcuts shipped with SublimeREPL are listed below. If you are
|
||||
accustomed to another REPL keymap, or if you intend to work in REPL a lot
|
||||
(lispers pay attention!) you may want to rebind the keys more to your liking.
|
||||
|
||||
REPL keys
|
||||
^^^^^^^^^
|
||||
|
||||
.. NOTE::
|
||||
The list below omits the trivial text editing keybindings (e.g. left, right
|
||||
etc). They are nevertheless configurable in keymap files.
|
||||
|
||||
+---------------+---------------+----------------+----------------------------------+-------------------------------------------------+
|
||||
| Linux | OS X | Windows | Command used | Meaning |
|
||||
+===============+===============+================+==================================+=================================================+
|
||||
| Up | Up | Up | repl_view_previous | Walk back to previous input, with autocomplete |
|
||||
+---------------+---------------+----------------+----------------------------------+-------------------------------------------------+
|
||||
| Alt+p | Ctrl+p | Alt+p | repl_view_previous | Walk back to previous input, no autocomplete |
|
||||
+---------------+---------------+----------------+----------------------------------+-------------------------------------------------+
|
||||
| Down | Down | Down | repl_view_next | Walk back to next input, with autocomplete |
|
||||
+---------------+---------------+----------------+----------------------------------+-------------------------------------------------+
|
||||
| Alt+n | Ctrl+n | Alt+n | repl_view_next | Walk back to next input, no autocomplete |
|
||||
+---------------+---------------+----------------+----------------------------------+-------------------------------------------------+
|
||||
| Enter | Enter | Enter | repl_enter | Send current line to REPL |
|
||||
+---------------+---------------+----------------+----------------------------------+-------------------------------------------------+
|
||||
| Esc | Esc | Esc | repl_escape | Clear REPL input |
|
||||
+---------------+---------------+----------------+----------------------------------+-------------------------------------------------+
|
||||
| Ctrl+l | Ctrl+l | Shift+Ctrl+c | repl_clear | Clear REPL screen |
|
||||
+---------------+---------------+----------------+----------------------------------+-------------------------------------------------+
|
||||
| Shift+Ctrl+c | Shift+Ctrl+c | *Unsupported* | subprocess_repl_send_signal | Send SIGINT to REPL |
|
||||
+---------------+---------------+----------------+----------------------------------+-------------------------------------------------+
|
||||
|
||||
Source buffer keys
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. important::
|
||||
The keybindings here use Ctrl+, as a prefix (C-, in emacs notation), meaning press Ctrl, press comma, release both. Pressing the
|
||||
prefix combination and then the letter will immediately send the target text into the REPL and *evaluate* it as if you pressed enter.
|
||||
If you want to prevent evaluation and send the text for *editing* in the REPL, press Shift with the prefix combination.
|
||||
|
||||
.. note::
|
||||
Default source buffer keys are identical on all platforms.
|
||||
|
||||
+---------------+--------------------------------------------------------------------------------------------------------------------+
|
||||
| Key | Meaning |
|
||||
+===============+====================================================================================================================+
|
||||
| Ctrl+, b | Send the current "block" to REPL. Currently Clojure-only. |
|
||||
+---------------+--------------------------------------------------------------------------------------------------------------------+
|
||||
| Ctrl+, s | Send the selection to REPL |
|
||||
+---------------+--------------------------------------------------------------------------------------------------------------------+
|
||||
| Ctrl+, f | Send the current file to REPL |
|
||||
+---------------+--------------------------------------------------------------------------------------------------------------------+
|
||||
| Ctrl+, l | Send the current line to REPL |
|
||||
+---------------+--------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
Language specific information
|
||||
-----------------------------
|
||||
|
||||
SublimeREPL's integration with a specific language includes language-specific
|
||||
main menu and palette options for REPL startup, keymaps, and special REPL
|
||||
extensions unique to the target language. An integration may contain several
|
||||
different REPL modes which are based on different underlying classes.
|
||||
|
||||
Clojure
|
||||
^^^^^^^
|
||||
|
||||
The Clojure integration supports Leiningen projects.
|
||||
You must install Leiningen to use Clojure integration.
|
||||
|
||||
If your Leiningen installation is not system-global, you may need to tweak
|
||||
SublimeREPL configuration (via Preferences > Package Settings > SublimeREPL >
|
||||
Settings - User) so that we can find your lein binary::
|
||||
|
||||
"default_extend_env": {"PATH": "{PATH}:/home/myusername/bin"}
|
||||
|
||||
To start a REPL subprocess with Leiningen project environment, open your `project.clj`
|
||||
and, while it is the current file, use the menu or the command palette to start the REPL.
|
||||
|
||||
* In subprocess REPL mode, the REPL is launched as a subprocess of the editor.
|
||||
This is the mode you should use right now.
|
||||
* The telnet mode no longer works because of the changes in Leiningen and nrepl.
|
||||
|
||||
The source buffer "send block" command (Ctrl+, b) deserves a special mention.
|
||||
Performing this command while the cursor is within the body of a definition
|
||||
will select this (current, top-level) definition and send it to the REPL for
|
||||
evaluation. This means that the latest version of the function you're
|
||||
currently working on will be installed in the live environment so that you
|
||||
can immediately start playing with it in the REPL. This is similar to [slime
|
||||
-]eval-defun in emacs.
|
||||
|
||||
Additional keybindings are available for Clojure:
|
||||
|
||||
+---------------+--------------------------------------------------------------------------------------------------------------------+
|
||||
| Key | Meaning |
|
||||
+===============+====================================================================================================================+
|
||||
| Ctrl+F12 c s | Launch a subprocess Clojure REPL |
|
||||
+---------------+--------------------------------------------------------------------------------------------------------------------+
|
||||
| Ctrl+F12 c t | Connect to a running Clojure REPL |
|
||||
+---------------+--------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
Python
|
||||
^^^^^^
|
||||
|
||||
Both stock Python and Execnet integrations support virtualenv. Various ways to work with Python, including PDB and IPython, are supported.
|
||||
|
||||
Documentation contributions from a Python specialist are welcome.
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
The default SublimeREPL configuration documents all available configuration settings.
|
||||
|
||||
Frequently Asked Questions
|
||||
--------------------------
|
||||
|
||||
**SublimeREPL can't launch the REPL process - OSError(2, 'No such file or directory'), how do I fix that?**
|
||||
|
||||
Sublime is unable to locate the binary that is needed to launch your REPL in the search paths available to it. This is
|
||||
because the subprocess REPLs are launched, as, well, subprocesses of Sublime environment, which may be different from
|
||||
your interactive environment, especially if your REPL is installed in a directory that is not in a system-wide path (e.g
|
||||
`/usr/local/bin` or '/home/myusername` on Linux, `My Documents` on Windows etc)
|
||||
|
||||
If the binary is not in your system path and you can't or won't change that, tweak SublimeREPL configuration::
|
||||
|
||||
{
|
||||
...
|
||||
"default_extend_env": {"PATH": "{PATH}:/home/myusername/bin"}
|
||||
...
|
||||
}
|
||||
|
||||
**I'd like an interactive REPL for Foo and it is not supported, what do?**
|
||||
|
||||
Chances are, you only need a minimal amount of work to add an integration, and necessary steps are described
|
||||
here briefly.
|
||||
|
||||
If you already have an interactive shell for Foo, you can use the subprocess
|
||||
REPL. For an example, see PHP or Lua integration in `config/PHP`.
|
||||
|
||||
If Foo provides an interactive environment over TCP, you can use the telnet
|
||||
REPL. For an example, see MozRepl integration
|
||||
|
||||
Supported languages
|
||||
-------------------
|
||||
|
||||
SublimeREPL currently ships with support for the following languages:
|
||||
|
||||
* Clisp
|
||||
* Clojure
|
||||
* CoffeeScript
|
||||
* Elixir
|
||||
* Execnet Python
|
||||
* Erlang
|
||||
* F#
|
||||
* Groovy
|
||||
* Haskell
|
||||
* Lua
|
||||
* Matlab
|
||||
* MozRepl
|
||||
* NodeJS
|
||||
* Octave
|
||||
* Perl
|
||||
* PHP interactive mode
|
||||
* PowerShell
|
||||
* Python
|
||||
* R
|
||||
* Racket
|
||||
* Ruby
|
||||
* Scala
|
||||
* Scheme
|
||||
* Shell (Windows, Linux and OS X)
|
||||
* SML
|
||||
* Sublime internal REPL (?)
|
||||
* Tower (CoffeeScript)
|
||||
|
||||
Structure of SublimeREPL
|
||||
------------------------
|
||||
|
||||
.. NOTE::
|
||||
If this is your first time dealing with Sublime plugins, you may find it a bit too magical. Basically,
|
||||
Sublime automatically scans plugin directories loads configuration files and plugin code without manual
|
||||
intervention, and reloads them dynamically as soon as they change. The entry points to a plugin's code are its commands,
|
||||
which are Python objects that extend Sublime's standard command class. Sublime calls them when needed. There
|
||||
is no initialization entry point or a "plugin loaded" callback or somesuch.
|
||||
|
||||
Basics of language integration: configuration and launch commands
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
A language integration in SublimeREPL consists of configuration files and,
|
||||
where needed, Python code. The configuration consists of:
|
||||
|
||||
* Menu configuration files which specify the actual REPL object configuration
|
||||
* Command palette `configuration files <http://docs.sublimetext.info/en/latest/reference/command_palette.html>`_
|
||||
* Optional `keybinding configuration files <http://docs.sublimetext.info/en/latest/reference/key_bindings.html>`_
|
||||
|
||||
REPLs are started by SublimeREPL command `repl_open`. The command and its
|
||||
arguments is usually specified in the menu configuration file, and the other
|
||||
places refer to that configuration item by file name and ID using the
|
||||
`run_existing_window_command` command.
|
||||
|
||||
Simple language integrations use an existing REPL class (see below) without
|
||||
modification. For these integrations, no additional Python code is needed.
|
||||
They use one of the standard REPL classes as the base, as documented below. In
|
||||
most cases, this will be the subprocess based REPL class. An example of such
|
||||
an integration is Lua.
|
||||
|
||||
The menu configuration file `config/Lua/Menu.sublime-menu` contains::
|
||||
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[{
|
||||
"caption": "SublimeREPL",
|
||||
"mnemonic": "r",
|
||||
"id": "SublimeREPL",
|
||||
"children":
|
||||
[
|
||||
{"command": "repl_open",
|
||||
"caption": "Lua",
|
||||
"id": "repl_lua",
|
||||
"mnemonic": "l",
|
||||
"args": {
|
||||
"type": "subprocess",
|
||||
"encoding": "utf8",
|
||||
"cmd": ["lua", "-i"],
|
||||
"cwd": "$file_path",
|
||||
"external_id": "lua",
|
||||
"syntax": "Packages/Lua/Lua.tmLanguage"
|
||||
}
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
]
|
||||
|
||||
This adds a "Lua" menu item to "Tools > SublimeREPL" which creates a Lua REPL
|
||||
via SublimeREPL command `repl_open`. The important part to take note of here
|
||||
is the `id` attribute (`repl_lua`). This is the ID by which the command
|
||||
palette configuration file refers to Lua REPL configuration.
|
||||
|
||||
As you can see, the main way to launch a new REPL is the SublimeREPL command
|
||||
`repl_open` (class :class:`ReplOpenCommand`). The menu configuration file (see
|
||||
above) specifies the arguments for the command that are used to locate the
|
||||
desired REPL class and the settings for it so that it can be spawned.
|
||||
|
||||
The command configuration file `config/Lua/Default.sublime-commands` looks like this::
|
||||
|
||||
[
|
||||
{
|
||||
"caption": "SublimeREPL: Lua",
|
||||
"command": "run_existing_window_command", "args":
|
||||
{
|
||||
/* Note that both these arguments are used to identify the file above and
|
||||
load the REPL configuration from it
|
||||
*/
|
||||
"id": "repl_lua",
|
||||
"file": "config/Lua/Main.sublime-menu"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
It is obvious that the REPL configuration is concentrated in the menu files,
|
||||
and the palette configuration only refers to those by ID and file name. The
|
||||
latter is achieved by the command `run_existing_window_command` (class
|
||||
:class:`RunExistingWindowCommandCommand`)
|
||||
|
||||
This command is a wrapper that is used in the *command palette* configuration.
|
||||
Its function is to execute another command. It takes an ID of a configuration
|
||||
item and the name of a file where the configuration is stored, and scans the
|
||||
available Sublime configuration folders for the file and within the file for
|
||||
the configuration item until one is found. This allows the command palette
|
||||
configuration to specify a reference to the REPL configuration command instead
|
||||
of replicating it. For this reason, actual REPL configuration is *concentrated
|
||||
in the menu files*.
|
||||
|
||||
|
||||
REPL classes
|
||||
^^^^^^^^^^^^
|
||||
|
||||
All REPL instances are descendants of :class:`Repl`. New integrations can
|
||||
either provide their own class, or use one of the base classes that ship with
|
||||
SublimeREPL:
|
||||
|
||||
* Class :class:`SubprocessRepl` for subprocess-based REPLs. The process
|
||||
running in the REPL is a subprocess of the editor. The input and output of
|
||||
the process is connected to the output and the input of the REPL
|
||||
|
||||
* Class :class:`TelnetRepl`. The process runs outside of the editor,
|
||||
presumably having been spawned externally, and the REPL connects to it over
|
||||
TCP via Python `telnetlib`.
|
||||
|
||||
There are three integrations that provide their own classes:
|
||||
|
||||
* Class :class:`PowershellRepl`. This is only used by PowerShell integration.
|
||||
* Class :class:`ExecnetRepl`. This is only used by Execnet Python integration
|
||||
* Class :class:`SublimePythonRepl`. A REPL over SublimeText's internal Python interpreter.
|
||||
|
||||
All these can be found in the plugin's `repl/` subdirectory.
|
||||
|
||||
A REPL class is expected to provide a standard interface for SublimeREPL integration:
|
||||
|
||||
.. py:method:: read_bytes()
|
||||
|
||||
Read and return some bytes from REPL's incoming stream, blocking as
|
||||
necessary. :class:`ReplManager` will set up a separate thread with a
|
||||
:class:`ReplReader` pump that keeps polling this method.
|
||||
|
||||
.. py:method:: write_bytes(bytes)
|
||||
|
||||
Write some bytes to REPL's outgoing stream. User input in the REPL view's
|
||||
command line will be delivered here.
|
||||
|
||||
REPL initialization sequence
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
* User interaction causes the execution of `repl_open` command. Its arguments are usually taken
|
||||
from a menu configuration file.
|
||||
* The open() method of ReplManager is called, where a Repl instance and a ReplView instance get created
|
||||
* Within the ReplView constructor, the read and write loops get started. The REPL is now alive.
|
||||
|
||||
REPL manager
|
||||
^^^^^^^^^^^^
|
||||
|
||||
Class :class:`ReplManager` is responsible for managing REPL instances
|
||||
(subclasses of :class:`Repl`). It initializes new REPLs by:
|
||||
|
||||
* Creating REPL instances
|
||||
* Providing an instance of the Sublime view associated with the REPL by reusing an existing one, or creating a new one
|
||||
* Creating and remembering a named :class:`ReplView` instance that couples between the two.
|
||||
|
||||
REPL views
|
||||
^^^^^^^^^^
|
||||
|
||||
A :class:`ReplView` instance is a coupling between a REPL instance and a
|
||||
Sublime view. Its main responsibility is to create Sublime views and maintain
|
||||
the loops that read from, and write to, the REPL.
|
||||
|
||||
* The incoming data *from* the REPL is read in a separate thread using
|
||||
:class:`ReplReader`, because read operations are assumed to be blocking
|
||||
* The outgoing data is written into the REPL by ReplView's method
|
||||
py:method:`update_view_loop`. This method is called by ReplView's constructor
|
||||
at the very end and, as long as the associated REPL object is alive, will reschedule
|
||||
itself with Sublime's py:method:`set_timeout`.
|
||||
|
||||
190
Packages/SublimeREPL/doc/make.bat
Normal file
190
Packages/SublimeREPL/doc/make.bat
Normal file
@@ -0,0 +1,190 @@
|
||||
@ECHO OFF
|
||||
|
||||
REM Command file for Sphinx documentation
|
||||
|
||||
if "%SPHINXBUILD%" == "" (
|
||||
set SPHINXBUILD=sphinx-build
|
||||
)
|
||||
set BUILDDIR=_build
|
||||
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
|
||||
set I18NSPHINXOPTS=%SPHINXOPTS% .
|
||||
if NOT "%PAPER%" == "" (
|
||||
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
|
||||
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
|
||||
)
|
||||
|
||||
if "%1" == "" goto help
|
||||
|
||||
if "%1" == "help" (
|
||||
:help
|
||||
echo.Please use `make ^<target^>` where ^<target^> is one of
|
||||
echo. html to make standalone HTML files
|
||||
echo. dirhtml to make HTML files named index.html in directories
|
||||
echo. singlehtml to make a single large HTML file
|
||||
echo. pickle to make pickle files
|
||||
echo. json to make JSON files
|
||||
echo. htmlhelp to make HTML files and a HTML help project
|
||||
echo. qthelp to make HTML files and a qthelp project
|
||||
echo. devhelp to make HTML files and a Devhelp project
|
||||
echo. epub to make an epub
|
||||
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
|
||||
echo. text to make text files
|
||||
echo. man to make manual pages
|
||||
echo. texinfo to make Texinfo files
|
||||
echo. gettext to make PO message catalogs
|
||||
echo. changes to make an overview over all changed/added/deprecated items
|
||||
echo. linkcheck to check all external links for integrity
|
||||
echo. doctest to run all doctests embedded in the documentation if enabled
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "clean" (
|
||||
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
|
||||
del /q /s %BUILDDIR%\*
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "html" (
|
||||
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "dirhtml" (
|
||||
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "singlehtml" (
|
||||
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "pickle" (
|
||||
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can process the pickle files.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "json" (
|
||||
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can process the JSON files.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "htmlhelp" (
|
||||
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can run HTML Help Workshop with the ^
|
||||
.hhp project file in %BUILDDIR%/htmlhelp.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "qthelp" (
|
||||
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can run "qcollectiongenerator" with the ^
|
||||
.qhcp project file in %BUILDDIR%/qthelp, like this:
|
||||
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\SublimeREPL.qhcp
|
||||
echo.To view the help file:
|
||||
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\SublimeREPL.ghc
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "devhelp" (
|
||||
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "epub" (
|
||||
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The epub file is in %BUILDDIR%/epub.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "latex" (
|
||||
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "text" (
|
||||
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The text files are in %BUILDDIR%/text.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "man" (
|
||||
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The manual pages are in %BUILDDIR%/man.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "texinfo" (
|
||||
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "gettext" (
|
||||
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "changes" (
|
||||
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.The overview file is in %BUILDDIR%/changes.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "linkcheck" (
|
||||
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Link check complete; look for any errors in the above output ^
|
||||
or in %BUILDDIR%/linkcheck/output.txt.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "doctest" (
|
||||
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Testing of doctests in the sources finished, look at the ^
|
||||
results in %BUILDDIR%/doctest/output.txt.
|
||||
goto end
|
||||
)
|
||||
|
||||
:end
|
||||
195
Packages/SublimeREPL/lang_integration.py
Normal file
195
Packages/SublimeREPL/lang_integration.py
Normal file
@@ -0,0 +1,195 @@
|
||||
from __future__ import absolute_import, unicode_literals, print_function, division
|
||||
import sublime
|
||||
import sublime_plugin
|
||||
|
||||
import re
|
||||
import os
|
||||
import glob
|
||||
import os.path
|
||||
import socket
|
||||
from functools import partial
|
||||
from contextlib import closing
|
||||
|
||||
SETTINGS_FILE = "SublimeREPL.sublime-settings"
|
||||
|
||||
class ClojureAutoTelnetRepl(sublime_plugin.WindowCommand):
|
||||
def is_running(self, port_str):
|
||||
"""Check if port is open on localhost"""
|
||||
port = int(port_str)
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
res = s.connect_ex(("127.0.0.1", port))
|
||||
s.close()
|
||||
return res == 0
|
||||
|
||||
def choices(self):
|
||||
choices = []
|
||||
for folder in self.window.folders():
|
||||
proj_file = os.path.join(folder, "project.clj")
|
||||
try:
|
||||
with open(proj_file) as f:
|
||||
data = f.read()
|
||||
port_match = re.search(":repl-port\s+(\d{1,})", data)
|
||||
if not port_match:
|
||||
continue
|
||||
port = port_match.group(1)
|
||||
description = proj_file
|
||||
desc_match = re.search(r':description\s+"([^"]+)"', data)
|
||||
if desc_match:
|
||||
description = desc_match.group(1)
|
||||
if self.is_running(port):
|
||||
description += " (active)"
|
||||
else:
|
||||
description += " (not responding)"
|
||||
choices.append([description, port])
|
||||
except IOError as e:
|
||||
pass # just ignore it, no file or no access
|
||||
|
||||
return choices + [["Custom telnet", "Pick your own telnet port number to Lein REPL"]]
|
||||
|
||||
def run(self):
|
||||
choices = self.choices()
|
||||
if len(choices) == 1: #only custom telnet action
|
||||
self.on_done(choices, 0)
|
||||
else:
|
||||
on_done = partial(self.on_done, choices)
|
||||
self.window.show_quick_panel(self.choices(), on_done)
|
||||
|
||||
def on_done(self, choices, index):
|
||||
if index == -1:
|
||||
return
|
||||
if index == len(choices) - 1:
|
||||
self.window.show_input_panel("Enter port number", "",
|
||||
self.open_telnet_repl,
|
||||
None, None)
|
||||
return
|
||||
self.open_telnet_repl(choices[index][1])
|
||||
|
||||
def open_telnet_repl(self, port_str):
|
||||
try:
|
||||
port = int(port_str)
|
||||
except ValueError:
|
||||
return
|
||||
self.window.run_command("repl_open", {"type":"telnet", "encoding":"utf8", "host":"localhost", "port":port,
|
||||
"external_id":"clojure", "syntax":"Packages/Clojure/Clojure.tmLanguage"})
|
||||
|
||||
|
||||
def scan_for_virtualenvs(venv_paths):
|
||||
bin_dir = "Scripts" if os.name == "nt" else "bin"
|
||||
found_dirs = set()
|
||||
for venv_path in venv_paths:
|
||||
p = os.path.expanduser(venv_path)
|
||||
pattern = os.path.join(p, "*", bin_dir, "activate_this.py")
|
||||
found_dirs.update(list(map(os.path.dirname, glob.glob(pattern))))
|
||||
return sorted(found_dirs)
|
||||
|
||||
|
||||
class PythonVirtualenvRepl(sublime_plugin.WindowCommand):
|
||||
def _scan(self):
|
||||
venv_paths = sublime.load_settings(SETTINGS_FILE).get("python_virtualenv_paths", [])
|
||||
return scan_for_virtualenvs(venv_paths)
|
||||
|
||||
def run_virtualenv(self, choices, index):
|
||||
if index == -1:
|
||||
return
|
||||
(name, directory) = choices[index]
|
||||
activate_file = os.path.join(directory, "activate_this.py")
|
||||
python_executable = os.path.join(directory, "python")
|
||||
if os.name == "nt":
|
||||
python_executable += ".exe" # ;-)
|
||||
|
||||
self.window.run_command("repl_open",
|
||||
{
|
||||
"encoding":"utf8",
|
||||
"type": "subprocess",
|
||||
"autocomplete_server": True,
|
||||
"extend_env": {
|
||||
"PATH": directory,
|
||||
"SUBLIMEREPL_ACTIVATE_THIS": activate_file,
|
||||
"PYTHONIOENCODING": "utf-8"
|
||||
},
|
||||
"cmd": [python_executable, "-u", "${packages}/SublimeREPL/config/Python/ipy_repl.py"],
|
||||
"cwd": "$file_path",
|
||||
"encoding": "utf8",
|
||||
"syntax": "Packages/Python/Python.tmLanguage",
|
||||
"external_id": "python"
|
||||
})
|
||||
|
||||
def run(self):
|
||||
choices = self._scan()
|
||||
nice_choices = [[path.split(os.path.sep)[-2], path] for path in choices]
|
||||
self.window.show_quick_panel(nice_choices, partial(self.run_virtualenv, nice_choices))
|
||||
|
||||
|
||||
VENV_SCAN_CODE = """
|
||||
import os
|
||||
import glob
|
||||
import os.path
|
||||
|
||||
venv_paths = channel.receive()
|
||||
bin_dir = "Scripts" if os.name == "nt" else "bin"
|
||||
found_dirs = set()
|
||||
for venv_path in venv_paths:
|
||||
p = os.path.expanduser(venv_path)
|
||||
pattern = os.path.join(p, "*", bin_dir, "activate_this.py")
|
||||
found_dirs.update(map(os.path.dirname, glob.glob(pattern)))
|
||||
|
||||
channel.send(found_dirs)
|
||||
channel.close()
|
||||
|
||||
"""
|
||||
|
||||
class ExecnetVirtualenvRepl(sublime_plugin.WindowCommand):
|
||||
def run(self):
|
||||
self.window.show_input_panel("SSH connection (eg. user@host)", "", self.on_ssh_select, None, None)
|
||||
|
||||
def on_ssh_select(self, host_string):
|
||||
import execnet
|
||||
venv_paths = sublime.load_settings(SETTINGS_FILE).get("python_virtualenv_paths", [])
|
||||
try:
|
||||
gw = execnet.makegateway("ssh=" + host_string)
|
||||
ch = gw.remote_exec(VENV_SCAN_CODE)
|
||||
except Exception as e:
|
||||
sublime.error_message(repr(e))
|
||||
return
|
||||
|
||||
with closing(ch):
|
||||
ch.send(venv_paths)
|
||||
directories = ch.receive(60)
|
||||
gw.exit()
|
||||
|
||||
choices = [[host_string + ":" + path.split(os.path.sep)[-2], path] for path in sorted(directories)]
|
||||
nice_choices = [["w/o venv", "n/a"]] + choices
|
||||
self.window.show_quick_panel(nice_choices, partial(self.run_virtualenv, host_string, nice_choices))
|
||||
|
||||
def run_virtualenv(self, host_string, nice_choices, index):
|
||||
if index == -1:
|
||||
return
|
||||
if index == 0:
|
||||
connection_string = "ssh={host}".format(host=host_string)
|
||||
ps1 = "({host}@) >>> ".format(host=host_string)
|
||||
activate_file = ""
|
||||
else:
|
||||
(name, directory) = nice_choices[index]
|
||||
activate_file = os.path.join(directory, "activate_this.py")
|
||||
python_file = os.path.join(directory, "python")
|
||||
ps1 = "({name}) >>> ".format(name=name, host=host_string)
|
||||
connection_string = "ssh={host}//env:PATH={dir}//python={python}".format(
|
||||
host=host_string,
|
||||
dir=directory,
|
||||
python=python_file
|
||||
)
|
||||
|
||||
self.window.run_command("repl_open",
|
||||
{
|
||||
"type": "execnet_repl",
|
||||
"encoding": "utf8",
|
||||
"syntax": "Packages/Python/Python.tmLanguage",
|
||||
"connection_string": connection_string,
|
||||
"activate_file": activate_file,
|
||||
"ps1": ps1
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user