Skip to content

Commit 133df3b

Browse files
committed
Reverting mousemap actions.
Using enter to open links. mousemaping is not reliable right now.
1 parent e2ed83f commit 133df3b

11 files changed

+101
-88
lines changed

Default (Linux).sublime-keymap

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
[{ "key": "selector", "operator": "equal", "operand": "text.notes_buffer" }]
1111
},
1212

13+
{ "keys": ["enter"], "command": "note_open_url", "context":
14+
[{ "key": "selector", "operator": "equal", "operand": "text.html.markdown.note markup.underline.link.markdown" }]
15+
},
16+
1317
// Notes: Jotter keymaps
1418
{ "keys": ["escape"], "command": "save_jot_and_hide_panel", "context":
1519
[

Default (Linux).sublime-mousemap

-6
This file was deleted.

Default (OSX).sublime-keymap

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
[{ "key": "selector", "operator": "equal", "operand": "text.notes_buffer" }]
1111
},
1212

13+
{ "keys": ["enter"], "command": "note_open_url", "context":
14+
[{ "key": "selector", "operator": "equal", "operand": "text.html.markdown.note markup.underline.link.markdown" }]
15+
},
16+
1317
// Notes: Jotter keymaps
1418
{ "keys": ["escape"], "command": "save_jot_and_hide_panel", "context":
1519
[

Default (OSX).sublime-mousemap

-6
This file was deleted.

Default (Windows).sublime-keymap

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
[{ "key": "selector", "operator": "equal", "operand": "text.notes_buffer" }]
1111
},
1212

13+
{ "keys": ["enter"], "command": "note_open_url", "context":
14+
[{ "key": "selector", "operator": "equal", "operand": "text.html.markdown.note markup.underline.link.markdown" }]
15+
},
16+
1317
// Notes: Jotter keymaps
1418
{ "keys": ["escape"], "command": "save_jot_and_hide_panel", "context":
1519
[

Default (Windows).sublime-mousemap

-6
This file was deleted.

Default.sublime-commands

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[
2-
{ "caption": "Notes: List…", "command": "notes_list"},
3-
{ "caption": "Notes: New…", "command": "notes_new"},
4-
{ "caption": "Notes: Jotter", "command": "jotter"},
5-
{ "caption": "Notes: Inbox", "command": "open_inbox"},
6-
{ "caption": "Notes: Index", "command": "notes_buffer"},
7-
{ "caption": "Notes: Rename", "command": "note_rename"},
8-
{ "caption": "Notes: Archive", "command": "note_archive"},
9-
{ "caption": "Notes: Delete", "command": "note_remove"},
10-
{ "caption": "Notes: Change Color…", "command": "note_change_color"},
11-
{ "caption": "Notes: Unarchive…", "command": "note_unarchive"}
2+
{ "caption": "Notes: List…" , "command": "notes_list" },
3+
{ "caption": "Notes: New…" , "command": "notes_new" },
4+
{ "caption": "Notes: Jotter" , "command": "jotter" },
5+
{ "caption": "Notes: Inbox" , "command": "open_inbox" },
6+
{ "caption": "Notes: Index" , "command": "notes_buffer" },
7+
{ "caption": "Notes: Rename" , "command": "note_rename" },
8+
{ "caption": "Notes: Archive" , "command": "note_archive" },
9+
{ "caption": "Notes: Delete" , "command": "note_remove" },
10+
{ "caption": "Notes: Change Color…" , "command": "note_change_color" },
11+
{ "caption": "Notes: Unarchive…" , "command": "note_unarchive" }
1212
]

Documentation/docs.md

+21-2
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,35 @@
22
#### Note Markdown
33
###### Strikethrough
44
###### URLS
5+
#### ✔ admonitions
6+
#### tables
57
#### fenced code block
68
#### tasks (Tasklists Github Style)
79
#### internal links
810
#### tags
9-
#### tables
10-
#### ✔ admonitions
1111
#### Abbreviations
1212
#### Attribute Lists
1313
#### TODO: footnotes, math
1414

15+
#### Tables
16+
☐ support most ascii table formats
17+
☐ use table editor
18+
☐ note on those which are not supported
19+
☐ note on table editor not being maintined
20+
☐ example
21+
22+
#### Fenced Code Blocks
23+
☐ multiple langs
24+
☐ note langs should be installed
25+
☐ general fenced block
26+
27+
#### Task lists
28+
☐ todo tasks
29+
☐ adding new task
30+
☐ done task
31+
☐ cancelled tasks
32+
☐ github style todos
33+
1534
## Headings
1635
- ✔ folding/unfolding headings local and global tab/shift+tab
1736
- ✔ moving between heading (command+R)

README.md

+18-17
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ To add more yaml items you can add them to the settings by modifying `note_yaml:
139139
```
140140

141141
#### Other features
142-
- open urls: place cursor on the link then `alt + click` to open a url in the browser.
142+
- **Open URLs**: place cursor on the link then press `enter` to open a url in
143+
the browser.
143144

144145
#### Per-project notes
145146

@@ -162,19 +163,19 @@ documents, since markdown sometime feels too simple to format a real document.
162163

163164
If you are new to markdown here is a cheat-sheet:
164165

165-
| Markup | Markdown Syntax |
166-
| :------- | :-------------------------------------- |
167-
| Italic | `_italic_` or `*italic*` |
168-
| Bold | `**bold**` or `**bold**` |
169-
| Images | `![Image Title](http://url_to.image)` |
170-
| Links | `[Link Text](http://link.url)` |
171-
| Inline Code | `` `code` `` |
172-
| Quotes | `> Here is a quote block` |
173-
| Separators | `----` or `*****` |
174-
| Heading 1 | `# Heading 1` |
175-
| Heading 2 | `## Heading 2` |
176-
| Heading 3 | `### Heading 3` |
177-
| Heading 4 | `#### Heading 4` |
166+
| Markup | Markdown Syntax |
167+
|-------------|---------------------------------------|
168+
| Italic | `_italic_` or `*italic*` |
169+
| Bold | `**bold**` or `**bold**` |
170+
| Images | `![Image Title](http://url_to.image)` |
171+
| Links | `[Link Text](http://link.url)` |
172+
| Inline Code | `` `code` `` |
173+
| Quotes | `> Here is a quote block` |
174+
| Separators | `----` or `*****` |
175+
| Heading 1 | `# Heading 1` |
176+
| Heading 2 | `## Heading 2` |
177+
| Heading 3 | `### Heading 3` |
178+
| Heading 4 | `#### Heading 4` |
178179

179180
### Extra Markup
180181

@@ -184,13 +185,13 @@ giving it a special title and box. These sections might appear several times
184185
in your document. Some examples would be *Note*, *Tip* or *Caution* blocks in
185186
an article.
186187

187-
![PlainNotes Admonitions](https://cloud.githubusercontent.com/assets/3202/10559318/3d5e5420-74ee-11e5-89b9-0eca42750aca.png)
188-
189188
Here is how to create an admonition block
190189

191190
!!! ADMONITION_TYPE "Optional title in quotes"
192191
Any number of other indented markdown elements.
193192

193+
<img width="640" src="https://cloud.githubusercontent.com/assets/3202/10559318/3d5e5420-74ee-11e5-89b9-0eca42750aca.png" >
194+
194195
By default admonitions block have a purplish background color (that might be
195196
different based on the color scheme), but giving it a specific type from table
196197
below can change the color. Predefined admonition types are listed in table
@@ -207,7 +208,7 @@ case, upper-case or title-case.
207208
Admonition blocks can have any PlainNotes enhanced markdown inside them and
208209
they customize the look and feel so that everything looks sublime.
209210

210-
![PlainNotes admonition block with content](https://cloud.githubusercontent.com/assets/3202/10559414/c9a61ff6-74f0-11e5-8209-1c881ebd8506.png)
211+
<img align="center" width="380" src="https://cloud.githubusercontent.com/assets/3202/10559414/c9a61ff6-74f0-11e5-8209-1c881ebd8506.png" >
211212

212213
## License
213214

note_support.py

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import sublime, sublime_plugin
2+
import webbrowser
3+
4+
class NoteOpenUrlCommand(sublime_plugin.TextCommand):
5+
6+
def run(self, edit):
7+
s = self.view.sel()[0]
8+
9+
# Expand selection to possible URL
10+
start = s.a
11+
end = s.b
12+
13+
view_size = self.view.size()
14+
terminator = ['\t', ' ', '\"', '\'', '(', ')']
15+
16+
while (start > 0
17+
and not self.view.substr(start - 1) in terminator
18+
and self.view.classify(start) & sublime.CLASS_LINE_START == 0):
19+
start -= 1
20+
21+
while (end < view_size
22+
and not self.view.substr(end) in terminator
23+
and self.view.classify(end) & sublime.CLASS_LINE_END == 0):
24+
end += 1
25+
26+
# Check if this is URL
27+
url = self.view.substr(sublime.Region(start, end))
28+
29+
if url.startswith(('http://', 'https://')):
30+
webbrowser.open_new_tab(url)
31+
32+
def is_enabled(self):
33+
is_note = sublime.active_window().active_view().settings().get("is_note")
34+
if is_note:
35+
return is_note
36+
else:
37+
return False

notes.py

+3-41
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@
55
import copy
66
from gzip import GzipFile
77
from pickle import load, dump
8-
import webbrowser
98

109
ST3 = int(sublime.version()) >= 3000
1110

1211
if not ST3:
1312
from codecs import open
1413

15-
1614
def settings():
1715
return sublime.load_settings('Notes.sublime-settings')
1816

@@ -50,7 +48,7 @@ def find_notes(self, root, exclude):
5048
return note_files
5149

5250

53-
def setup_notes_list(file_list):
51+
def setup_notes_list(file_list):
5452
# list display options
5553
try:
5654
display_modified_date = settings().get("list_options").get("display_modified_date")
@@ -75,7 +73,7 @@ def setup_notes_list(file_list):
7573
def update_color(old_file_path, new_file_path):
7674
# update color scheme db
7775
f_id_old = file_id(old_file_path)
78-
76+
7977
if db.get(f_id_old):
8078
f_id_new = file_id(new_file_path)
8179
if not db.get(f_id_new):
@@ -88,7 +86,7 @@ def update_color(old_file_path, new_file_path):
8886

8987
save_to_brain()
9088

91-
89+
9290
class NotesListCommand(sublime_plugin.ApplicationCommand):
9391

9492
def run(self):
@@ -362,42 +360,6 @@ def is_enabled(self):
362360
return False
363361

364362

365-
class NoteOpenUrlCommand(sublime_plugin.TextCommand):
366-
367-
def run(self, edit):
368-
s = self.view.sel()[0]
369-
370-
# Expand selection to possible URL
371-
start = s.a
372-
end = s.b
373-
374-
view_size = self.view.size()
375-
terminator = ['\t', ' ', '\"', '\'', '(', ')']
376-
377-
while (start > 0
378-
and not self.view.substr(start - 1) in terminator
379-
and self.view.classify(start) & sublime.CLASS_LINE_START == 0):
380-
start -= 1
381-
382-
while (end < view_size
383-
and not self.view.substr(end) in terminator
384-
and self.view.classify(end) & sublime.CLASS_LINE_END == 0):
385-
end += 1
386-
387-
# Check if this is URL
388-
url = self.view.substr(sublime.Region(start, end))
389-
390-
if url.startswith(('http://', 'https://')):
391-
webbrowser.open_new_tab(url)
392-
393-
def is_enabled(self):
394-
is_note = sublime.active_window().active_view().settings().get("is_note")
395-
if is_note:
396-
return is_note
397-
else:
398-
return False
399-
400-
401363
def save_to_brain():
402364
# print("SAVING TO DISK-----------------")
403365
# print(db)

0 commit comments

Comments
 (0)