From 2b1938816662934441e86b8891db8368f1bdf37d Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Thu, 26 Sep 2013 12:48:01 +0200 Subject: [PATCH] Add dockerfile syntax support --- README.md | 1 + build | 1 + ftdetect/polyglot.vim | 1 + syntax/dockerfile.vim | 22 ++++++++++++++++++++++ 4 files changed, 25 insertions(+) create mode 100644 syntax/dockerfile.vim diff --git a/README.md b/README.md index 20925ba..2b9df56 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo - [css-color](https://github.com/ap/vim-css-color) (syntax) - [csv](https://github.com/chrisbra/csv.vim) (syntax, ftplugin, ftdetect) - [cucumber](https://github.com/tpope/vim-cucumber) (syntax, indent, compiler, ftplugin, ftdetect) +- [dockerfile](https://github.com/honza/dockerfile.vim) (syntax, ftdetect) - [elixir](https://github.com/elixir-lang/vim-elixir) (syntax, indent, compiler, ftplugin, ftdetect) - [erlang](https://github.com/oscarh/vimerl) (syntax, indent, compiler, autoload, ftplugin) - [git](https://github.com/tpope/vim-git) (syntax, indent, ftplugin, ftdetect) diff --git a/build b/build index 2eff07a..deed655 100755 --- a/build +++ b/build @@ -73,6 +73,7 @@ PACKS=" css-color:ap/vim-css-color csv:chrisbra/csv.vim cucumber:tpope/vim-cucumber + dockerfile:honza/dockerfile.vim elixir:elixir-lang/vim-elixir erlang:oscarh/vimerl git:tpope/vim-git diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim index 3c2604c..dc3b2e8 100644 --- a/ftdetect/polyglot.vim +++ b/ftdetect/polyglot.vim @@ -12,6 +12,7 @@ endfunction autocmd BufNewFile,BufRead * call s:DetectCoffee() au BufRead,BufNewFile *.csv,*.dat,*.tsv,*.tab set filetype=csv autocmd BufNewFile,BufReadPost *.feature,*.story set filetype=cucumber +au BufNewFile,BufRead Dockerfile set filetype=dockerfile au BufRead,BufNewFile *.ex,*.exs set filetype=elixir au FileType elixir setl sw=2 sts=2 et iskeyword+=!,? autocmd BufNewFile,BufRead *.git/{,modules/**/}{COMMIT_EDIT,MERGE_}MSG set ft=gitcommit diff --git a/syntax/dockerfile.vim b/syntax/dockerfile.vim new file mode 100644 index 0000000..90e0651 --- /dev/null +++ b/syntax/dockerfile.vim @@ -0,0 +1,22 @@ +" dockerfile.vim - Syntax highlighting for Dockerfiles +" Maintainer: Honza Pokorny +" Version: 0.5 + + +if exists("b:current_syntax") + finish +endif + +let b:current_syntax = "dockerfile" + +syntax case ignore + +syntax match dockerfileKeyword /\v^\s*(FROM|MAINTAINER|RUN|CMD|EXPOSE|ENV|ADD)\s/ +syntax match dockerfileKeyword /\v^\s*(ENTRYPOINT|VOLUME|USER|WORKDIR)\s/ +highlight link dockerfileKeyword Keyword + +syntax region dockerfileString start=/\v"/ skip=/\v\\./ end=/\v"/ +highlight link dockerfileString String + +syntax match dockerfileComment "\v^\s*#.*$" +highlight link dockerfileComment Comment