Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: vim syntax updates #1584

Merged
merged 5 commits into from Apr 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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