码迷,mamicode.com
首页 > 其他好文 > 详细

nginx.conf and dockerfile带颜色

时间:2019-11-23 17:49:17      阅读:69      评论:0      收藏:0      [点我收藏+]

标签:keyword   comm   stop   wget   build   share   mfile   you   php   

wget http://www.vim.org/scripts/download_script.php?src_id=14376 -O nginx.vim

mv nginx.vim /usr/share/vim/vim74/syntax

echo "au BufRead,BufNewFile /application/nginx/* if &ft == ‘‘ | setfiletype nginx | endif" >> /usr/share/vim/vim74/filetype.vim #注意路径

docker

/usr/share/vim/vimfiles/doc/dockerfile.txt

    *dockerfile.txt*  Syntax highlighting for Dockerfiles

    Author: Honza Pokorny <https://honza.ca>
    License: BSD

    INSTALLATION                                                     *installation*

    Drop it on your Pathogen path and you're all set.

    FEATURES                                                             *features*

    The syntax highlighting includes:

    * The directives (e.g. FROM)
    * Strings
    * Comments

     vim:tw=78:et:ft=help:norl:

/usr/share/vim/vimfiles/ftdetect/dockerfile.vim

au BufNewFile,BufRead [Dd]ockerfile,Dockerfile.*,*.Dockerfile set filetype=dockerfile

/usr/share/vim/vimfiles/syntax/dockerfile.vim

    if exists("b:current_syntax")
        finish
    endif

    let b:current_syntax = "dockerfile"

    syntax case ignore

    syntax match dockerfileKeyword /\v^\s*(ONBUILD\s+)?(ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|RUN|SHELL|STOPSIGNAL|USER|VOLU
ME|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

    set commentstring=#\ %s

    " match "RUN", "CMD", and "ENTRYPOINT" lines, and parse them as shell
    let s:current_syntax = b:current_syntax
    unlet b:current_syntax
    syntax include @SH syntax/sh.vim
    let b:current_syntax = s:current_syntax
    syntax region shLine matchgroup=dockerfileKeyword  start=/\v^\s*(RUN|CMD|ENTRYPOINT)\s/ end=/\v$/ contains=@SH

nginx.conf and dockerfile带颜色

标签:keyword   comm   stop   wget   build   share   mfile   you   php   

原文地址:https://www.cnblogs.com/zdqc/p/11918785.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!