0
点赞
收藏
分享

微信扫一扫

nginx.conf and dockerfile带颜色

Ewall_熊猫 2023-03-11 阅读 108

本文章向大家介绍nginx.conf and dockerfile带颜色,主要包括nginx.conf and dockerfile带颜色使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

1 nginx高亮配置

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 #注意路径

2 docker高亮配置

2.1创建dockerfile.txt

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

2.2 添加如下参数

*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:

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

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

2.4 vim /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




举报

相关推荐

0 条评论