├── README.mkd ├── ftdetect └── task.vim ├── plugin └── task.vim └── syntax └── task.vim /README.mkd: -------------------------------------------------------------------------------- 1 | ## Overview 2 | Basically, this is the [TextMate Tasks Bundle](http://henrik.nyh.se/2007/08/tasks-bundle "TextMate Tasks Bundle") port for Vim. 3 | 4 | ## ScreenShot 5 | 6 | ### Vim-Task in Action 7 | Vim-Task in Action 8 | 9 | ### Vim-Task with Monaco font 10 | Vim-Task with Monaco font 11 | 12 | ### Vim-Task with Consolas font (which support bold & italic) 13 | Vim-Task with Consolas font 14 | 15 | ## Installation 16 | Normal installation steps follow the vim tradition: download the zip/tar archive then copy all the directories/files to ~/.vim directory. You can download vim-task zip/tar archive by clicking the “Download Source” button in github. 17 | 18 | You can also check out the latest code if you have git installed: 19 | 20 | $ git clone git://github.com/samsonw/vim-task.git 21 | $ cd vim-task 22 | $ rm README.mkd 23 | $ cp -rv * ~/.vim 24 | 25 | For those guys who use [pathogen](http://github.com/tpope/vim-pathogen "pathogen"), the installation should be as simple as a git clone: 26 | $ cd ~/.vim/bundle 27 | $ git clone git://github.com/samsonw/vim-task.git 28 | 29 | ## Shortcut Key, Key Binding & Customization 30 | By default, I mapped Ctrl+Command+Enter for toggling task status, you can simply remap to what’s the most comfortable for you: 31 | 32 | inoremap :call Toggle_task_status()i 33 | noremap :call Toggle_task_status() 34 | 35 | ~~Note, if you find the key binding doesn’t work as expect, please make sure your vim instance was compiled with the +ruby feature.~~ 36 | Compiled with +ruby is not required any more, following +ruby check is optional since this plugin has already been ported to native vim script. 37 | 38 | $ vim --version | grep +ruby 39 | -python3 +quickfix +reltime +rightleft +ruby +scrollbind +signs +smartindent 40 | 41 | ## File Format & Syntax 42 | The Tasks grammar and commands by default apply to file todo.txt and files with the .task and .tasks extensions. You can customize this by editing ftdetect/task.vim: 43 | 44 | autocmd BufNewFile,BufRead todo.txt,*.task,*.tasks setfiletype task 45 | 46 | All the formats and syntax is similar with the [TextMate Tasks bundle](http://henrik.nyh.se/2007/08/tasks-bundle "TextMate Tasks Bundle"), I just quoted below for your references: 47 | 48 | > Headers end with a colon (“:”). 49 | > Pending (uncompleted) tasks start with a hyphen (“-”). Completed tasks start with a checkmark (“✓”). 50 | > Headers and tasks can be indented for grouping/hierarchy, as seen in the screenshot above. 51 | 52 | ## Bug & Feedback 53 | Please report bugs and issues to github: , any feedback and suggestion is welcome and appreciated. 54 | 55 | -------------------------------------------------------------------------------- /ftdetect/task.vim: -------------------------------------------------------------------------------- 1 | autocmd BufNewFile,BufRead todo.txt,*.task,*.tasks setfiletype task 2 | -------------------------------------------------------------------------------- /plugin/task.vim: -------------------------------------------------------------------------------- 1 | " Boilerplate 2 | if (exists("g:loaded_task")) 3 | finish 4 | endif 5 | let g:loaded_task = 1 6 | 7 | let s:cpo_save = &cpo 8 | set cpo&vim 9 | 10 | function! Toggle_task_status() 11 | let line = getline('.') 12 | if match(line, '^\(\s*\)-') == 0 13 | let line = substitute(line, '^\(\s*\)-', '\1✓', '') 14 | elseif match(line, '^\(\s*\)✓') == 0 15 | let line = substitute(line, '^\(\s*\)✓\s\=\<', '\1', '') 16 | else 17 | let line = substitute(line, '^\(\s\{-}\)\(\s\=\)\<', '\2\1- ', '') 18 | endif 19 | call setline('.', line) 20 | endfunction 21 | 22 | inoremap :call Toggle_task_status()i 23 | noremap :call Toggle_task_status() 24 | 25 | " Boilerplate 26 | let &cpo = s:cpo_save 27 | unlet s:cpo_save 28 | 29 | -------------------------------------------------------------------------------- /syntax/task.vim: -------------------------------------------------------------------------------- 1 | if exists("b:current_syntax") 2 | finish 3 | endif 4 | 5 | syntax keyword taskKeyword New new Working working Done done Todo TODO todo bug Bug 6 | 7 | syntax match taskWorkingIcon "^-" contained 8 | syntax match taskWorkingIcon "^\s*-" contained 9 | syntax match taskDoneIcon "^✓" contained 10 | syntax match taskDoneIcon "^\s*✓" contained 11 | 12 | syntax match taskWorkingItem "^-.*" contains=taskWorkingIcon,taskKeyword 13 | syntax match taskWorkingItem "^\s*-.*" contains=taskWorkingIcon,taskKeyword 14 | syntax match taskDoneItem "^✓.*" contains=taskDoneIcon,taskKeyword 15 | syntax match taskDoneItem "^\s*✓.*" contains=taskDoneIcon,taskKeyword 16 | 17 | highlight taskKeyword guifg=#96CBFE guibg=NONE gui=NONE ctermfg=blue ctermbg=NONE cterm=NONE 18 | 19 | highlight taskWorkingItem guifg=#f6f3e8 guibg=NONE gui=NONE ctermfg=NONE ctermbg=NONE cterm=NONE 20 | highlight taskDoneItem guifg=#A8FF60 guibg=NONE gui=italic ctermfg=green ctermbg=NONE cterm=NONE 21 | 22 | highlight taskWorkingIcon guifg=#FF6C60 guibg=NONE gui=NONE ctermfg=red ctermbg=NONE cterm=NONE 23 | highlight taskDoneIcon guifg=#A8FF60 guibg=NONE gui=italic ctermfg=green ctermbg=NONE cterm=NONE 24 | 25 | syntax match sectionTitleLine "^.*:\s*$" contains=sectionTitle 26 | syntax match sectionTitle "\S.*:\s*$" 27 | highlight sectionTitle guifg=#96CBFE guibg=NONE gui=bold,underline ctermfg=blue ctermbg=NONE cterm=bold,underline 28 | 29 | let b:current_syntax = "task" 30 | 31 | --------------------------------------------------------------------------------