CLI config/dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
4.3 KiB

  1. " plugin to handle the TaskPaper to-do list format
  2. " Language: Taskpaper (http://hogbaysoftware.com/projects/taskpaper)
  3. " Maintainer: David O'Callaghan <david.ocallaghan@cs.tcd.ie>
  4. " URL: https://github.com/davidoc/taskpaper.vim
  5. " Last Change: 2012-02-20
  6. if exists("b:did_ftplugin")
  7. finish
  8. endif
  9. let b:did_ftplugin = 1
  10. let s:save_cpo = &cpo
  11. set cpo&vim
  12. " Define a default date format
  13. if !exists('g:task_paper_date_format')
  14. let g:task_paper_date_format = "%Y-%m-%d"
  15. endif
  16. " Define a default archive project name
  17. if !exists('g:task_paper_archive_project')
  18. let g:task_paper_archive_project = "Archive"
  19. endif
  20. " When moving a task, should the cursor follow or stay in the same place
  21. " (default: follow)
  22. if !exists('g:task_paper_follow_move')
  23. let g:task_paper_follow_move = 1
  24. endif
  25. " Hide @done tasks when searching tags
  26. if !exists('g:task_paper_search_hide_done')
  27. let g:task_paper_search_hide_done = 0
  28. endif
  29. " Add '@' to keyword character set so that we can complete contexts as keywords
  30. setlocal iskeyword+=@-@
  31. " Tab character has special meaning on TaskPaper
  32. setlocal noexpandtab
  33. " Change 'comments' and 'formatoptions' to continue to write a task item
  34. setlocal comments=b:-
  35. setlocal fo-=c fo+=rol
  36. " Set 'autoindent' to maintain indent level
  37. setlocal autoindent
  38. " Set up mappings
  39. if !exists("no_plugin_maps") && !exists("no_taskpaper_maps")
  40. nnoremap <silent> <buffer> <Plug>TaskPaperFoldProjects
  41. \ :<C-u>call taskpaper#fold_projects()<CR>
  42. nnoremap <silent> <buffer> <Plug>TaskPaperFoldNotes
  43. \ :<C-u>call taskpaper#search('\v^(\s*\|\t+-\s+.*\|.+:)$')<CR>
  44. nnoremap <silent> <buffer> <Plug>TaskPaperFocusProject
  45. \ :<C-u>call taskpaper#focus_project()<CR>
  46. nnoremap <silent> <buffer> <Plug>TaskPaperSearchKeyword
  47. \ :<C-u>call taskpaper#search()<CR>
  48. nnoremap <silent> <buffer> <Plug>TaskPaperSearchTag
  49. \ :<C-u>call taskpaper#search_tag()<CR>
  50. nnoremap <silent> <buffer> <Plug>TaskPaperGoToProject
  51. \ :<C-u>call taskpaper#go_to_project()<CR>
  52. nnoremap <silent> <buffer> <Plug>TaskPaperNextProject
  53. \ :<C-u>call taskpaper#next_project()<CR>
  54. nnoremap <silent> <buffer> <Plug>TaskPaperPreviousProject
  55. \ :<C-u>call taskpaper#previous_project()<CR>
  56. nnoremap <silent> <buffer> <Plug>TaskPaperArchiveDone
  57. \ :<C-u>call taskpaper#archive_done()<CR>
  58. nnoremap <silent> <buffer> <Plug>TaskPaperShowToday
  59. \ :<C-u>call taskpaper#search_tag('today')<CR>
  60. nnoremap <silent> <buffer> <Plug>TaskPaperShowCancelled
  61. \ :<C-u>call taskpaper#search_tag('cancelled')<CR>
  62. nnoremap <silent> <buffer> <Plug>TaskPaperToggleCancelled
  63. \ :call taskpaper#toggle_tag('cancelled', taskpaper#date())<CR>
  64. nnoremap <silent> <buffer> <Plug>TaskPaperToggleDone
  65. \ :call taskpaper#toggle_tag('done', taskpaper#date())<CR>
  66. nnoremap <silent> <buffer> <Plug>TaskPaperToggleToday
  67. \ :call taskpaper#toggle_tag('today', '')<CR>
  68. nnoremap <silent> <buffer> <Plug>TaskPaperMoveToProject
  69. \ :call taskpaper#move_to_project()<CR>
  70. nnoremap <silent> <buffer> <Plug>TaskPaperNewline
  71. \ o<C-r>=taskpaper#newline()<CR>
  72. inoremap <silent> <buffer> <Plug>TaskPaperNewline
  73. \ <CR><C-r>=taskpaper#newline()<CR>
  74. nmap <buffer> <Leader>tp <Plug>TaskPaperFoldProjects
  75. nmap <buffer> <Leader>t. <Plug>TaskPaperFoldNotes
  76. nmap <buffer> <Leader>tP <Plug>TaskPaperFocusProject
  77. nmap <buffer> <Leader>t/ <Plug>TaskPaperSearchKeyword
  78. nmap <buffer> <Leader>ts <Plug>TaskPaperSearchTag
  79. nmap <buffer> <Leader>tg <Plug>TaskPaperGoToProject
  80. nmap <buffer> <Leader>tj <Plug>TaskPaperNextProject
  81. nmap <buffer> <Leader>tk <Plug>TaskPaperPreviousProject
  82. nmap <buffer> <Leader>tD <Plug>TaskPaperArchiveDone
  83. nmap <buffer> <Leader>tT <Plug>TaskPaperShowToday
  84. nmap <buffer> <Leader>tX <Plug>TaskPaperShowCancelled
  85. nmap <buffer> <Leader>td <Plug>TaskPaperToggleDone
  86. nmap <buffer> <Leader>tt <Plug>TaskPaperToggleToday
  87. nmap <buffer> <Leader>tx <Plug>TaskPaperToggleCancelled
  88. nmap <buffer> <Leader>tm <Plug>TaskPaperMoveToProject
  89. if mapcheck("o", "n") == ''
  90. nmap <buffer> o <Plug>TaskPaperNewline
  91. endif
  92. if mapcheck("\<CR>", "i") == ''
  93. imap <buffer> <CR> <Plug>TaskPaperNewline
  94. endif
  95. endif
  96. let &cpo = s:save_cpo