Skip to content

Commit

Permalink
init project
Browse files Browse the repository at this point in the history
  • Loading branch information
chagel committed Jan 8, 2012
0 parents commit 7a586f3
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
*.cache
*.pyc
3 changes: 3 additions & 0 deletions Default (OSX).sublime-keymap
@@ -0,0 +1,3 @@
[ // iTodo plugin
{ "keys": ["super+\\"], "command": "itodo" }
]
24 changes: 24 additions & 0 deletions itodo.py
@@ -0,0 +1,24 @@
import sublime, sublime_plugin
from datetime import datetime

class ItodoCommand(sublime_plugin.TextCommand):
def run(self, edit):
# only work on .todo files
filename = self.view.file_name()
if filename is None or not filename.endswith('.todo'):
return False

for region in self.view.sel():
line = self.view.line(region)
line_contents = self.view.substr(line).strip()

# prepend @done if item is ongoing
if line_contents.startswith('-'):
self.view.insert(edit, line.end(), " @done (%s)" % datetime.now().strftime("%Y-%m-%d %H:%M"))
self.view.replace(edit, self.view.word(line.begin()), "+ ")
# undo @todo
elif line_contents.startswith('+'):
subfix = self.view.find('(\s)*@done(.)+\)$', line.begin())
self.view.erase(edit, subfix)
self.view.replace(edit, self.view.word(line.begin()), "- ")

83 changes: 83 additions & 0 deletions itodo.tmLanguage
@@ -0,0 +1,83 @@
<?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>fileTypes</key>
<array>
<string>todo</string>
</array>
<key>keyEquivalent</key>
<string>^~T</string>
<key>name</key>
<string>iTodo</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>^\s*(\w+.+:\s*$\n?)</string>
<key>name</key>
<string>keyword.control.header.itodo</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.bullet.completed.itodo</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>comment.line.completed.itodo</string>
</dict>
</dict>
<key>match</key>
<string>^\s*(\+|✓)\s+((?:[^\@]|(?&lt;!\s)\@|\@(?=\s))*)</string>
<key>name</key>
<string>meta.item.itodo.completed</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.bullet.pending.itodo</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>text.pending.itodo</string>
</dict>
</dict>
<key>match</key>
<string>^\s*(-)\s+((?:[^\@]|(?&lt;!\s)\@)*)</string>
<key>name</key>
<string>meta.item.itodo.pending</string>
</dict>
<dict>
<key>match</key>
<string>(?&lt;=\s)\@(?!today|completed|done)[\w\d\-!?]+\s?</string>
<key>name</key>
<string>meta.tag.itodo</string>
</dict>
<dict>
<key>match</key>
<string>(?&lt;=\s)\@done \([\d\.:\-/ ].+\)\s?</string>
<key>name</key>
<string>meta.tag.itodo.completed</string>
</dict>
<dict>
<key>match</key>
<string>(?&lt;=\s)\@today\s?</string>
<key>name</key>
<string>string.other.tag.itodo.today</string>
</dict>
</array>
<key>scopeName</key>
<string>text.itodo</string>
<key>uuid</key>
<string>8fj2g29c-04ef-4330-9a6b-9b99aae1c418</string>
</dict>
</plist>
40 changes: 40 additions & 0 deletions readme.md
@@ -0,0 +1,40 @@
iTodo for Sublime Text
------------------

iTodo is a GTD tool for managing todo list in Sublime Text editor.

Description
------------------

This plugin contains one text command names 'itodo' and a syntax definition with the same name.

Usage
------------------

"CMD + \": toggle task completed


Samples
------------------

Suppose we have a following todo file:

Project A:
- call mum tomorrow at 8 am.

Highlight this item line and press "CMD + \", it marks a tag "@done" and also appends timestamp.

Project A:
+ call mum tomorrow at 8 am. @done (2012-01-08 18:12)


Contribution
------------------

Thanks Taskmate for TextMate (https://github.com/svenfuchs/taskmate).


Source / Installation
------------------

https://github.com/chagel/itodo

0 comments on commit 7a586f3

Please sign in to comment.