Skip to content
Browse files

use selector in keymap

  • Loading branch information...
1 parent b98b3e5 commit ef12a425c07a1e0127d9fd966cdacddd819a3cee @erinata committed Apr 12, 2012
Showing with 37 additions and 18 deletions.
  1. +8 −5 Bullet.py
  2. +1 −6 Bullet.sublime-settings
  3. +22 −4 Default (Windows).sublime-keymap
  4. +3 −2 README.md
  5. +3 −1 messages/0.3.0.txt
View
13 Bullet.py
@@ -13,15 +13,18 @@ class Bullet(sublime_plugin.EventListener):
is_markdown = False
last_line = 0
last_pos = 0
- selectors = []
+ #selectors = []
+ selector_array = []
def __init__(self):
- s = sublime.load_settings("Bullet.sublime-settings")
- Bullet.selectors = s.get("markdown_bullet_selectors", [])
+ #s = sublime.load_settings("Bullet.sublime-settings")
+ #selectors = s.get("markdown_bullet_selectors", "")
+ #Bullet.selector_array = selectors.split("|")
+ Bullet.selector_array = ["text.html.markdown"]
def on_activated(self, view):
- for x in range(len(Bullet.selectors)):
- if (view.score_selector(0,Bullet.selectors[x]) > 0):
+ for x in range(len(Bullet.selector_array)):
+ if (view.score_selector(0,Bullet.selector_array[x]) > 0):
Bullet.is_markdown = True
Bullet.update_row(self, view)
return
View
7 Bullet.sublime-settings
@@ -1,8 +1,3 @@
{
- "markdown_bullet_selectors" : ["text.html.markdown"]
-
- // You can customize which kind of files are using bullet
- // For example if you would like to have the automatic bullet points behaviour in plain text files,
- //
- // "markdown_bullet_selectors" : ["text.html.markdown", "text.plain"]
+
}
View
26 Default (Windows).sublime-keymap
@@ -2,17 +2,35 @@
{
"keys": ["tab"], "command": "indent", "context":
[
+ { "key": "selector", "operator": "equal", "operand": "markup.list.unnumbered.markdown" },
{ "key": "preceding_text", "operator": "regex_match", "operand": "^( *|\\t*)(\\*|\\-|\\>|\\+|[0-9]+\\.)(.*)", "match_all": true },
{ "key": "auto_complete_visible", "operator": "equal", "operand": false},
- { "key": "last_command", "operator": "not_equal", "operand": "insert_best_completion" },
- { "key": "selector", "operator": "equal", "operand": "text.html.markdown" }
+ { "key": "last_command", "operator": "not_equal", "operand": "insert_best_completion" }
+
+ ]
+ },
+ {
+ "keys": ["tab"], "command": "indent", "context":
+ [
+ { "key": "selector", "operator": "equal", "operand": "meta.paragraph.list.markdown" },
+ { "key": "preceding_text", "operator": "regex_match", "operand": "^( *|\\t*)(\\*|\\-|\\>|\\+|[0-9]+\\.)(.*)", "match_all": true },
+ { "key": "auto_complete_visible", "operator": "equal", "operand": false},
+ { "key": "last_command", "operator": "not_equal", "operand": "insert_best_completion" }
+
+ ]
+ },
+ {
+ "keys": ["shift+tab"], "command": "unindent", "context":
+ [
+ { "key": "selector", "operator": "equal", "operand": "markup.list.unnumbered.markdown" },
+ { "key": "preceding_text", "operator": "regex_match", "operand": "^( +|\\t+)(\\*|\\-|\\>|\\+|[0-9]+\\.)(.*)", "match_all": true }
]
},
{
"keys": ["shift+tab"], "command": "unindent", "context":
[
- { "key": "preceding_text", "operator": "regex_match", "operand": "^( +|\\t+)(\\*|\\-|\\>|\\+|[0-9]+\\.)(.*)", "match_all": true },
- { "key": "selector", "operator": "equal", "operand": "text.html.markdown" }
+ { "key": "selector", "operator": "equal", "operand": "meta.paragraph.list.markdown" },
+ { "key": "preceding_text", "operator": "regex_match", "operand": "^( +|\\t+)(\\*|\\-|\\>|\\+|[0-9]+\\.)(.*)", "match_all": true }
]
}
]
View
5 README.md
@@ -1,4 +1,4 @@
-# SublimeBullet (version 0.2.0)
+# SublimeBullet (version 0.3.0)
This is a Sublime Text plugin for markdown style Bullet points and Number lists. It automatically add * , +and - for unordered lists, > for blockquotes, and numbered items for number lists.
@@ -12,9 +12,10 @@ Install using Package Control (Recommanded)
Install manually
-1. Download the repo
+1. Download the repo
2. Copy everything in the repo to a folder named "Bullet" under the package folder of SublimeText 2 (create it if it doesn't exist)
+
## Usage
In markdown files, * , + and - are automatically added for unordered lists (aka bullet points). Similarly > are automatically added for multiline blockquote.
View
4 messages/0.3.0.txt
@@ -2,4 +2,6 @@ SublimeMarkdown 0.3.0
Changelog
- a major rewrite on the mechanism of indent and unindent.
- - use tab and shift tab to indent and unindent
+ - use tab and shift tab to indent and unindent
+ - The settings are disabled for now. This plugin will only work in markdown files
+

0 comments on commit ef12a42

Please sign in to comment.
Something went wrong with that request. Please try again.