Commando
Custom command builder for Sublime Text 3.
Details
Installs
- Total 2K
- Win 1K
- Mac 327
- Linux 230
Sep 14 | Sep 13 | Sep 12 | Sep 11 | Sep 10 | Sep 9 | Sep 8 | Sep 7 | Sep 6 | Sep 5 | Sep 4 | Sep 3 | Sep 2 | Sep 1 | Aug 31 | Aug 30 | Aug 29 | Aug 28 | Aug 27 | Aug 26 | Aug 25 | Aug 24 | Aug 23 | Aug 22 | Aug 21 | Aug 20 | Aug 19 | Aug 18 | Aug 17 | Aug 16 | Aug 15 | Aug 14 | Aug 13 | Aug 12 | Aug 11 | Aug 10 | Aug 9 | Aug 8 | Aug 7 | Aug 6 | Aug 5 | Aug 4 | Aug 3 | Aug 2 | Aug 1 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
What is Commando?
Commando is a command builder plugin for Sublime Text 3.
How do I use it?
(Coming soon: Bundles!)
A Commando command looks like this:
"command": "commando",
"args": {
"commands": [
["commando_exec", {"cmd": ["git", "diff", "$file"]}],
["commando_new_file", {"syntax": "Diff", "scratch": true, "readonly": true, "name": "Git Diff"}]
]
}
This opens a thread that calls git diff
on the file you currently have open and sends the output of that to a new tab called “Git Diff” with “Diff” syntax. Pretty neat.
Now you can put this anywhere commands can be configured in Sublime. Let's add this command everywhere.
Menus
In your Packages/User/
directory create these files:
Main.sublime-menu
[
{
"caption": "Tools",
"id": "tools",
"children": [
{
"caption": "My Commands",
"id": "my-commands",
"children": [
{
"caption": "Diff File",
"command": "commando",
"args": {
"commands": [
["commando_exec", {"cmd": ["git", "diff", "$file"]}],
["commando_new_file", {"syntax": "Diff", "scratch": true, "readonly": true, "name": "Git Diff"}]
]
}
}
]
}
]
}
]
Context.sublime-menu
[
{
"caption": "My Commands",
"id": "my-commands",
"children": [
{
"caption": "Diff File",
"command": "commando",
"args": {
"commands": [
["commando_exec", {"cmd": ["git", "diff", "$file"]}],
["commando_new_file", {"syntax": "Diff", "scratch": true, "readonly": true, "name": "Git Diff"}]
]
}
}
]
}
]
And now you have your own Tools > My Commands menu, as well as a context menu called My Commands (right click on any file).
Command Palette
Create another file in Packages/User/
named My Commands.sublime-commands
and put this in it:
[
{
"caption": "Diff File",
"command": "commando",
"args": {
"commands": [
["commando_exec", {"cmd": ["git", "diff", "$file"]}],
["commando_new_file", {"syntax": "Diff", "scratch": true, "readonly": true, "name": "Git Diff"}]
]
}
}
]
Now open up the command pallet and type “Diff File”.
Keymaps
Finally, open up your Packages/User/Default (<Your OS>).sublime-keymap
file and add this to your other keymaps:
[
...
{
"keys": ["ctrl+shift+d"],
"command": "commando",
"args": {
"commands": [
["commando_exec", {"cmd": ["git", "diff", "$file"]}],
["commando_new_file", {"syntax": "Diff", "scratch": true, "readonly": true, "name": "Git Diff"}]
]
}
}
...
]
Now hit ctrl
+shift
+d
to do the diff as well.
And that's it, now you can do a diff on the current file from anywhere!
Plugin
However, if you're like me, copy-pasting the same command in several places can get annoying. If you want to take this a step further you can create your own named commands through a plugin. Select Tools
> New Plugin...
, make the file look like this:
from Commando.plugin import CommandoRun
class GitDiffFileCommand(CommandoRun):
def commands(self):
return [
["commando_exec", {"cmd": ["git", "diff", "$file"]}],
["commando_new_file", {"syntax": "Diff", "scratch": True, "readonly": True, "name": "Git Diff"}]
]
and save it as My Commands.py. Now you have a new Sublime command called git_diff_file
that you can use everywhere in place of commando
. So this:
{
"keys": ["ctrl+shift+d"],
"command": "commando",
"args": {
"commands": [
["commando_exec", {"cmd": ["git", "diff", "$file"]}],
["commando_new_file", {"syntax": "Diff", "scratch": true, "readonly": true, "name": "Git Diff"}]
]
}
}
becomes this:
{ "keys": ["ctrl+shift+d"], "command": "git_diff_file" },
But wait, there's more! There are already several useful commando commands you can use to build your own command, but if you need to you can also create your own if you want to. Documentation coming soon! For now, check out commands.py
.
Installation
Package Control
The package is registered in Package Control under the name Commando
.
Manual
Clone this repository as a subdirectory of your Sublime Text 3 Packages directory with the name Commando
. So, for instance:
cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages
git clone https://github.com/ericpridham/sublime-commando.git Commando
Get Into It
Check out the wiki for full documentation.