Permalink
Browse files

Add autoindent for line continuation

  • Loading branch information...
1 parent f0550b7 commit 1f4d04d7e69d8bb43a974439b1c458b68f1074ba @tweekmonster tweekmonster committed Mar 12, 2016
Showing with 23 additions and 0 deletions.
  1. +23 −0 indent/Dockerfile.vim
View
@@ -0,0 +1,23 @@
+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)

0 comments on commit 1f4d04d

Please sign in to comment.