Skip to content

Commit

Permalink
Added Dockerfile.vim
Browse files Browse the repository at this point in the history
  • Loading branch information
statico committed Oct 2, 2015
1 parent df8f93a commit 7642d91
Show file tree
Hide file tree
Showing 9 changed files with 207 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .vim/bundle/Dockerfile.vim/.gitignore
@@ -0,0 +1,2 @@
*.swp
*.swo
20 changes: 20 additions & 0 deletions .vim/bundle/Dockerfile.vim/LICENSE
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) 2013 Eugene Kalinin

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12 changes: 12 additions & 0 deletions .vim/bundle/Dockerfile.vim/Makefile
@@ -0,0 +1,12 @@
install:
@echo "Installation:"
@mkdir -p ~/.vim/syntax
@mkdir -p ~/.vim/ftdetect
@mkdir -p ~/.vim/snippets
@echo " * Dirs ... success."
@cp ./syntax/Dockerfile.vim ~/.vim/syntax/
@echo " * Syntax ... success."
@cp ./ftdetect/Dockerfile.vim ~/.vim/ftdetect/
@echo " * Filetype ... success."
@cp ./snippets/Dockerfile.snippets ~/.vim/snippets/
@echo " * Snippets ... success."
41 changes: 41 additions & 0 deletions .vim/bundle/Dockerfile.vim/README.md
@@ -0,0 +1,41 @@
Dockerfile.vim
==============

Vim syntax file for [Docker](http://docker.io/)'s [Dockerfile](http://docs.docker.com/reference/builder/)
and snippets for [snipMate](http://www.vim.org/scripts/script.php?script_id=2540).

Screenshot
==========

Here is an example in gnome-terminal with [vim-monokai](https://github.com/sickill/vim-monokai) color scheme:


![Vim & Dockerfile.vim ](https://raw.github.com/ekalinin/Dockerfile.vim/master/vim-dockerfile-example.png)



Installation
============

````bash
$ git clone https://github.com/ekalinin/Dockerfile.vim.git
$ cd Dockerfile.vim
$ make install
````

####OR using Pathogen:
```bash
# Clone directly into the bundle folder.
git clone https://github.com/ekalinin/Dockerfile.vim.git bundle/Dockerfile
```

####OR using Vundle:
```bash
# near the top of your .vimrc
Plugin 'ekalinin/Dockerfile.vim'
```

License
=======

See [LICENSE](https://github.com/ekalinin/Dockerfile.vim/blob/master/LICENSE) file.
4 changes: 4 additions & 0 deletions .vim/bundle/Dockerfile.vim/ftdetect/Dockerfile.vim
@@ -0,0 +1,4 @@
" Dockerfile
autocmd BufRead,BufNewFile Dockerfile set ft=Dockerfile
autocmd BufRead,BufNewFile Dockerfile* setf Dockerfile
autocmd BufRead,BufNewFile *.dock setf Dockerfile
66 changes: 66 additions & 0 deletions .vim/bundle/Dockerfile.vim/snippets/Dockerfile.snippets
@@ -0,0 +1,66 @@
snippet F
FROM ${1:ubuntu}
snippet f
FROM ${1:ubuntu}
snippet M
MAINTAINER ${1:name}
snippet m
MAINTAINER ${1:name}
snippet R
RUN ${1:command}
snippet r
RUN ${1:command}
snippet C
CMD ${1:command}
snippet c
CMD ${1:command}
snippet CP
COPY ${1:src} ${2:dest}
snippet cp
COPY ${1:src} ${2:dest}
snippet EXP
EXPOSE ${1:port}
snippet exp
EXPOSE ${1:port}
snippet E
ENV ${1:key} ${2:value}
snippet e
ENV ${1:key} ${2:value}
snippet A
ADD ${1:src} ${2:dst}
snippet a
ADD ${1:src} ${2:dst}
snippet ENT
ENTRYPOINT ${1:command}
snippet ent
ENTRYPOINT ${1:command}
snippet V
VOLUME ["${1:path}"]
snippet v
VOLUME ["${1:path}"]
snippet U
USER ${1:name}
snippet u
USER ${1:name}
snippet W
WORKDIR ${1:path}
snippet w
WORKDIR ${1:path}
snippet upd
# update packages
RUN echo "deb http://archive.ubuntu.com/ubuntu ${1:precise} main universe" > /etc/apt/sources.list; \
apt-get update && apt-get -y upgrade; \
${2}
snippet head
# ${1:Description}
#
# VERSION ${2:0.1.0}
${3}
snippet O
ONBUILD ${1}
snippet o
ONBUILD ${1}
snippet L
LABEL ${1:label}="${2:value}"
snippet l
LABEL ${1:label}="${2:value}"
61 changes: 61 additions & 0 deletions .vim/bundle/Dockerfile.vim/syntax/Dockerfile.vim
@@ -0,0 +1,61 @@
" Vim syntax file
" Language: Dockerfile
" Maintainer: Eugene Kalinin
" Latest Revision: 11 September 2013
" Source: http://docs.docker.io/en/latest/use/builder/

if exists("b:current_syntax")
finish
endif

" case sensitivity (fix #17)
" syn case ignore

" Keywords
syn keyword dockerfileKeywords FROM MAINTAINER RUN CMD COPY
syn keyword dockerfileKeywords EXPOSE ENV ADD ENTRYPOINT
syn keyword dockerfileKeywords VOLUME USER WORKDIR ONBUILD
syn keyword dockerfileKeywords LABEL

" Bash statements
setlocal iskeyword+=-
syn keyword bashStatement add-apt-repository adduser apt-get aptitude apt-key autoconf bundle
syn keyword bashStatement cd chgrp chmod chown clear complete composer cp curl du echo egrep
syn keyword bashStatement expr fgrep find gem gnufind gnugrep gpg grep groupadd head less ln
syn keyword bashStatement ls make mkdir mv node npm pacman php python rails rm rmdir rpm ruby
syn keyword bashStatement sed sleep sort strip tar tail tailf touch useradd virtualenv yum
syn keyword bashStatement usermod bash cat a2ensite a2dissite a2enmod a2dismod apache2ctl
syn keyword bashStatement wget gzip

" Strings
syn region dockerfileString start=/"/ skip=/\\"/ end=/"/
syn region dockerfileString1 start=/'/ skip=/\\'/ end=/'/

" Emails
syn region dockerfileEmail start=/</ end=/>/ contains=@ oneline

" Urls
syn match dockerfileUrl /\(http\|https\|ssh\|hg\|git\)\:\/\/[a-zA-Z0-9\/\-\.]\+/

" Task tags
syn keyword dockerfileTodo contained TODO FIXME XXX

" Comments
syn region dockerfileComment start="#" end="\n" contains=dockerfileTodo

" Highlighting
hi link dockerfileKeywords Keyword
hi link dockerfileString String
hi link dockerfileString1 String
hi link dockerfileComment Comment
hi link dockerfileEmail Identifier
hi link dockerfileUrl Identifier
hi link dockerfileTodo Todo
hi link bashStatement Function

let b:current_syntax = "dockerfile"

set commentstring=#\ %s

" Enable automatic comment insertion
setlocal fo+=cro
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .vim/update.sh
Expand Up @@ -45,6 +45,7 @@ repos=(
https://github.com/ctrlpvim/ctrlp.vim.git
https://github.com/digitaltoad/vim-jade.git
https://github.com/docunext/closetag.vim.git
https://github.com/ekalinin/Dockerfile.vim.git
https://github.com/elzr/vim-json.git
https://github.com/ervandew/supertab
https://github.com/groenewege/vim-less.git
Expand Down

0 comments on commit 7642d91

Please sign in to comment.