• nginx.conf and dockerfile带颜色


    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*(ONBUILDs+)?(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
    
  • 相关阅读:
    对树的操作(二叉树)
    数据结构之树
    数据结构
    unix网络编程之listen()详解
    算法基础
    哈希表工作原理
    数据结构之栈
    2014年9月面试汇总
    面试知识必备
    JavaScript之JS的执行环境和作用域
  • 原文地址:https://www.cnblogs.com/zdqc/p/11918785.html
Copyright © 2020-2023  润新知