From b8c77f6a2a1372a5c3ad8077ad36facf393bfacf Mon Sep 17 00:00:00 2001 From: Troy Comi Date: Mon, 25 Apr 2022 06:14:45 -0400 Subject: [PATCH] feat: vim syntax updates (#1584) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: add info on vim folds * chore: update vim syntax file for easier merges/diffs * chore: add more vim syntax items Added the following directives: - notebook - scattergather Added the following objects: - Paramspace - gather - scatter - workflow Added the following functions: - multiext - read_job_properties - service * Update README.md Co-authored-by: Johannes Köster Co-authored-by: Johannes Köster --- misc/vim/README.md | 4 ++ misc/vim/syntax/snakemake.vim | 77 ++++++++++++++++++++++++++++++----- 2 files changed, 71 insertions(+), 10 deletions(-) diff --git a/misc/vim/README.md b/misc/vim/README.md index 3e89eb908..09d0874b9 100644 --- a/misc/vim/README.md +++ b/misc/vim/README.md @@ -12,3 +12,7 @@ To manually install, copy `syntax/snakemake.vim` file to `$HOME/.vim/syntax` directory and `ftdetect/snakemake.vim` file to `$HOME/.vim/ftdetect`. Highlighting can be forced in a vim session with `:set syntax=snakemake`. + +By default, all rules will be folded. To unfold all levels, use `zR`. `zM` +will refold all levels. If you'd like to change the default, add +`set nofoldenable` to your `.vimrc`. To learn more, see `:h fold`. diff --git a/misc/vim/syntax/snakemake.vim b/misc/vim/syntax/snakemake.vim index 01a1fcf47..62b1ef0e9 100644 --- a/misc/vim/syntax/snakemake.vim +++ b/misc/vim/syntax/snakemake.vim @@ -44,16 +44,73 @@ source $VIMRUNTIME/indent/python.vim " group = "group" ":" stringliteral -syn keyword pythonStatement include workdir onsuccess onerror onstart -syn keyword pythonStatement ruleorder localrules configfile group -syn keyword pythonStatement wrapper conda shadow -syn keyword pythonStatement input output params wildcards priority message -syn keyword pythonStatement threads resources singularity container wildcard_constraints -syn keyword pythonStatement version run shell benchmark snakefile log script -syn keyword pythonStatement default_target template_engine -syn keyword pythonStatement rule subworkflow checkpoint nextgroup=pythonFunction skipwhite -syn keyword pythonBuiltinObj config checkpoints rules -syn keyword pythonBuiltinFunc directory ancient pipe unpack expand temp touch protected +" general directives (e.g. input) +syn keyword pythonStatement + \ benchmark + \ conda + \ configfile + \ container + \ default_target + \ group + \ include + \ input + \ localrules + \ log + \ message + \ notebook + \ onerror + \ onstart + \ onsuccess + \ output + \ params + \ priority + \ resources + \ ruleorder + \ run + \ scattergather + \ script + \ shadow + \ shell + \ singularity + \ snakefile + \ template_engine + \ threads + \ version + \ wildcard_constraints + \ wildcards + \ workdir + \ wrapper + +" directives with a label (e.g. rule) +syn keyword pythonStatement + \ checkpoint + \ rule + \ subworkflow + \ nextgroup=pythonFunction skipwhite + +" common snakemake objects +syn keyword pythonBuiltinObj + \ Paramspace + \ checkpoints + \ config + \ gather + \ rules + \ scatter + \ workflow + +" snakemake functions +syn keyword pythonBuiltinFunc + \ ancient + \ directory + \ expand + \ multiext + \ pipe + \ protected + \ read_job_properties + \ service + \ temp + \ touch + \ unpack " similar to special def and class treatment from python.vim, except " parenthetical part of def and class