summaryrefslogtreecommitdiffstats
path: root/tv/5pkgs/vim/tv.nix
blob: ae6245b87d9a86a1e9af8e2eae9584f72351cb3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{ pkgs }:

(rtp: rtp // { inherit rtp; }) (pkgs.write "vim-tv" {
  #
  # Haskell
  #
  "/ftplugin/haskell.vim".text = ''
    if exists("g:vim_tv_ftplugin_haskell_loaded")
      finish
    endif
    let g:vim_tv_ftplugin_haskell_loaded = 1

    setlocal iskeyword+='
  '';
  #
  # TODO
  #
  "/ftdetect/todo.vim".text = ''
    au BufRead,BufNewFile TODO set ft=todo
  '';
  "/ftplugin/todo.vim".text = ''
    setlocal foldmethod=syntax
  '';
  "/syntax/todo.vim".text = ''
    syn match todoComment /#.*/

    syn match todoDate /^[1-9]\S*/
      \ nextgroup=todoSummary

    syn region todoSummary
      \ contained
      \ contains=todoTag
      \ start="." end="$\n"
      \ nextgroup=todoBlock

    syn match todoTag /\[[A-Za-z]\+\]/hs=s+1,he=e-1
      \ contained

    syn region todoBlock
      \ contained
      \ contains=Comment
      \ fold
      \ start="^[^1-9]" end="^[1-9]"re=s-1,he=s-1,me=s-1

    syn sync minlines=1000

    hi link todoComment Comment
    hi todoDate ctermfg=255
    hi todoSummary ctermfg=229
    hi todoBlock ctermfg=248
    hi todoTag ctermfg=217
  '';
})