vim-polyglot/indent/Dockerfile.vim

28 lines
573 B
Docker
Raw Normal View History

if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'dockerfile') != -1
finish
endif
2018-12-26 14:22:36 -05:00
if exists('b:did_indent') | finish | endif
let b:did_indent = 1
function! DockerfileIndent(line)
let prev_line = getline(a:line - 1)
if a:line > 1 && prev_line =~ '\\\s*$'
let i = indent(a:line - 1)
if i == 0
let i += &l:shiftwidth
if &l:expandtab && prev_line =~# '^RUN\s'
" Overindent past RUN
let i = 4 + &l:shiftwidth
endif
endif
return i
endif
return -1
endfunction
set indentexpr=DockerfileIndent(v:lnum)