Random Figure

Liangcheng Yu

I am interested in systems and networking. This is my homepage and blog.
Email: leoyu@seas.upenn.edu

HOWTO: Manage GTD Tasks with Vim

30 Jan 2019 » tips

There are existing terminal GTD tools such as OrgMode. However, they are too versatile and I want a simplistic version with Vim. My goal could be decomposed into several aspects.

  1. Hotkeys to quickly collect tasks information in distributed files and prompt a digest.
  2. Tasks are classified with different types: urgent, main, habit, and random.
  3. Hotkeys to quickly tag a task item with the desired type.

Since I could not find any existing plugins that suit exactly my need, I decided to make it myself. To achieve goal 1, one could simply leverage vimgrep to search the unique meta data of the task and noremap to attach preferred key bindings to the operation.

noremap <Leader>ta :vimgrep /TTT_/j ~/my-emacs/vimwiki/**/*<CR>:cw<CR>
noremap <Leader>tu :vimgrep /TTT_URGENT/j ~/my-emacs/vimwiki/**/*<CR>:cw<CR>
noremap <Leader>tm :vimgrep /TTT_MAIN/j ~/my-emacs/vimwiki/**/*<CR>:cw<CR>
noremap <Leader>th :vimgrep /TTT_HABIT/j ~/my-emacs/vimwiki/**/*<CR>:cw<CR>
noremap <Leader>tr :vimgrep /TTT_RANDOM/j ~/my-emacs/vimwiki/**/*<CR>:cw<CR>

These commands will allow me to quickly track the tasks of different categories with a inforwindow. (j is to forbid jumping to the first occurence and :cw is to directly jump to the quickfix window)

Simlilarly, one could add the following lines to .vimrc to support instant tagging.

noremap <Leader>mu <Esc>i\ TTT_URGENT 
noremap <Leader>mm <Esc>i\ TTT_MAIN 
noremap <Leader>mr <Esc>i\ TTT_RANDOM 
noremap <Leader>mh <Esc>i\ TTT_HABIT 

Now, inside Vim editor, one could just type the hotkeys to overview the target type of tasks. :cclose will clost the quickfix window without the need of navigation. :cn and :cp will navigate automatically to the next/previous task.

PS: I have abandoned Vim as the time/task management tool. It is much more convenient to use the Mac Calendar!