mirror of
https://github.com/freitass/todo.txt-vim.git
synced 2025-11-14 04:43:46 -05:00
Added two new sorting functions and a way to increase/decrease priorities easily
See README for more details: <leader>s@ - sort by @contexts <leader>s+ - sort by +projects <leader>j - decrease priority <leader>k - increase priority
This commit is contained in:
@@ -10,6 +10,14 @@ mappings, to help with edition of these files:
|
||||
|
||||
`<leader>-s` : Sort the file
|
||||
|
||||
`<leader>-s+` : Sort the file on +Projects
|
||||
|
||||
`<leader>-s@` : Sort the file on @Contexts
|
||||
|
||||
`<leader>-j` : Lower the priority (cursor must by on priority)
|
||||
|
||||
`<leader>-k` : Increase the priority (cursor must by on priority)
|
||||
|
||||
`<leader>-d` : Insert the current date
|
||||
|
||||
`date<tab>` : (Insert mode) Insert the current date
|
||||
|
||||
@@ -45,6 +45,47 @@ if !hasmapto("<leader>s",'n')
|
||||
if !hasmapto("<leader>s",'n')
|
||||
nnoremap <script> <silent> <buffer> <leader>s :sort<CR>
|
||||
endif
|
||||
|
||||
if !hasmapto("<leader>s@",'n')
|
||||
nnoremap <script> <silent> <buffer> <leader>s@ :sort /.\{-}\ze@/ <CR>
|
||||
endif
|
||||
|
||||
if !hasmapto("<leader>s+",'n')
|
||||
nnoremap <script> <silent> <buffer> <leader>s+ :sort /.\{-}\ze+/ <CR>
|
||||
endif
|
||||
|
||||
" Increment and Decrement The Priority
|
||||
:set nf=octal,hex,alpha
|
||||
|
||||
function! TodoTxtPrioritizeIncrease()
|
||||
"normal! 0f)h<C-a>
|
||||
normal! 0f)h
|
||||
endfunction
|
||||
|
||||
function! TodoTxtPrioritizeDecrease()
|
||||
"normal! 0f)h<C-a>
|
||||
normal! 0f)h
|
||||
endfunction
|
||||
|
||||
if !hasmapto("<leader>j",'n')
|
||||
"nnoremap <script> <silent> <buffer> <leader>j 0f)h<C-a>
|
||||
nnoremap <script> <silent> <buffer> <leader>j :call TodoTxtPrioritizeIncrease()<CR>
|
||||
endif
|
||||
|
||||
if !hasmapto("<leader>j",'v')
|
||||
"vnoremap <script> <silent> <buffer> <leader>j 0f)h<C-a>
|
||||
vnoremap <script> <silent> <buffer> <leader>j :call TodoTxtPrioritizeIncrease()<CR>
|
||||
endif
|
||||
|
||||
if !hasmapto("<leader>k",'n')
|
||||
"nnoremap <script> <silent> <buffer> <leader>k 0f)h<C-x>
|
||||
nnoremap <script> <silent> <buffer> <leader>k :call TodoTxtPrioritizeDecrease()<CR>
|
||||
endif
|
||||
|
||||
if !hasmapto("<leader>k",'v')
|
||||
"vnoremap <script> <silent> <buffer> <leader>k 0f)h<C-x>
|
||||
vnoremap <script> <silent> <buffer> <leader>k :call TodoTxtPrioritizeDecrease()<CR>
|
||||
endif
|
||||
|
||||
" Insert date {{{2
|
||||
if !hasmapto("date<Tab>",'i')
|
||||
|
||||
Reference in New Issue
Block a user