mirror of
https://github.com/freitass/todo.txt-vim.git
synced 2025-11-08 09:53:48 -05:00
Merge branch 'ha17-dev-add-priority'
This commit is contained in:
@@ -5,8 +5,7 @@
|
||||
cp -R * ~/.vim
|
||||
|
||||
|
||||
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:
|
||||
|
||||
`<leader>-s` : Sort the file
|
||||
|
||||
@@ -14,9 +13,15 @@ mappings, to help with editing these files:
|
||||
|
||||
`<leader>-s@` : Sort the file on @Contexts
|
||||
|
||||
`<leader>-j` : Lower the priority (cursor must by on priority)
|
||||
`<leader>-j` : Lower the priority of the current line
|
||||
|
||||
`<leader>-k` : Increase the priority (cursor must by on priority)
|
||||
`<leader>-k` : Increase the priority of the current line
|
||||
|
||||
`<leader>-a` : Add the priority (A) to the current line
|
||||
|
||||
`<leader>-c` : Add the priority (B) to the current line
|
||||
|
||||
`<leader>-b` : Add the priority (C) to the current line
|
||||
|
||||
`<leader>-d` : Insert the current date
|
||||
|
||||
|
||||
11
Todo.txt
11
Todo.txt
@@ -1,8 +1,4 @@
|
||||
(A) 2011-05-30 Map commands to add, rm, ls, pri, depri etc @ftplugin
|
||||
(A) 2011-06-06 Check file syntax @syntax
|
||||
(B) 2011-05-31 Start documentation @doc
|
||||
(C) 2011-06-01 Improve syntax file @syntax
|
||||
x 2014-04-27 2011-05-30 Contact main project for reference
|
||||
2014-11-01 Find a way to import text into markdown and vim doc @doc
|
||||
x 2011-05-30 Create README.markdown to be published in github @doc
|
||||
x 2011-05-30 Implement colorized priorities @syntax
|
||||
x 2011-05-30 Implement filetype detection @ftdetect
|
||||
@@ -11,3 +7,8 @@ x 2011-05-31 Highlight date, project and context of tasks with no priority @synt
|
||||
x 2011-05-31 Stop breaking lines automatically @ftplugin
|
||||
x 2011-06-06 Easier date input @ftplugin
|
||||
x 2011-06-06 Implement foldings @ftplugin
|
||||
x 2014-04-27 2011-05-30 Contact main project for reference
|
||||
x 2014-11-01 2011-05-30 Map commands to add, rm, ls, pri, depri etc @ftplugin
|
||||
x 2014-11-01 2011-05-31 Start documentation @doc
|
||||
x 2014-11-01 2011-06-01 Improve syntax file @syntax
|
||||
x 2014-11-01 2011-06-06 Check file syntax @syntax
|
||||
|
||||
10
doc/todo.txt
10
doc/todo.txt
@@ -9,9 +9,15 @@ COMMANDS *todo-commands*
|
||||
|
||||
`<leader>-s@` : Sort the file on @Contexts
|
||||
|
||||
`<leader>-j` : Lower the priority (cursor must by on priority)
|
||||
`<leader>-j` : Lower the priority of the current line
|
||||
|
||||
`<leader>-k` : Increase the priority (cursor must by on priority)
|
||||
`<leader>-k` : Increase the priority of the current line
|
||||
|
||||
`<leader>-a` : Add the priority (A) to the current line
|
||||
|
||||
`<leader>-c` : Add the priority (B) to the current line
|
||||
|
||||
`<leader>-b` : Add the priority (C) to the current line
|
||||
|
||||
`<leader>-d` : Insert the current date
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ set cpo&vim
|
||||
setlocal textwidth=0
|
||||
setlocal wrapmargin=0
|
||||
|
||||
" Functions {{{!
|
||||
" Functions {{{1
|
||||
function! s:TodoTxtRemovePriority()
|
||||
:s/^(\w)\s\+//ge
|
||||
endfunction
|
||||
@@ -28,7 +28,7 @@ endfunction
|
||||
|
||||
function! TodoTxtMarkAsDone()
|
||||
call s:TodoTxtRemovePriority()
|
||||
call TodoTxtPrependDate()
|
||||
call TodoTxtPrependDate()
|
||||
normal! Ix
|
||||
endfunction
|
||||
|
||||
@@ -64,6 +64,15 @@ function! TodoTxtPrioritizeDecrease()
|
||||
function! TodoTxtPrioritizeDecrease()
|
||||
normal! 0f)h
|
||||
endfunction
|
||||
|
||||
function! TodoTxtPrioritizeAdd (priority)
|
||||
" Need to figure out how to only do this if the first visible letter in a line is not (
|
||||
:call TodoTxtPrioritizeAddAction(a:priority)
|
||||
endfunction
|
||||
|
||||
function! TodoTxtPrioritizeAddAction (priority)
|
||||
execute "normal! mq0i(".a:priority.") \<esc>`q"
|
||||
endfunction
|
||||
|
||||
if !hasmapto("<leader>j",'n')
|
||||
nnoremap <script> <silent> <buffer> <leader>j :call TodoTxtPrioritizeIncrease()<CR>
|
||||
@@ -80,6 +89,30 @@ if !hasmapto("<leader>k",'v')
|
||||
if !hasmapto("<leader>k",'v')
|
||||
vnoremap <script> <silent> <buffer> <leader>k :call TodoTxtPrioritizeDecrease()<CR>
|
||||
endif
|
||||
|
||||
if !hasmapto("<leader>a",'n')
|
||||
nnoremap <script> <silent> <buffer> <leader>a :call TodoTxtPrioritizeAdd('A')<CR>
|
||||
endif
|
||||
|
||||
if !hasmapto("<leader>a",'v')
|
||||
vnoremap <script> <silent> <buffer> <leader>a :call TodoTxtPrioritizeAdd('A')<CR>
|
||||
endif
|
||||
|
||||
if !hasmapto("<leader>b",'n')
|
||||
nnoremap <script> <silent> <buffer> <leader>b :call TodoTxtPrioritizeAdd('B')<CR>
|
||||
endif
|
||||
|
||||
if !hasmapto("<leader>b",'v')
|
||||
vnoremap <script> <silent> <buffer> <leader>b :call TodoTxtPrioritizeAdd('B')<CR>
|
||||
endif
|
||||
|
||||
if !hasmapto("<leader>c",'n')
|
||||
nnoremap <script> <silent> <buffer> <leader>c :call TodoTxtPrioritizeAdd('C')<CR>
|
||||
endif
|
||||
|
||||
if !hasmapto("<leader>c",'v')
|
||||
vnoremap <script> <silent> <buffer> <leader>c :call TodoTxtPrioritizeAdd('C')<CR>
|
||||
endif
|
||||
|
||||
" Insert date {{{2
|
||||
if !hasmapto("date<Tab>",'i')
|
||||
|
||||
Reference in New Issue
Block a user