mirror of
https://github.com/freitass/todo.txt-vim.git
synced 2025-11-09 10:23:47 -05:00
Remove trailing whitespaces
This commit is contained in:
@@ -17,28 +17,28 @@ If your Vim installation does **not** have Python support, this plugin **will wo
|
|||||||
|
|
||||||
This plugin gives syntax highlighting to [todo.txt](http://todotxt.com/) files. It also defines a few mappings, to help with editing these files:
|
This plugin gives syntax highlighting to [todo.txt](http://todotxt.com/) files. It also defines a few mappings, to help with editing these files:
|
||||||
|
|
||||||
Sorting tasks:
|
Sorting tasks:
|
||||||
`<localleader>s` Sort the file
|
`<localleader>s` Sort the file
|
||||||
`<localleader>s+` Sort the file on +Projects
|
`<localleader>s+` Sort the file on +Projects
|
||||||
`<localleader>s@` Sort the file on @Contexts
|
`<localleader>s@` Sort the file on @Contexts
|
||||||
`<localleader>sd` Sort the file on dates
|
`<localleader>sd` Sort the file on dates
|
||||||
`<localleader>sdd` Sort the file on due dates
|
`<localleader>sdd` Sort the file on due dates
|
||||||
|
|
||||||
Edit priority:
|
Edit priority:
|
||||||
`<localleader>j` Decrease the priority of the current line
|
`<localleader>j` Decrease the priority of the current line
|
||||||
`<localleader>k` Increase the priority of the current line
|
`<localleader>k` Increase the priority of the current line
|
||||||
`<localleader>a` Add the priority (A) to the current line
|
`<localleader>a` Add the priority (A) to the current line
|
||||||
`<localleader>b` Add the priority (B) to the current line
|
`<localleader>b` Add the priority (B) to the current line
|
||||||
`<localleader>c` Add the priority (C) to the current line
|
`<localleader>c` Add the priority (C) to the current line
|
||||||
|
|
||||||
Date:
|
Date:
|
||||||
`<localleader>d` Set current task's creation date to the current date
|
`<localleader>d` Set current task's creation date to the current date
|
||||||
`date<tab>` (Insert mode) Insert the current date
|
`date<tab>` (Insert mode) Insert the current date
|
||||||
|
|
||||||
Mark as done:
|
Mark as done:
|
||||||
`<localleader>x` Mark current task as done
|
`<localleader>x` Mark current task as done
|
||||||
`<localleader>X` Mark all tasks as done
|
`<localleader>X` Mark all tasks as done
|
||||||
`<localleader>D` Move completed tasks to done.txt
|
`<localleader>D` Move completed tasks to done.txt
|
||||||
|
|
||||||
This plugin detects any text file with the name todo.txt or done.txt with an optional prefix that ends in a period (e.g. second.todo.txt, example.done.txt).
|
This plugin detects any text file with the name todo.txt or done.txt with an optional prefix that ends in a period (e.g. second.todo.txt, example.done.txt).
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ endfunction
|
|||||||
function! todo#txt#mark_as_done()
|
function! todo#txt#mark_as_done()
|
||||||
call s:remove_priority()
|
call s:remove_priority()
|
||||||
call todo#txt#prepend_date()
|
call todo#txt#prepend_date()
|
||||||
normal! Ix
|
normal! Ix
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! todo#txt#mark_all_as_done()
|
function! todo#txt#mark_all_as_done()
|
||||||
|
|||||||
@@ -26,18 +26,18 @@ CONTENTS *todo-contents*
|
|||||||
`<localleader>s@` Sort the file on @Contexts
|
`<localleader>s@` Sort the file on @Contexts
|
||||||
`<localleader>sd` Sort the file on dates
|
`<localleader>sd` Sort the file on dates
|
||||||
`<localleader>sdd` Sort the file on due dates (i.e. due:2015-10-25)
|
`<localleader>sdd` Sort the file on due dates (i.e. due:2015-10-25)
|
||||||
|
|
||||||
1.2 Edit priority: *todo-commands-priority*
|
1.2 Edit priority: *todo-commands-priority*
|
||||||
`<localleader>j` Decrease the priority of the current line
|
`<localleader>j` Decrease the priority of the current line
|
||||||
`<localleader>k` Increase the priority of the current line
|
`<localleader>k` Increase the priority of the current line
|
||||||
`<localleader>a` Add the priority (A) to the current line
|
`<localleader>a` Add the priority (A) to the current line
|
||||||
`<localleader>b` Add the priority (B) to the current line
|
`<localleader>b` Add the priority (B) to the current line
|
||||||
`<localleader>c` Add the priority (C) to the current line
|
`<localleader>c` Add the priority (C) to the current line
|
||||||
|
|
||||||
1.3 Date: *todo-commands-date*
|
1.3 Date: *todo-commands-date*
|
||||||
`<localleader>d` Set current task's creation date to the current date
|
`<localleader>d` Set current task's creation date to the current date
|
||||||
`date<tab>` (Insert mode) Insert the current date
|
`date<tab>` (Insert mode) Insert the current date
|
||||||
|
|
||||||
1.4 Mark as done: *todo-commands-done*
|
1.4 Mark as done: *todo-commands-done*
|
||||||
`<localleader>x` Mark current task as done
|
`<localleader>x` Mark current task as done
|
||||||
`<localleader>X` Mark all tasks as done
|
`<localleader>X` Mark all tasks as done
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ def _year_regex_after(year):
|
|||||||
regex = '|' + year[0:idx]
|
regex = '|' + year[0:idx]
|
||||||
regex += '9' if digit == '8' else '[%s-9]' % str(int(digit) + 1)
|
regex += '9' if digit == '8' else '[%s-9]' % str(int(digit) + 1)
|
||||||
if idx < len(year) - 1:
|
if idx < len(year) - 1:
|
||||||
regex += '\d{%s}' % (len(year) - (idx + 1))
|
regex += '\d{%s}' % (len(year) - (idx + 1))
|
||||||
year_regex += regex
|
year_regex += regex
|
||||||
|
|
||||||
year_regex += ')'
|
year_regex += ')'
|
||||||
@@ -40,7 +40,7 @@ def _month_regex_after(year, month):
|
|||||||
if digit2 == '8':
|
if digit2 == '8':
|
||||||
month_regex = r'(' + month_regex + r'|09)'
|
month_regex = r'(' + month_regex + r'|09)'
|
||||||
else:
|
else:
|
||||||
month_regex = r'(' + month_regex + r'|0[%s-9])'
|
month_regex = r'(' + month_regex + r'|0[%s-9])'
|
||||||
month_regex = month_regex % str(int(digit2) + 1)
|
month_regex = month_regex % str(int(digit2) + 1)
|
||||||
return '-'.join((year, month_regex, r'\d{2}'))
|
return '-'.join((year, month_regex, r'\d{2}'))
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
from datetime import date, timedelta, MINYEAR
|
from datetime import date, timedelta, MINYEAR
|
||||||
|
|
||||||
def _year_regex_before(year):
|
def _year_regex_before(year):
|
||||||
if int(year) <= MINYEAR:
|
if int(year) <= MINYEAR:
|
||||||
return None
|
return None
|
||||||
year_regex = r'('
|
year_regex = r'('
|
||||||
year_regex += r'\d{1,%s}' % str(len(year) - 1) if len(year) > 1 else ''
|
year_regex += r'\d{1,%s}' % str(len(year) - 1) if len(year) > 1 else ''
|
||||||
@@ -19,12 +19,12 @@ def _year_regex_before(year):
|
|||||||
regex = '|' + year[0:idx]
|
regex = '|' + year[0:idx]
|
||||||
regex += '0' if digit == '1' else '[0-%s]' % str(int(digit) - 1)
|
regex += '0' if digit == '1' else '[0-%s]' % str(int(digit) - 1)
|
||||||
if idx < len(year) - 1:
|
if idx < len(year) - 1:
|
||||||
regex += '\d{%s}' % (len(year) - (idx + 1))
|
regex += '\d{%s}' % (len(year) - (idx + 1))
|
||||||
year_regex += regex
|
year_regex += regex
|
||||||
|
|
||||||
year_regex += ')'
|
year_regex += ')'
|
||||||
return '-'.join((year_regex, r'\d{2}', r'\d{2}'))
|
return '-'.join((year_regex, r'\d{2}', r'\d{2}'))
|
||||||
|
|
||||||
def _month_regex_before(year, month):
|
def _month_regex_before(year, month):
|
||||||
if month == '01':
|
if month == '01':
|
||||||
return None
|
return None
|
||||||
@@ -33,7 +33,7 @@ def _month_regex_before(year, month):
|
|||||||
if digit1 == '0':
|
if digit1 == '0':
|
||||||
month_regex = '01' if month == '02' else r'0[1-%s]' % str(int(digit2) - 1)
|
month_regex = '01' if month == '02' else r'0[1-%s]' % str(int(digit2) - 1)
|
||||||
elif month == '10':
|
elif month == '10':
|
||||||
month_regex = r'0\d'
|
month_regex = r'0\d'
|
||||||
elif month == '11':
|
elif month == '11':
|
||||||
month_regex = r'(0\d|10)'
|
month_regex = r'(0\d|10)'
|
||||||
else:
|
else:
|
||||||
@@ -63,7 +63,7 @@ def _day_regex_before(year, month, day):
|
|||||||
return '-'.join((year, month, day_regex))
|
return '-'.join((year, month, day_regex))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def regex_date_before(given_date):
|
def regex_date_before(given_date):
|
||||||
year, month, day = given_date.isoformat().split('-')
|
year, month, day = given_date.isoformat().split('-')
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ if os.path.isdir(dateregex_dir):
|
|||||||
sys.path.insert(0, dateregex_dir)
|
sys.path.insert(0, dateregex_dir)
|
||||||
|
|
||||||
def add_due_date_syntax_highlight():
|
def add_due_date_syntax_highlight():
|
||||||
try:
|
try:
|
||||||
from dateregex import regex_date_before
|
from dateregex import regex_date_before
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print("dateregex module not found. Overdue dates won't be highlighted")
|
print("dateregex module not found. Overdue dates won't be highlighted")
|
||||||
return
|
return
|
||||||
|
|
||||||
regex = regex_date_before(date.today())
|
regex = regex_date_before(date.today())
|
||||||
regex = r'(^|<)due:%s(>|$)' % regex
|
regex = r'(^|<)due:%s(>|$)' % regex
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
let s:here = expand('<sfile>:p:h')
|
let s:here = expand('<sfile>:p:h')
|
||||||
let s:tc = unittest#testcase#new('Sort Context',
|
let s:tc = unittest#testcase#new('Sort Context',
|
||||||
\ { 'data': s:here . '/tc_sort_context.todo.txt' })
|
\ { 'data': s:here . '/tc_sort_context.todo.txt' })
|
||||||
|
|
||||||
let s:LEADER = mapleader
|
let s:LEADER = mapleader
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
let s:here = expand('<sfile>:p:h')
|
let s:here = expand('<sfile>:p:h')
|
||||||
let s:tc = unittest#testcase#new('Sort Date',
|
let s:tc = unittest#testcase#new('Sort Date',
|
||||||
\ { 'data': s:here . '/tc_sort_date.todo.txt' })
|
\ { 'data': s:here . '/tc_sort_date.todo.txt' })
|
||||||
|
|
||||||
let s:LEADER = mapleader
|
let s:LEADER = mapleader
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
let s:here = expand('<sfile>:p:h')
|
let s:here = expand('<sfile>:p:h')
|
||||||
let s:tc = unittest#testcase#new('Sort Project',
|
let s:tc = unittest#testcase#new('Sort Project',
|
||||||
\ { 'data': s:here . '/tc_sort_project.todo.txt' })
|
\ { 'data': s:here . '/tc_sort_project.todo.txt' })
|
||||||
|
|
||||||
let s:LEADER = mapleader
|
let s:LEADER = mapleader
|
||||||
|
|||||||
Reference in New Issue
Block a user