Skip to content

Commit

Permalink
feat: vim syntax updates (#1584)
Browse files Browse the repository at this point in the history
* 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 <johannes.koester@tu-dortmund.de>
Co-authored-by: Johannes Köster <johannes.koester@uni-due.de>
  • Loading branch information
3 people committed Apr 25, 2022
1 parent 4cbfb47 commit b8c77f6
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 10 deletions.
4 changes: 4 additions & 0 deletions misc/vim/README.md
Expand Up @@ -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`.
77 changes: 67 additions & 10 deletions misc/vim/syntax/snakemake.vim
Expand Up @@ -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
Expand Down

0 comments on commit b8c77f6

Please sign in to comment.