GithubHelp home page GithubHelp logo

ekalinin / dockerfile.vim Goto Github PK

View Code? Open in Web Editor NEW
696.0 16.0 78.0 121 KB

Vim syntax file & snippets for Docker's Dockerfile

License: MIT License

Makefile 6.13% Vim Script 67.18% Vim Snippet 26.69%
dockerfile docker vim vim-syntax viml snippets

dockerfile.vim's Introduction

Dockerfile.vim

Vim syntax file for Docker's Dockerfile and snippets for snipMate.

Screenshot

Here is an example in gnome-terminal with vim-monokai color scheme:

Vim & Dockerfile.vim

Installation

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

Or using Pathogen:

# Clone directly into the bundle folder.
git clone https://github.com/ekalinin/Dockerfile.vim.git ~/.vim/bundle/Dockerfile

Or using Vundle:

# near the top of your .vimrc
Plugin 'ekalinin/Dockerfile.vim'

Or using NeoBundle:

NeoBundle 'ekalinin/Dockerfile.vim'

Or using Vim-Plug

# Inside the Vim-Plug block on your .vimrc
Plug 'ekalinin/Dockerfile.vim'

License

See LICENSE file.

dockerfile.vim's People

Contributors

1995parham avatar ain avatar at0s avatar benknoble avatar bryant1410 avatar dkinzer avatar dnephin avatar e0da avatar ecylmz avatar ekalinin avatar eligundry avatar esampaio avatar ghostbar avatar jorgenevens avatar kthompso avatar maksim77 avatar metcalfc avatar mikaelz avatar nubs avatar omertuc avatar pantuza avatar pda avatar rafi avatar rendon avatar satyrius avatar sherzberg avatar sobrinho avatar tabrizian avatar telling avatar tokiwinter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dockerfile.vim's Issues

when pasting into a Dockerfile comment lines trigger everything to get commented out

Great token coloring however when pasting from clipboard into a vim session if the text getting pasted contains comments then incorrectly all subsequent lines of text get commented out

Example :

text copied from one Dockerfile :

`

RUN apt-get update

# install nodejs and npm
RUN apt-get install -y nodejs npm git git-core


ADD index.js /tmp/
ADD package.json /tmp/
ADD start.sh /tmp/

`

then pasted into a Dockerfile get transformed into :

`

RUN apt-get update

# install nodejs and npm
# RUN apt-get install -y nodejs npm git git-core
#
#
# ADD index.js /tmp/
# ADD package.json /tmp/
# ADD start.sh /tmp/
#

`

dockerfile.vim should recognize Dockerfile.multi

Currently Dockerfile.vim seems to only recognize files by the name of "Dockerfile". From what I've seena common naming convention for multistage builds is "Dockerfile.multi". Should Dockerfile.vim recognize this filename for syntax highlighting as well?

screen shot 2018-01-03 at 8 09 21 am

Dockerfile commands highlighted are not case-sensitive

I installed the plugin but very soon I figured out that the highlighting is messing with my dockerfile.
for instance, i had to run a script called run.sh , now the plugin is supposedly highlight RUN command,
since its a dockerfile but it also highlighted my script name i.e. run.sh "run" was highlighted .
like following:

COPY run.sh /usr/local/bin/run.sh

run was seen highlighted. If you guys can make the highlighting as case sensitive, will really appreciate it :)

improvement request for dockerfile

when I try to install Dockerfile.vim in Docker environment. need to perform the following instructions:

WORKDIR /tmp
RUN git clone https://github.com/ekalinin/Dockerfile.vim.git && \
         cd Dockerfile.vim && make install && cd .. &&  rm -rf Dockerfile.vim

which required make package, while make package is not necessary for docker image. May I suggest the following improvement ?

# Install Dockerfile.vim
RUN git clone https://github.com/ekalinin/Dockerfile.vim.git  ~/.vim/pack/plugins/start/dockerfile && \
          vim +"helptags ~/.vim/pack/plugins/start/dockerfile/doc" +qall

Dockerfile.Foo does not cause filetype to be set

Would the maintainers consider a pull request which added the compliment to the existing trailing *.[Dd]ockerfile filetype setter?

Something like:
autocmd BufRead,BufNewFile [Dd]ockerfile.* set ft=Dockerfile

I'm not sure how common this convention is, but I have seen it used in a few projects I've worked on.

Using under RHEL7

I use the syntaxhighlighting under RHEL7, and it wasn't usable.
Under Ubuntu it is perfect.
Please change two things.

  1. Rename the files to dockerfile.vim
  2. change the ftdetect/Dockerfile vim and set:
    " Dockerfile
    autocmd BufRead,BufNewFile Dockerfile set ft=Dockerfile
    autocmd BufRead,BufNewFile Dockerfile* set ft= Dockerfile
    autocmd BufRead,BufNewFile *.dock set ft=Dockerfile

At this way the syntaxhighlithting is usable under RHEL7.

Greets

detect lowercase dockerfile name

Currently only detects capitalized file name:

autocmd BufRead,BufNewFile Dockerfile set ft=Dockerfile
autocmd BufRead,BufNewFile Dockerfile* set ft=Dockerfile

except for wildcards:

autocmd BufRead,BufNewFile *.dock set ft=Dockerfile
autocmd BufRead,BufNewFile *.[Dd]ockerfile set ft=Dockerfile

Is there a strict reason why it can't support lowercase filenames with no extensions? I am new to docker and curious about this.

Feature Request: Automatic Commenting

For many languages, when you're inside a comment block and you add a new line, that line is also commented (at the same indentation as before). It would be nice to have this feature.

Example (cursor at pipe (|) character):

# This is a comment|
# more comments

Then, pressing enter would give

# This is a comment
# |
# more comments

Instead of

# This is a comment
|
# more comments

File type detection fails

I'm facing an issue in which file type detection fails when opening files named Dockerfile:

2020-02-16-195402_442x56_scrot
(note: file type is dockerfile instead of Dockerfile)

I'm not using any plugins that might interfere with this one. Do you have any idea how I can see which script sets the file type?

Task tag highlights

It'd be nice to have highlights for:

  • FIXME
  • TODO
  • XXX

So it'd look like this, eventually:

screen shot 2015-04-13 at 17 53 01

Remove non-Dockerfile keywords?

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

Why do these commands get special treatment?

why it dosen't work? none dockfile style shows

ubuntu 18.04,installed vim plug,and below is my .vimrc file configuration:
syntax enable
colorscheme molokai
call plug#begin('~/.vim/plugged')

"install vim-plug on your vimrc
Plug 'ekalinin/Dockerfile.vim'

call plug#end()

Highlight shell commands only

In #32, the issuer complains about the shell words being highlighted in situations that aren't intended.

I've experienced this too and believe command highlighting could use improvement. For example, the following command would highlight both tar the command and "tar" in the filename archive.tar.gz when it should only highlight the former.

RUN tar xzf archive.tar.gz

Makefile mkdir bug

@mkdir -p ~/.vim/{syntax,ftdetect,snippets}

on my ubuntu installation it creates one folder named "{syntax,ftdetect,snippets}".
So for better compatibility it should simply be changed to:
@mkdir -p ~/.vim/syntax
@mkdir -p ~/.vim/ftdetect
@mkdir -p ~/.vim/snippets

indenting: keywords should all left align

Keywords (such as FROM and RUN) should always be flush left.

I would expect that given this Dockerfile:

    FROM ubuntu
       RUN echo hi

That indenting it should result in:

FROM ubuntu
RUN echo hi

Install with Vundle

Windows 11+PowerShell+NeoVim+Vundle Manager (last stable versions).
Vundle can't install if present capital letter in name of plugin: Plugin 'ekalinin/Dockerfile.vim'
Need to change to cursive letter: Plugin 'ekalinin/dockerfile.vim' for installation.

~/.vim and Other Directories Do Not Exist

~ $ make install # Fails because of some directories were missing in my environment. Perhaps check for their existence first?

To fix I issued:
~ $ mkdir -p ~/.vim/{syntax,ftdetect,snippets}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.