From 1c4810bd407c8ff992eeffa24d5234fefff4826e Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 2 Feb 2019 20:14:29 +0100 Subject: tv vim-syntax-nix-nested: add writer{Ext,Name} --- tv/2configs/vim.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'tv/2configs/vim.nix') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 3794628c..9f78d6e0 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -250,6 +250,9 @@ let { def = k: ''${k}[ \t\r\n]*=''; writer = k: ''write${k}[^ \t\r\n]*[ \t\r\n]*\("[^"]*"\|[a-z]\+\)''; + writerExt = k: writerName ''[^"]*\.${k}''; + writerName = k: ''write[^ \t\r\n]*[ \t\r\n]*"${k}"''; + in { c = {}; cabal = {}; @@ -257,7 +260,7 @@ let { haskell = {}; jq.extraStart = alts [ (writer "Jq") - ''write[^ \t\r\n]*[ \t\r\n]*"[^"]*\.jq"'' + (writerExt "jq") ]; javascript.extraStart = ''/\* js \*/''; lua = {}; @@ -287,8 +290,10 @@ let { (writer (alts (map capitalize shells))) ]; yaml = {}; - vim.extraStart = - ''write[^ \t\r\n]*[ \t\r\n]*"\(\([^"]*\.\)\?vimrc\|[^"]*\.vim\)"''; + vim.extraStart = alts [ + (writerExt "vim") + (writerName ''\([^"]*\.\)\?vimrc'') + ]; xdefaults = {}; }))} -- cgit v1.2.3 From 21a0d53f2fbe652db372c11349e066d66b75e66e Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 2 Feb 2019 20:20:44 +0100 Subject: tv vim-syntax-nix-nested: detect .vim".text --- tv/2configs/vim.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tv/2configs/vim.nix') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 9f78d6e0..7e37ef32 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -130,14 +130,14 @@ let { ''; }))) ((rtp: rtp // { inherit rtp; }) (pkgs.write "vim-syntax-nix-nested" { - "/syntax/haskell.vim".text = /* vim */ '' + "/syntax/haskell.vim".text = '' syn region String start=+\[[[:alnum:]]*|+ end=+|]+ hi link ConId Identifier hi link VarId Identifier hi link hsDelimiter Delimiter ''; - "/syntax/nix.vim".text = /* vim */ '' + "/syntax/nix.vim".text = '' "" Quit when a (custom) syntax file was already loaded "if exists("b:current_syntax") " finish @@ -291,6 +291,7 @@ let { ]; yaml = {}; vim.extraStart = alts [ + (def ''"[^"]*\.vim"\.text'') (writerExt "vim") (writerName ''\([^"]*\.\)\?vimrc'') ]; @@ -334,7 +335,7 @@ let { set isk=@,48-57,_,192-255,-,' ''; - "/syntax/sed.vim".text = /* vim */ '' + "/syntax/sed.vim".text = '' syn region sedBranch \ matchgroup=sedFunction start="T" \ matchgroup=sedSemicolon end=";\|$" -- cgit v1.2.3 From cc063ceb8fc334b3641d5483dc05d1b7ce42c1db Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 2 Feb 2019 20:24:11 +0100 Subject: tv vim haskell: isk+=' --- tv/2configs/vim.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tv/2configs/vim.nix') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 7e37ef32..fe148281 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -129,6 +129,19 @@ let { command! -n=0 -bar ShowSyntax :call ShowSyntax() ''; }))) + ((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+=' + ''; + })) ((rtp: rtp // { inherit rtp; }) (pkgs.write "vim-syntax-nix-nested" { "/syntax/haskell.vim".text = '' syn region String start=+\[[[:alnum:]]*|+ end=+|]+ -- cgit v1.2.3 From 49f0a670a6ecaf7c229fc29aad2b33f5f4b4779b Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 2 Feb 2019 21:21:48 +0100 Subject: tv vim: add TODO ft --- tv/2configs/vim.nix | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'tv/2configs/vim.nix') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index fe148281..de843a30 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -141,6 +141,43 @@ let { 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 Comment /#.*/ + + syn match todoDate /^[1-9]\S*/ + \ nextgroup=todoSummary + + syn region todoSummary + \ contained + \ contains=todoTag + \ start="." end="$\n" + \ nextgroup=todoBlock + + syn match todoTag /\[[a-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 todoDate ctermfg=255 + hi todoSummary ctermfg=229 + hi todoBlock ctermfg=248 + hi todoTag ctermfg=217 + ''; })) ((rtp: rtp // { inherit rtp; }) (pkgs.write "vim-syntax-nix-nested" { "/syntax/haskell.vim".text = '' -- cgit v1.2.3 From 0e97f41f6ece2d878c98c234ba59f6b73c6cc0f8 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 2 Feb 2019 23:15:16 +0100 Subject: tv vim todo: allow A-Z in tags --- tv/2configs/vim.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tv/2configs/vim.nix') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index de843a30..575a3bcb 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -162,7 +162,7 @@ let { \ start="." end="$\n" \ nextgroup=todoBlock - syn match todoTag /\[[a-z]\+\]/hs=s+1,he=e-1 + syn match todoTag /\[[A-Za-z]\+\]/hs=s+1,he=e-1 \ contained syn region todoBlock -- cgit v1.2.3 From 820b7cc1f76767d9cead8022668c5932fec00d28 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 3 Feb 2019 13:39:30 +0100 Subject: tv vim todo: form feed ends a block --- tv/2configs/vim.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tv/2configs/vim.nix') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 575a3bcb..9942ff65 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -169,7 +169,7 @@ let { \ contained \ contains=Comment \ fold - \ start="^[^1-9]" end="^[1-9]"re=s-1,he=s-1,me=s-1 + \ start="^[^1-9]" end="^[1-9 ]"re=s-1,he=s-1,me=s-1 syn sync minlines=1000 -- cgit v1.2.3