-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8573da1
commit 53c3a06
Showing
23 changed files
with
588 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
Description: | ||
Creates a Default.sublime-keymap file. Default.sublime-keymap files contain a JSON array that contains JSON objects to specify the key bindings. The JSON objects must contain a keys and command key, and may also contain a args key if the command requires arguments. | ||
Creates a Default.sublime-keymap file. | ||
Default.sublime-keymap files contain a JSON array that contains JSON objects to specify the key bindings. The JSON objects must contain a keys and command key, and may also contain a args key if the command requires arguments. | ||
|
||
Example: | ||
yo sublime-package:keymap | ||
|
||
This will create: | ||
Default.sublime-keymap: *.sublime-keymap files contain a JSON array that contains JSON objects to specify the key bindings. | ||
Default.sublime-keymap: *.sublime-keymap files contain a JSON array that contains JSON objects to specify the key bindings. | ||
|
||
Default (Linux).sublime-keymap | ||
Default (OSX).sublime-keymap | ||
Default (Windows).sublime-keymap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Description: | ||
Creates a Snippet file. Snippets are smart templates that will insert text for you, adapting it to their context. | ||
|
||
Example: | ||
yo sublime-package:snippet | ||
|
||
This will create: | ||
snipptes/SublimePackage.sublime-snippet: Snippets are smart templates that will insert text for you, adapting it to their context. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
const config = { | ||
name: 'Snippet', | ||
description: 'Creates a Snippet file. Snippets are smart templates that will insert text for you, adapting it to their context.', | ||
priority: 6, | ||
versions: { | ||
'4.0.x': '', | ||
}, | ||
prompts: [ | ||
{ | ||
name: 'snippet_file_name', | ||
message: 'What is the name of your new snippet file (snippet file name)?', | ||
type: 'input', | ||
default: '${config.package_name_pascal_case}', | ||
}, | ||
{ | ||
name: 'snippet_content', | ||
message: 'What is the content?', | ||
type: 'input', | ||
default: 'Hello World!', | ||
}, | ||
{ | ||
name: 'snippet_tab_trigger', | ||
message: 'What is the name of your new snippet file (snippet file name)?', | ||
type: 'input', | ||
default: 'hello_world', | ||
}, | ||
{ | ||
name: 'snippet_description', | ||
message: 'What is the name of your new snippet file (snippet file name)?', | ||
type: 'input', | ||
default: 'Say hello world!', | ||
}, | ||
{ | ||
name: 'snippet_scope', | ||
message: 'What is the name of your new snippet file (snippet file name)?', | ||
type: 'input', | ||
default: 'source.python', | ||
}, | ||
], | ||
}; | ||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
'use strict'; | ||
/* eslint no-empty-function: ["error", { "allow": ["methods"] }] */ | ||
|
||
const Generator = require('yeoman-generator'); | ||
const chalk = require('chalk'); | ||
const yosay = require('yosay'); | ||
const path = require('path'); | ||
const helper = require('./../../src/helper.js'); | ||
const generator = path.basename(__dirname); | ||
const generator_config = require('./config.js'); | ||
|
||
let config = {}; | ||
let answers = {}; | ||
|
||
module.exports = class extends Generator { | ||
// initializing - Your initialization methods (checking current project state, getting configs, etc) | ||
async initializing() { | ||
|
||
// create or update config | ||
await helper.InitConfig(this, generator_config); | ||
|
||
// get current config | ||
config = this.config.getAll(); | ||
config.generator_name = generator_config.name || generator; | ||
config.generator_description = '\n' + generator_config.description || ''; | ||
} | ||
|
||
// prompting - Where you prompt users for options (where you’d call this.prompt()) | ||
async prompting() { | ||
this.log( | ||
yosay( | ||
`${chalk.green(config.generator_name)} ${config.generator_description}`, | ||
), | ||
); | ||
|
||
generator_config.prompts = helper.InterpolatePrompts(this, config, generator_config.prompts); | ||
answers = await this.prompt(generator_config.prompts); | ||
} | ||
|
||
// configuring - Saving configurations and configure the project (creating .editorconfig files and other metadata files) | ||
configuring() {} | ||
|
||
// default - If the method name doesn’t match a priority, it will be pushed to this group. | ||
default() {} | ||
|
||
// writing - Where you write the generator specific files (routes, controllers, etc) | ||
writing() { | ||
|
||
// merge data | ||
const data = { | ||
...config, | ||
...answers, | ||
}; | ||
|
||
this.renderTemplate( | ||
this.templatePath('snippet.sublime-snippet'), | ||
this.destinationPath(`snipptes/${data.snippet_file_name}.sublime-snippet`), | ||
data, | ||
); | ||
} | ||
|
||
// conflicts - Where conflicts are handled (used internally) | ||
conflicts() { } | ||
|
||
// install - Where installations are run (npm, bower) | ||
install() {} | ||
|
||
// end - Called last, cleanup, say good bye, etc | ||
end() { | ||
helper.End(this, config); | ||
} | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[ | ||
{ | ||
"command": "move_to", | ||
"args": { | ||
"to": "#" | ||
} | ||
}, | ||
{ | ||
"command": "insert", | ||
"args": { | ||
"characters": "\n" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Description: | ||
Creates a *.sublime-menu file. Define Menubar and various right-click menus. | ||
File name is significant because it determine which element (Menubar/statusbar/...) is affected. | ||
|
||
Example: | ||
yo sublime-package:menu | ||
|
||
This will create: | ||
Context.sublime-menu Right click on main buffer. | ||
Encoding.sublime-menu Left click on "Encoding" section in statusbar. | ||
Find in Files.sublime-menu Left click on "..." button on Where field of Find_in_files. | ||
Indentation.sublime-menu Left click on "Indentation" section in statusbar. | ||
Line Endings.sublime-menu Left click on "Line Ending" section in statusbar. | ||
Main.sublime-menu Main Menu bar. | ||
Side Bar.sublime-menu Right click on items in Sidebar. | ||
Syntax.sublime-menu Left click on current syntax section in statusbar e.g. 'Plain Text'. | ||
Side Bar Mount Point.sublime-menu Right click on main folders in Sidebar. | ||
Tab Context.sublime-menu Right click on Tab bar. | ||
Widget Context.sublime-menu Right click on text field of any widget (i.e: search panel or output panel). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
const config = { | ||
name: 'Menu', | ||
description: 'Creates a *.sublime-menu file. Define Menubar and various right-click menus. Creates a *.sublime-menu file.', | ||
priority: 7, | ||
versions: { | ||
'4.0.x': '', | ||
}, | ||
prompts: [ | ||
{ | ||
name: 'menu_types', | ||
message: 'Which menu do you need?', | ||
type: 'checkbox', | ||
choices: [ | ||
{ | ||
name: 'Main', | ||
value: 'Main', | ||
checked: true, | ||
}, | ||
{ | ||
name: 'Context', | ||
value: 'Context', | ||
checked: false, | ||
}, | ||
{ | ||
name: 'Encoding', | ||
value: 'Encoding', | ||
checked: false, | ||
}, | ||
{ | ||
name: 'Find in Files', | ||
value: 'Find in Files', | ||
checked: false, | ||
}, | ||
{ | ||
name: 'Indentation', | ||
value: 'Indentation', | ||
checked: false, | ||
}, | ||
{ | ||
name: 'Line Endings', | ||
value: 'Line Endings', | ||
checked: false, | ||
}, | ||
{ | ||
name: 'Side Bar', | ||
value: 'Side Bar', | ||
checked: false, | ||
}, | ||
{ | ||
name: 'Side Bar Mount Point', | ||
value: 'Side Bar Mount Point', | ||
checked: false, | ||
}, | ||
{ | ||
name: 'Syntax', | ||
value: 'Syntax', | ||
checked: false, | ||
}, | ||
{ | ||
name: 'Tab Context', | ||
value: 'Tab Context', | ||
checked: false, | ||
}, | ||
{ | ||
name: 'Widget Context', | ||
value: 'Widget Context', | ||
checked: false, | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
module.exports = config; |
Oops, something went wrong.